https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4ef6173d2dfeafd33deedf7ce0d384cfbcf1170d commit 4ef6173d2dfeafd33deedf7ce0d384cfbcf1170d Author: Tom de Vries <tdevries@suse.de> Date: Thu Mar 28 08:26:31 2024 +0100 [gdb/testsuite] Fix gdb.base/ending-run.exp on manjaro linux On aarch64-linux, using the manjaro linux distro, I run into: ... (gdb) next^M 32 }^M (gdb) next^M 0x0000fffff7d67b80 in ?? () from /usr/lib/libc.so.6^M (gdb) FAIL: gdb.base/ending-run.exp: step out of main ... What happens here is described in detail in this clause: ... -re "0x.*\\?\\? \\(\\) from /lib/powerpc.*$gdb_prompt $" { # This case occurs on Powerpc when gdb steps out of main and the # needed debug info files are not loaded on the system, preventing # GDB to determine which function it reached (__libc_start_call_main). # Ideally, the target system would have the necessary debugging # information, but in its absence, GDB's behavior is as expected. ... } ... but the clause only matches for powerpc. Fix this by: - making the regexp generic enough to also match /usr/lib/libc.so.6, and - updating the comment to not mention powerpc. Tested on aarch64-linux. PR testsuite/31450 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31450 Diff: --- gdb/testsuite/gdb.base/ending-run.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 9c80de6879b..b9a72b0e70e 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -206,8 +206,8 @@ gdb_test_multiple "next" "step out of main" { # This is what happens on system using uClibc. pass "step out of main" } - -re "0x.*\\?\\? \\(\\) from /lib/powerpc.*$gdb_prompt $" { - # This case occurs on Powerpc when gdb steps out of main and the + -re -wrap "$hex in \\?\\? \\(\\) from \[^\r\n\]+" { + # This case occurs when gdb steps out of main and the # needed debug info files are not loaded on the system, preventing # GDB to determine which function it reached (__libc_start_call_main). # Ideally, the target system would have the necessary debugging
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a26b7d06eb20bf8c83c9204a398c3444b5c28ddb commit a26b7d06eb20bf8c83c9204a398c3444b5c28ddb Author: Tom de Vries <tdevries@suse.de> Date: Thu Mar 28 08:26:31 2024 +0100 [gdb/testsuite] Fix test-case gdb.threads/attach-stopped.exp on manjaro linux When running test-case gdb.threads/attach-stopped.exp on aarch64-linux, using the manjaro linux distro, I get: ... (gdb) thread apply all bt^M ^M Thread 2 (Thread 0xffff8d8af120 (LWP 278116) "attach-stopped"):^M #0 0x0000ffff8d964864 in clock_nanosleep () from /usr/lib/libc.so.6^M #1 0x0000ffff8d969cac in nanosleep () from /usr/lib/libc.so.6^M #2 0x0000ffff8d969b68 in sleep () from /usr/lib/libc.so.6^M #3 0x0000aaaade370828 in func (arg=0x0) at attach-stopped.c:29^M #4 0x0000ffff8d930aec in ?? () from /usr/lib/libc.so.6^M #5 0x0000ffff8d99a5dc in ?? () from /usr/lib/libc.so.6^M ^M Thread 1 (Thread 0xffff8db62020 (LWP 278111) "attach-stopped"):^M #0 0x0000ffff8d92d2d8 in ?? () from /usr/lib/libc.so.6^M #1 0x0000ffff8d9324b8 in ?? () from /usr/lib/libc.so.6^M #2 0x0000aaaade37086c in main () at attach-stopped.c:45^M (gdb) FAIL: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped bt ... The problem is that the test-case expects to see start_thread: ... gdb_test "thread apply all bt" ".*sleep.*start_thread.*" \ "$threadtype: attach2 to stopped bt" ... but lack of symbols makes that impossible. Fix this by allowing " in ?? () from " as well. Tested on aarch64-linux. PR testsuite/31451 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31451 Diff: --- gdb/testsuite/gdb.threads/attach-stopped.exp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp index 4be0e220b17..78e194c992f 100644 --- a/gdb/testsuite/gdb.threads/attach-stopped.exp +++ b/gdb/testsuite/gdb.threads/attach-stopped.exp @@ -54,10 +54,12 @@ proc corefunc { threadtype } { } # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there. + set test "$threadtype: attach2 to stopped bt" if {[string equal $threadtype threaded]} { - gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach2 to stopped bt" + gdb_test "thread apply all bt" \ + ".*sleep.*(start_thread| in \\?\\? \\(\\) from ).*" $test } else { - gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach2 to stopped bt" + gdb_test "bt" ".*sleep.*main.*" $test } gdb_exit
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6ccf769a1790b90a85e0b4912a42117eb7c1e108 commit 6ccf769a1790b90a85e0b4912a42117eb7c1e108 Author: Tom de Vries <tdevries@suse.de> Date: Thu Mar 28 06:51:59 2024 +0100 [gdb/testsuite] Add missing include in gdb.base/rtld-step.exp On fedora rawhide, with test-case gdb.base/rtld-step.exp I get: ... static-pie-static-libc.c: In function '_start':^M static-pie-static-libc.c:1:22: error: \ implicit declaration of function '_exit' [-Wimplicit-function-declaration]^M 1 | void _start (void) { _exit (0); }^M | ^~~~~^M compiler exited with status 1 ... UNTESTED: gdb.base/rtld-step.exp: failed to compile \ (-static-pie not supported or static libc missing) ... Fix this by adding the missing include. Tested on aarch64-linux. Approved-by: Kevin Buettner <kevinb@redhat.com> Diff: --- gdb/testsuite/gdb.base/rtld-step.exp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/rtld-step.exp b/gdb/testsuite/gdb.base/rtld-step.exp index 53725833aa1..198542886cc 100644 --- a/gdb/testsuite/gdb.base/rtld-step.exp +++ b/gdb/testsuite/gdb.base/rtld-step.exp @@ -86,7 +86,10 @@ set rtld_flags [list debug additional_flags=[list -static-pie -fPIE \ -nostdlib -static -lc]] if { ![gdb_can_simple_compile static-pie-static-libc \ - "void _start (void) { _exit (0); }" \ + { + #include <unistd.h> + void _start (void) { _exit (0); } + } \ executable $rtld_flags] } { set reason "-static-pie not supported or static libc missing" untested "failed to compile ($reason)"
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=13ed3225004896142dcb0fbe24411b66f17dfc8e commit 13ed3225004896142dcb0fbe24411b66f17dfc8e Author: Tom Tromey <tromey@adacore.com> Date: Wed Mar 27 07:21:56 2024 -0600 Fix clang build Simon pointed out that commit 818ef5f4 ("Capture warnings when writing to the index cache") broke the build with clang. This patch fixes the breakage. Diff: --- gdb/utils.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/utils.h b/gdb/utils.h index d7db1d84e2f..875a2583179 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -444,10 +444,18 @@ struct deferred_warnings hook; see scoped_restore_warning_hook. Note that no locking is done, so users have to be careful to only install this into a single thread at a time. */ - void operator() (const char *format, va_list args) ATTRIBUTE_PRINTF (2, 0) + void operator() (const char *format, va_list args) { string_file msg (m_can_style); + /* Clang warns if we add ATTRIBUTE_PRINTF to this method (because + the function-view wrapper doesn't also have the attribute), but + then warns again if we remove it, because this vprintf call + does not use a literal format string. So, suppress the + warnings here. */ + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL msg.vprintf (format, args); + DIAGNOSTIC_POP m_warnings.emplace_back (std::move (msg)); }
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18d2988e5da8919514c76b83e2c0b56e439018bd commit 18d2988e5da8919514c76b83e2c0b56e439018bd Author: Simon Marchi <simon.marchi@efficios.com> Date: Tue Mar 26 15:06:46 2024 -0400 gdb, gdbserver, gdbsupport: remove includes of early headers Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net> Diff: --- gdb/aarch32-linux-nat.c | 1 - gdb/aarch32-tdep.c | 2 -- gdb/aarch64-fbsd-nat.c | 1 - gdb/aarch64-fbsd-tdep.c | 1 - gdb/aarch64-linux-nat.c | 1 - gdb/aarch64-linux-tdep.c | 1 - gdb/aarch64-nat.c | 1 - gdb/aarch64-newlib-tdep.c | 1 - gdb/aarch64-ravenscar-thread.c | 1 - gdb/aarch64-tdep.c | 1 - gdb/ada-exp.y | 1 - gdb/ada-lang.c | 1 - gdb/ada-tasks.c | 1 - gdb/ada-typeprint.c | 1 - gdb/ada-valprint.c | 1 - gdb/ada-varobj.c | 1 - gdb/addrmap.c | 1 - gdb/agent.c | 1 - gdb/aix-thread.c | 1 - gdb/alloc.c | 7 +------ gdb/alpha-bsd-nat.c | 1 - gdb/alpha-bsd-tdep.c | 1 - gdb/alpha-linux-nat.c | 1 - gdb/alpha-linux-tdep.c | 1 - gdb/alpha-mdebug-tdep.c | 1 - gdb/alpha-netbsd-tdep.c | 1 - gdb/alpha-obsd-tdep.c | 1 - gdb/alpha-tdep.c | 1 - gdb/amd-dbgapi-target.c | 1 - gdb/amd64-bsd-nat.c | 1 - gdb/amd64-darwin-tdep.c | 1 - gdb/amd64-dicos-tdep.c | 1 - gdb/amd64-fbsd-nat.c | 1 - gdb/amd64-fbsd-tdep.c | 1 - gdb/amd64-linux-nat.c | 1 - gdb/amd64-linux-tdep.c | 1 - gdb/amd64-nat.c | 1 - gdb/amd64-netbsd-nat.c | 1 - gdb/amd64-netbsd-tdep.c | 1 - gdb/amd64-obsd-nat.c | 1 - gdb/amd64-obsd-tdep.c | 1 - gdb/amd64-ravenscar-thread.c | 1 - gdb/amd64-sol2-tdep.c | 1 - gdb/amd64-tdep.c | 1 - gdb/amd64-windows-nat.c | 1 - gdb/amd64-windows-tdep.c | 1 - gdb/amdgpu-tdep.c | 1 - gdb/annotate.c | 1 - gdb/arc-linux-nat.c | 1 - gdb/arc-linux-tdep.c | 1 - gdb/arc-newlib-tdep.c | 1 - gdb/arc-tdep.c | 1 - gdb/arch-utils.c | 1 - gdb/arch/aarch32.c | 1 - gdb/arch/aarch64-insn.c | 1 - gdb/arch/aarch64-mte-linux.h | 1 - gdb/arch/aarch64-scalable-linux.h | 1 - gdb/arch/aarch64.c | 1 - gdb/arch/amd64.c | 1 - gdb/arch/arc.c | 1 - gdb/arch/arm-get-next-pcs.c | 1 - gdb/arch/arm-linux.c | 1 - gdb/arch/arm.c | 1 - gdb/arch/csky.c | 1 - gdb/arch/i386.c | 1 - gdb/arch/loongarch.c | 1 - gdb/arch/ppc-linux-common.c | 1 - gdb/arch/riscv.c | 1 - gdb/arch/tic6x.c | 1 - gdb/arm-bsd-tdep.c | 1 - gdb/arm-fbsd-nat.c | 1 - gdb/arm-fbsd-tdep.c | 1 - gdb/arm-linux-nat.c | 1 - gdb/arm-linux-tdep.c | 1 - gdb/arm-netbsd-nat.c | 1 - gdb/arm-netbsd-tdep.c | 1 - gdb/arm-none-tdep.c | 1 - gdb/arm-obsd-tdep.c | 1 - gdb/arm-pikeos-tdep.c | 1 - gdb/arm-tdep.c | 1 - gdb/arm-wince-tdep.c | 1 - gdb/async-event.c | 1 - gdb/auto-load.c | 1 - gdb/auxv.c | 1 - gdb/avr-tdep.c | 1 - gdb/ax-gdb.c | 1 - gdb/ax-general.c | 1 - gdb/bcache.c | 1 - gdb/bfd-target.c | 1 - gdb/bfin-linux-tdep.c | 1 - gdb/bfin-tdep.c | 1 - gdb/block.c | 1 - gdb/blockframe.c | 1 - gdb/bpf-tdep.c | 1 - gdb/break-catch-exec.c | 1 - gdb/break-catch-fork.c | 1 - gdb/break-catch-load.c | 1 - gdb/break-catch-sig.c | 1 - gdb/break-catch-syscall.c | 1 - gdb/break-catch-throw.c | 1 - gdb/breakpoint.c | 1 - gdb/bsd-kvm.c | 1 - gdb/bsd-uthread.c | 1 - gdb/bt-utils.c | 1 - gdb/btrace.c | 1 - gdb/build-id.c | 1 - gdb/buildsym-legacy.c | 1 - gdb/buildsym.c | 1 - gdb/c-exp.y | 1 - gdb/c-lang.c | 1 - gdb/c-typeprint.c | 1 - gdb/c-valprint.c | 1 - gdb/c-varobj.c | 1 - gdb/charset.c | 1 - gdb/cli-out.c | 1 - gdb/cli/cli-cmds.c | 1 - gdb/cli/cli-decode.c | 1 - gdb/cli/cli-dump.c | 1 - gdb/cli/cli-interp.c | 1 - gdb/cli/cli-logging.c | 1 - gdb/cli/cli-option.c | 1 - gdb/cli/cli-script.c | 1 - gdb/cli/cli-setshow.c | 1 - gdb/cli/cli-style.c | 1 - gdb/cli/cli-utils.c | 1 - gdb/coff-pe-read.c | 1 - gdb/coffread.c | 1 - gdb/compile/compile-c-support.c | 1 - gdb/compile/compile-c-symbols.c | 1 - gdb/compile/compile-c-types.c | 1 - gdb/compile/compile-cplus-symbols.c | 1 - gdb/compile/compile-cplus-types.c | 1 - gdb/compile/compile-loc2c.c | 1 - gdb/compile/compile-object-load.c | 1 - gdb/compile/compile-object-run.c | 1 - gdb/compile/compile.c | 1 - gdb/complaints.c | 1 - gdb/completer.c | 1 - gdb/copying.awk | 1 - gdb/copying.c | 1 - gdb/corefile.c | 1 - gdb/corelow.c | 1 - gdb/cp-abi.c | 1 - gdb/cp-name-parser.y | 1 - gdb/cp-namespace.c | 1 - gdb/cp-support.c | 1 - gdb/cp-valprint.c | 1 - gdb/cris-linux-tdep.c | 1 - gdb/cris-tdep.c | 1 - gdb/csky-linux-tdep.c | 1 - gdb/csky-tdep.c | 1 - gdb/ctfread.c | 1 - gdb/d-exp.y | 1 - gdb/d-lang.c | 1 - gdb/d-namespace.c | 1 - gdb/d-valprint.c | 1 - gdb/darwin-nat-info.c | 1 - gdb/darwin-nat.c | 1 - gdb/dbxread.c | 1 - gdb/dcache.c | 1 - gdb/debug.c | 1 - gdb/debuginfod-support.c | 1 - gdb/dicos-tdep.c | 1 - gdb/dictionary.c | 1 - gdb/disasm-selftests.c | 1 - gdb/disasm.c | 1 - gdb/displaced-stepping.c | 1 - gdb/dtrace-probe.c | 1 - gdb/dummy-frame.c | 1 - gdb/dwarf2/abbrev-cache.c | 1 - gdb/dwarf2/abbrev.c | 1 - gdb/dwarf2/ada-imported.c | 1 - gdb/dwarf2/aranges.c | 1 - gdb/dwarf2/attribute.c | 1 - gdb/dwarf2/comp-unit-head.c | 1 - gdb/dwarf2/cooked-index.c | 1 - gdb/dwarf2/cu.c | 1 - gdb/dwarf2/die.c | 1 - gdb/dwarf2/dwz.c | 1 - gdb/dwarf2/expr.c | 1 - gdb/dwarf2/frame-tailcall.c | 1 - gdb/dwarf2/frame.c | 1 - gdb/dwarf2/index-cache.c | 1 - gdb/dwarf2/index-common.c | 1 - gdb/dwarf2/index-write.c | 1 - gdb/dwarf2/leb.c | 1 - gdb/dwarf2/line-header.c | 1 - gdb/dwarf2/loc.c | 1 - gdb/dwarf2/macro.c | 1 - gdb/dwarf2/read-debug-names.c | 1 - gdb/dwarf2/read-gdb-index.c | 1 - gdb/dwarf2/read.c | 1 - gdb/dwarf2/section.c | 1 - gdb/dwarf2/stringify.c | 1 - gdb/elf-none-tdep.c | 1 - gdb/elfread.c | 1 - gdb/eval.c | 1 - gdb/event-top.c | 1 - gdb/exceptions.c | 1 - gdb/exec.c | 1 - gdb/expprint.c | 1 - gdb/extension.c | 1 - gdb/f-array-walker.h | 1 - gdb/f-exp.y | 1 - gdb/f-lang.c | 1 - gdb/f-typeprint.c | 1 - gdb/f-valprint.c | 1 - gdb/fbsd-nat.c | 1 - gdb/fbsd-tdep.c | 1 - gdb/features/microblaze-with-stack-protect.c | 1 - gdb/features/microblaze.c | 1 - gdb/features/mips-dsp-linux.c | 1 - gdb/features/mips-linux.c | 1 - gdb/features/mips64-dsp-linux.c | 1 - gdb/features/mips64-linux.c | 1 - gdb/features/nds32.c | 1 - gdb/features/nios2.c | 1 - gdb/features/or1k-linux.c | 1 - gdb/features/or1k.c | 1 - gdb/features/rs6000/powerpc-32.c | 1 - gdb/features/rs6000/powerpc-32l.c | 1 - gdb/features/rs6000/powerpc-403.c | 1 - gdb/features/rs6000/powerpc-403gc.c | 1 - gdb/features/rs6000/powerpc-405.c | 1 - gdb/features/rs6000/powerpc-505.c | 1 - gdb/features/rs6000/powerpc-601.c | 1 - gdb/features/rs6000/powerpc-602.c | 1 - gdb/features/rs6000/powerpc-603.c | 1 - gdb/features/rs6000/powerpc-604.c | 1 - gdb/features/rs6000/powerpc-64.c | 1 - gdb/features/rs6000/powerpc-64l.c | 1 - gdb/features/rs6000/powerpc-7400.c | 1 - gdb/features/rs6000/powerpc-750.c | 1 - gdb/features/rs6000/powerpc-860.c | 1 - gdb/features/rs6000/powerpc-altivec32.c | 1 - gdb/features/rs6000/powerpc-altivec32l.c | 1 - gdb/features/rs6000/powerpc-altivec64.c | 1 - gdb/features/rs6000/powerpc-altivec64l.c | 1 - gdb/features/rs6000/powerpc-e500.c | 1 - gdb/features/rs6000/powerpc-e500l.c | 1 - gdb/features/rs6000/powerpc-isa205-32l.c | 1 - gdb/features/rs6000/powerpc-isa205-64l.c | 1 - gdb/features/rs6000/powerpc-isa205-altivec32l.c | 1 - gdb/features/rs6000/powerpc-isa205-altivec64l.c | 1 - gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c | 1 - gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c | 1 - gdb/features/rs6000/powerpc-isa205-vsx32l.c | 1 - gdb/features/rs6000/powerpc-isa205-vsx64l.c | 1 - gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c | 1 - gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c | 1 - gdb/features/rs6000/powerpc-isa207-vsx32l.c | 1 - gdb/features/rs6000/powerpc-isa207-vsx64l.c | 1 - gdb/features/rs6000/powerpc-vsx32.c | 1 - gdb/features/rs6000/powerpc-vsx32l.c | 1 - gdb/features/rs6000/powerpc-vsx64.c | 1 - gdb/features/rs6000/powerpc-vsx64l.c | 1 - gdb/features/rs6000/rs6000.c | 1 - gdb/features/rx.c | 1 - gdb/features/s390-gs-linux64.c | 1 - gdb/features/s390-linux32.c | 1 - gdb/features/s390-linux32v1.c | 1 - gdb/features/s390-linux32v2.c | 1 - gdb/features/s390-linux64.c | 1 - gdb/features/s390-linux64v1.c | 1 - gdb/features/s390-linux64v2.c | 1 - gdb/features/s390-te-linux64.c | 1 - gdb/features/s390-tevx-linux64.c | 1 - gdb/features/s390-vx-linux64.c | 1 - gdb/features/s390x-gs-linux64.c | 1 - gdb/features/s390x-linux64.c | 1 - gdb/features/s390x-linux64v1.c | 1 - gdb/features/s390x-linux64v2.c | 1 - gdb/features/s390x-te-linux64.c | 1 - gdb/features/s390x-tevx-linux64.c | 1 - gdb/features/s390x-vx-linux64.c | 1 - gdb/features/sparc/sparc32-solaris.c | 1 - gdb/features/sparc/sparc64-solaris.c | 1 - gdb/features/z80.c | 1 - gdb/filename-seen-cache.c | 1 - gdb/filename-seen-cache.h | 1 - gdb/filesystem.c | 1 - gdb/findcmd.c | 1 - gdb/findvar.c | 1 - gdb/fork-child.c | 1 - gdb/frame-base.c | 1 - gdb/frame-unwind.c | 1 - gdb/frame.c | 1 - gdb/frv-linux-tdep.c | 1 - gdb/frv-tdep.c | 1 - gdb/ft32-tdep.c | 1 - gdb/gcore-elf.c | 1 - gdb/gcore.c | 1 - gdb/gdb-demangle.c | 1 - gdb/gdb.c | 1 - gdb/gdb_bfd.c | 1 - gdb/gdbarch-selftests.c | 1 - gdb/gdbtypes.c | 1 - gdb/glibc-tdep.c | 1 - gdb/gmp-utils.c | 1 - gdb/gnu-nat.c | 1 - gdb/gnu-nat.h | 2 -- gdb/gnu-v2-abi.c | 1 - gdb/gnu-v3-abi.c | 1 - gdb/go-exp.y | 1 - gdb/go-lang.c | 1 - gdb/go-typeprint.c | 1 - gdb/go-valprint.c | 1 - gdb/go32-nat.c | 1 - gdb/guile/guile.c | 1 - gdb/guile/scm-arch.c | 1 - gdb/guile/scm-auto-load.c | 1 - gdb/guile/scm-block.c | 1 - gdb/guile/scm-breakpoint.c | 1 - gdb/guile/scm-cmd.c | 1 - gdb/guile/scm-disasm.c | 1 - gdb/guile/scm-exception.c | 1 - gdb/guile/scm-frame.c | 1 - gdb/guile/scm-gsmob.c | 1 - gdb/guile/scm-iterator.c | 1 - gdb/guile/scm-lazy-string.c | 1 - gdb/guile/scm-math.c | 1 - gdb/guile/scm-objfile.c | 1 - gdb/guile/scm-param.c | 1 - gdb/guile/scm-ports.c | 1 - gdb/guile/scm-pretty-print.c | 1 - gdb/guile/scm-progspace.c | 1 - gdb/guile/scm-safe-call.c | 1 - gdb/guile/scm-string.c | 1 - gdb/guile/scm-symbol.c | 1 - gdb/guile/scm-symtab.c | 1 - gdb/guile/scm-type.c | 1 - gdb/guile/scm-utils.c | 1 - gdb/guile/scm-value.c | 1 - gdb/h8300-tdep.c | 1 - gdb/hppa-bsd-tdep.c | 1 - gdb/hppa-linux-nat.c | 1 - gdb/hppa-linux-tdep.c | 1 - gdb/hppa-netbsd-nat.c | 1 - gdb/hppa-netbsd-tdep.c | 1 - gdb/hppa-obsd-nat.c | 1 - gdb/hppa-obsd-tdep.c | 1 - gdb/hppa-tdep.c | 1 - gdb/i386-bsd-nat.c | 1 - gdb/i386-bsd-tdep.c | 1 - gdb/i386-darwin-nat.c | 1 - gdb/i386-darwin-tdep.c | 1 - gdb/i386-dicos-tdep.c | 1 - gdb/i386-fbsd-nat.c | 1 - gdb/i386-fbsd-tdep.c | 1 - gdb/i386-gnu-nat.c | 1 - gdb/i386-gnu-tdep.c | 1 - gdb/i386-go32-tdep.c | 1 - gdb/i386-linux-nat.c | 1 - gdb/i386-linux-tdep.c | 1 - gdb/i386-netbsd-nat.c | 1 - gdb/i386-netbsd-tdep.c | 1 - gdb/i386-nto-tdep.c | 1 - gdb/i386-obsd-nat.c | 1 - gdb/i386-obsd-tdep.c | 1 - gdb/i386-sol2-nat.c | 1 - gdb/i386-sol2-tdep.c | 1 - gdb/i386-tdep.c | 1 - gdb/i386-windows-nat.c | 1 - gdb/i386-windows-tdep.c | 1 - gdb/i387-tdep.c | 1 - gdb/ia64-libunwind-tdep.c | 1 - gdb/ia64-linux-nat.c | 1 - gdb/ia64-linux-tdep.c | 1 - gdb/ia64-tdep.c | 1 - gdb/ia64-vms-tdep.c | 1 - gdb/inf-child.c | 1 - gdb/inf-loop.c | 1 - gdb/inf-ptrace.c | 1 - gdb/infcall.c | 1 - gdb/infcmd.c | 1 - gdb/inferior.c | 1 - gdb/inflow.c | 1 - gdb/infrun.c | 1 - gdb/inline-frame.c | 1 - gdb/interps.c | 1 - gdb/iq2000-tdep.c | 1 - gdb/jit.c | 1 - gdb/language.c | 1 - gdb/linespec.c | 1 - gdb/linux-fork.c | 1 - gdb/linux-nat-trad.c | 1 - gdb/linux-nat.c | 1 - gdb/linux-record.c | 1 - gdb/linux-tdep.c | 1 - gdb/linux-thread-db.c | 1 - gdb/lm32-tdep.c | 1 - gdb/location.c | 1 - gdb/loongarch-linux-nat.c | 1 - gdb/loongarch-linux-tdep.c | 1 - gdb/loongarch-tdep.c | 1 - gdb/m2-exp.y | 1 - gdb/m2-lang.c | 1 - gdb/m2-typeprint.c | 1 - gdb/m2-valprint.c | 1 - gdb/m32c-tdep.c | 1 - gdb/m32r-linux-nat.c | 1 - gdb/m32r-linux-tdep.c | 1 - gdb/m32r-tdep.c | 1 - gdb/m68hc11-tdep.c | 1 - gdb/m68k-bsd-nat.c | 1 - gdb/m68k-bsd-tdep.c | 1 - gdb/m68k-linux-nat.c | 1 - gdb/m68k-linux-tdep.c | 1 - gdb/m68k-tdep.c | 1 - gdb/machoread.c | 1 - gdb/macrocmd.c | 1 - gdb/macroexp.c | 1 - gdb/macroscope.c | 1 - gdb/macrotab.c | 1 - gdb/main.c | 1 - gdb/maint-test-options.c | 1 - gdb/maint-test-settings.c | 1 - gdb/maint.c | 1 - gdb/make-init-c | 1 - gdb/mdebugread.c | 1 - gdb/mem-break.c | 1 - gdb/memattr.c | 1 - gdb/memory-map.c | 1 - gdb/memrange.c | 1 - gdb/memtag.c | 1 - gdb/mep-tdep.c | 1 - gdb/mi/mi-cmd-break.c | 1 - gdb/mi/mi-cmd-catch.c | 1 - gdb/mi/mi-cmd-disas.c | 1 - gdb/mi/mi-cmd-env.c | 1 - gdb/mi/mi-cmd-file.c | 1 - gdb/mi/mi-cmd-info.c | 1 - gdb/mi/mi-cmd-stack.c | 1 - gdb/mi/mi-cmd-target.c | 1 - gdb/mi/mi-cmd-var.c | 1 - gdb/mi/mi-cmds.c | 1 - gdb/mi/mi-common.c | 1 - gdb/mi/mi-console.c | 1 - gdb/mi/mi-getopt.c | 1 - gdb/mi/mi-interp.c | 1 - gdb/mi/mi-main.c | 1 - gdb/mi/mi-out.c | 1 - gdb/mi/mi-parse.c | 1 - gdb/mi/mi-symbol-cmds.c | 1 - gdb/microblaze-linux-tdep.c | 1 - gdb/microblaze-tdep.c | 1 - gdb/mingw-hdep.c | 1 - gdb/minidebug.c | 1 - gdb/minsyms.c | 1 - gdb/mips-fbsd-nat.c | 1 - gdb/mips-fbsd-tdep.c | 1 - gdb/mips-linux-nat.c | 1 - gdb/mips-linux-tdep.c | 1 - gdb/mips-netbsd-nat.c | 1 - gdb/mips-netbsd-tdep.c | 1 - gdb/mips-sde-tdep.c | 1 - gdb/mips-tdep.c | 1 - gdb/mips64-obsd-nat.c | 1 - gdb/mips64-obsd-tdep.c | 1 - gdb/mipsread.c | 1 - gdb/mn10300-linux-tdep.c | 1 - gdb/mn10300-tdep.c | 1 - gdb/moxie-tdep.c | 1 - gdb/msp430-tdep.c | 1 - gdb/namespace.c | 1 - gdb/nat/aarch64-hw-point.c | 1 - gdb/nat/aarch64-linux-hw-point.c | 1 - gdb/nat/aarch64-linux.c | 1 - gdb/nat/aarch64-mte-linux-ptrace.c | 1 - gdb/nat/aarch64-scalable-linux-ptrace.c | 1 - gdb/nat/amd64-linux-siginfo.c | 1 - gdb/nat/fork-inferior.c | 1 - gdb/nat/linux-btrace.c | 1 - gdb/nat/linux-namespaces.c | 1 - gdb/nat/linux-osdata.c | 1 - gdb/nat/linux-personality.c | 1 - gdb/nat/linux-procfs.c | 1 - gdb/nat/linux-ptrace.c | 1 - gdb/nat/linux-waitpid.c | 1 - gdb/nat/mips-linux-watch.c | 1 - gdb/nat/netbsd-nat.c | 1 - gdb/nat/ppc-linux.c | 1 - gdb/nat/riscv-linux-tdesc.c | 1 - gdb/nat/windows-nat.c | 1 - gdb/nat/x86-dregs.c | 1 - gdb/nat/x86-linux-dregs.c | 1 - gdb/nat/x86-linux.c | 1 - gdb/nat/x86-xstate.c | 1 - gdb/nds32-tdep.c | 1 - gdb/netbsd-nat.c | 1 - gdb/netbsd-tdep.c | 1 - gdb/nios2-linux-tdep.c | 1 - gdb/nios2-tdep.c | 1 - gdb/nto-procfs.c | 1 - gdb/nto-tdep.c | 1 - gdb/objc-lang.c | 1 - gdb/objfiles.c | 1 - gdb/obsd-nat.c | 1 - gdb/obsd-tdep.c | 1 - gdb/observable.c | 1 - gdb/opencl-lang.c | 1 - gdb/or1k-linux-nat.c | 1 - gdb/or1k-linux-tdep.c | 1 - gdb/or1k-tdep.c | 1 - gdb/osabi.c | 1 - gdb/osdata.c | 1 - gdb/p-exp.y | 1 - gdb/p-lang.c | 1 - gdb/p-typeprint.c | 1 - gdb/p-valprint.c | 1 - gdb/parse.c | 1 - gdb/posix-hdep.c | 1 - gdb/ppc-fbsd-nat.c | 1 - gdb/ppc-fbsd-tdep.c | 1 - gdb/ppc-linux-nat.c | 1 - gdb/ppc-linux-tdep.c | 1 - gdb/ppc-netbsd-nat.c | 1 - gdb/ppc-netbsd-tdep.c | 1 - gdb/ppc-obsd-nat.c | 1 - gdb/ppc-obsd-tdep.c | 1 - gdb/ppc-ravenscar-thread.c | 1 - gdb/ppc-sysv-tdep.c | 1 - gdb/ppc64-tdep.c | 1 - gdb/printcmd.c | 1 - gdb/probe.c | 1 - gdb/proc-api.c | 1 - gdb/proc-events.c | 1 - gdb/proc-flags.c | 1 - gdb/proc-service.c | 1 - gdb/proc-why.c | 1 - gdb/process-stratum-target.c | 1 - gdb/procfs.c | 1 - gdb/producer.c | 1 - gdb/progspace-and-thread.c | 1 - gdb/progspace.c | 1 - gdb/prologue-value.c | 1 - gdb/psymtab.c | 1 - gdb/python/py-arch.c | 1 - gdb/python/py-auto-load.c | 1 - gdb/python/py-block.c | 1 - gdb/python/py-bpevent.c | 1 - gdb/python/py-breakpoint.c | 1 - gdb/python/py-cmd.c | 1 - gdb/python/py-connection.c | 1 - gdb/python/py-continueevent.c | 1 - gdb/python/py-dap.c | 1 - gdb/python/py-disasm.c | 1 - gdb/python/py-event.c | 1 - gdb/python/py-evtregistry.c | 1 - gdb/python/py-evts.c | 1 - gdb/python/py-exitedevent.c | 1 - gdb/python/py-finishbreakpoint.c | 1 - gdb/python/py-frame.c | 1 - gdb/python/py-framefilter.c | 1 - gdb/python/py-function.c | 1 - gdb/python/py-gdb-readline.c | 1 - gdb/python/py-inferior.c | 1 - gdb/python/py-infevents.c | 1 - gdb/python/py-infthread.c | 1 - gdb/python/py-instruction.c | 1 - gdb/python/py-lazy-string.c | 1 - gdb/python/py-linetable.c | 1 - gdb/python/py-membuf.c | 1 - gdb/python/py-mi.c | 1 - gdb/python/py-micmd.c | 1 - gdb/python/py-newobjfileevent.c | 1 - gdb/python/py-objfile.c | 1 - gdb/python/py-param.c | 1 - gdb/python/py-prettyprint.c | 1 - gdb/python/py-progspace.c | 1 - gdb/python/py-record-btrace.c | 1 - gdb/python/py-record-full.c | 1 - gdb/python/py-record.c | 1 - gdb/python/py-registers.c | 1 - gdb/python/py-signalevent.c | 1 - gdb/python/py-stopevent.c | 1 - gdb/python/py-symbol.c | 1 - gdb/python/py-symtab.c | 1 - gdb/python/py-threadevent.c | 1 - gdb/python/py-tui.c | 1 - gdb/python/py-type.c | 1 - gdb/python/py-unwind.c | 1 - gdb/python/py-utils.c | 1 - gdb/python/py-value.c | 1 - gdb/python/py-varobj.c | 1 - gdb/python/py-xmethods.c | 1 - gdb/python/python.c | 1 - gdb/ravenscar-thread.c | 1 - gdb/record-btrace.c | 1 - gdb/record-full.c | 1 - gdb/record.c | 1 - gdb/regcache-dump.c | 1 - gdb/regcache.c | 1 - gdb/regformats/regdat.sh | 1 - gdb/reggroups.c | 1 - gdb/remote-fileio.c | 1 - gdb/remote-notif.c | 1 - gdb/remote-sim.c | 1 - gdb/remote.c | 1 - gdb/reverse.c | 1 - gdb/riscv-fbsd-nat.c | 1 - gdb/riscv-fbsd-tdep.c | 1 - gdb/riscv-linux-nat.c | 1 - gdb/riscv-linux-tdep.c | 1 - gdb/riscv-none-tdep.c | 1 - gdb/riscv-ravenscar-thread.c | 1 - gdb/riscv-tdep.c | 2 -- gdb/rl78-tdep.c | 1 - gdb/rs6000-aix-nat.c | 1 - gdb/rs6000-aix-tdep.c | 1 - gdb/rs6000-lynx178-tdep.c | 1 - gdb/rs6000-tdep.c | 1 - gdb/run-on-main-thread.c | 1 - gdb/rust-lang.c | 1 - gdb/rust-parse.c | 1 - gdb/rx-tdep.c | 1 - gdb/s12z-tdep.c | 1 - gdb/s390-linux-nat.c | 1 - gdb/s390-linux-tdep.c | 1 - gdb/s390-tdep.c | 1 - gdb/selftest-arch.c | 1 - gdb/sentinel-frame.c | 1 - gdb/ser-base.c | 1 - gdb/ser-event.c | 1 - gdb/ser-go32.c | 1 - gdb/ser-mingw.c | 1 - gdb/ser-pipe.c | 1 - gdb/ser-tcp.c | 1 - gdb/ser-uds.c | 1 - gdb/ser-unix.c | 1 - gdb/serial.c | 1 - gdb/sh-linux-tdep.c | 1 - gdb/sh-netbsd-nat.c | 1 - gdb/sh-netbsd-tdep.c | 1 - gdb/sh-tdep.c | 1 - gdb/skip.c | 1 - gdb/sol-thread.c | 1 - gdb/sol2-tdep.c | 1 - gdb/solib-aix.c | 1 - gdb/solib-darwin.c | 1 - gdb/solib-dsbt.c | 1 - gdb/solib-frv.c | 1 - gdb/solib-rocm.c | 1 - gdb/solib-svr4.c | 1 - gdb/solib-target.c | 1 - gdb/solib.c | 1 - gdb/source-cache.c | 1 - gdb/source.c | 1 - gdb/sparc-linux-nat.c | 1 - gdb/sparc-linux-tdep.c | 1 - gdb/sparc-nat.c | 1 - gdb/sparc-netbsd-nat.c | 1 - gdb/sparc-netbsd-tdep.c | 1 - gdb/sparc-obsd-tdep.c | 1 - gdb/sparc-ravenscar-thread.c | 1 - gdb/sparc-sol2-nat.c | 1 - gdb/sparc-sol2-tdep.c | 1 - gdb/sparc-tdep.c | 1 - gdb/sparc64-fbsd-nat.c | 1 - gdb/sparc64-fbsd-tdep.c | 1 - gdb/sparc64-linux-nat.c | 1 - gdb/sparc64-linux-tdep.c | 1 - gdb/sparc64-nat.c | 1 - gdb/sparc64-netbsd-nat.c | 1 - gdb/sparc64-netbsd-tdep.c | 1 - gdb/sparc64-obsd-nat.c | 1 - gdb/sparc64-obsd-tdep.c | 1 - gdb/sparc64-sol2-tdep.c | 1 - gdb/sparc64-tdep.c | 1 - gdb/split-name.c | 1 - gdb/stabsread.c | 1 - gdb/stack.c | 1 - gdb/stap-probe.c | 1 - gdb/std-regs.c | 1 - gdb/stub-termcap.c | 1 - gdb/symfile-debug.c | 1 - gdb/symfile-mem.c | 1 - gdb/symfile.c | 1 - gdb/symmisc.c | 1 - gdb/symtab.c | 1 - gdb/target-connection.c | 1 - gdb/target-dcache.c | 1 - gdb/target-descriptions.c | 2 -- gdb/target-float.c | 1 - gdb/target-memory.c | 1 - gdb/target.c | 1 - gdb/target/target.c | 1 - gdb/target/waitstatus.c | 1 - gdb/test-target.c | 1 - gdb/thread-iter.c | 1 - gdb/thread.c | 1 - gdb/tic6x-linux-tdep.c | 1 - gdb/tic6x-tdep.c | 1 - gdb/tid-parse.c | 1 - gdb/tilegx-linux-nat.c | 1 - gdb/tilegx-linux-tdep.c | 1 - gdb/tilegx-tdep.c | 1 - gdb/top.c | 1 - gdb/tracectf.c | 1 - gdb/tracefile-tfile.c | 1 - gdb/tracefile.c | 1 - gdb/tracepoint.c | 1 - gdb/trad-frame.c | 1 - gdb/tramp-frame.c | 1 - gdb/tui/tui-command.c | 1 - gdb/tui/tui-data.c | 1 - gdb/tui/tui-disasm.c | 1 - gdb/tui/tui-file.c | 1 - gdb/tui/tui-hooks.c | 1 - gdb/tui/tui-interp.c | 1 - gdb/tui/tui-io.c | 1 - gdb/tui/tui-layout.c | 1 - gdb/tui/tui-location.c | 1 - gdb/tui/tui-regs.c | 1 - gdb/tui/tui-source.c | 1 - gdb/tui/tui-status.c | 1 - gdb/tui/tui-win.c | 1 - gdb/tui/tui-wingeneral.c | 1 - gdb/tui/tui-winsource.c | 1 - gdb/tui/tui.c | 1 - gdb/type-stack.c | 1 - gdb/typeprint.c | 1 - gdb/ui-file.c | 1 - gdb/ui-out.c | 1 - gdb/ui-style.c | 1 - gdb/ui.c | 1 - gdb/unittests/array-view-selftests.c | 1 - gdb/unittests/child-path-selftests.c | 1 - gdb/unittests/cli-utils-selftests.c | 1 - gdb/unittests/command-def-selftests.c | 1 - gdb/unittests/common-utils-selftests.c | 1 - gdb/unittests/copy_bitwise-selftests.c | 1 - gdb/unittests/enum-flags-selftests.c | 1 - gdb/unittests/environ-selftests.c | 1 - gdb/unittests/filtered_iterator-selftests.c | 1 - gdb/unittests/format_pieces-selftests.c | 1 - gdb/unittests/frame_info_ptr-selftests.c | 1 - gdb/unittests/function-view-selftests.c | 1 - gdb/unittests/gdb_tilde_expand-selftests.c | 1 - gdb/unittests/gmp-utils-selftests.c | 1 - gdb/unittests/intrusive_list-selftests.c | 1 - gdb/unittests/lookup_name_info-selftests.c | 1 - gdb/unittests/main-thread-selftests.c | 1 - gdb/unittests/memory-map-selftests.c | 1 - gdb/unittests/memrange-selftests.c | 1 - gdb/unittests/mkdir-recursive-selftests.c | 1 - gdb/unittests/observable-selftests.c | 1 - gdb/unittests/offset-type-selftests.c | 1 - gdb/unittests/packed-selftests.c | 1 - gdb/unittests/parallel-for-selftests.c | 1 - gdb/unittests/parse-connection-spec-selftests.c | 1 - gdb/unittests/path-join-selftests.c | 1 - gdb/unittests/ptid-selftests.c | 1 - gdb/unittests/rsp-low-selftests.c | 1 - gdb/unittests/scoped_fd-selftests.c | 1 - gdb/unittests/scoped_ignore_signal-selftests.c | 1 - gdb/unittests/scoped_mmap-selftests.c | 1 - gdb/unittests/scoped_restore-selftests.c | 1 - gdb/unittests/search-memory-selftests.c | 1 - gdb/unittests/style-selftests.c | 1 - gdb/unittests/tracepoint-selftests.c | 1 - gdb/unittests/tui-selftests.c | 1 - gdb/unittests/ui-file-selftests.c | 1 - gdb/unittests/unique_xmalloc_ptr_char.c | 1 - gdb/unittests/unpack-selftests.c | 1 - gdb/unittests/utils-selftests.c | 1 - gdb/unittests/vec-utils-selftests.c | 1 - gdb/unittests/xml-utils-selftests.c | 1 - gdb/user-regs.c | 1 - gdb/utils.c | 1 - gdb/v850-tdep.c | 1 - gdb/valarith.c | 1 - gdb/valops.c | 1 - gdb/valprint.c | 1 - gdb/value.c | 1 - gdb/varobj.c | 1 - gdb/vax-bsd-nat.c | 1 - gdb/vax-netbsd-tdep.c | 1 - gdb/vax-tdep.c | 1 - gdb/windows-nat.c | 1 - gdb/windows-tdep.c | 1 - gdb/x86-bsd-nat.c | 1 - gdb/x86-fbsd-nat.c | 1 - gdb/x86-linux-nat.c | 1 - gdb/x86-nat.c | 1 - gdb/x86-tdep.c | 1 - gdb/xcoffread.c | 1 - gdb/xml-support.c | 1 - gdb/xml-syscall.c | 1 - gdb/xml-tdesc.c | 1 - gdb/xstormy16-tdep.c | 1 - gdb/xtensa-config.c | 1 - gdb/xtensa-linux-nat.c | 1 - gdb/xtensa-linux-tdep.c | 1 - gdb/xtensa-tdep.c | 1 - gdb/z80-tdep.c | 1 - gdbserver/ax.cc | 1 - gdbserver/debug.cc | 1 - gdbserver/dll.cc | 1 - gdbserver/fork-child.cc | 1 - gdbserver/gdbreplay.cc | 2 -- gdbserver/hostio.cc | 1 - gdbserver/i387-fp.cc | 1 - gdbserver/inferiors.cc | 1 - gdbserver/linux-aarch32-low.cc | 1 - gdbserver/linux-aarch32-tdesc.cc | 1 - gdbserver/linux-aarch64-ipa.cc | 1 - gdbserver/linux-aarch64-low.cc | 1 - gdbserver/linux-aarch64-tdesc.cc | 1 - gdbserver/linux-amd64-ipa.cc | 1 - gdbserver/linux-arc-low.cc | 1 - gdbserver/linux-arm-low.cc | 1 - gdbserver/linux-arm-tdesc.cc | 1 - gdbserver/linux-csky-low.cc | 1 - gdbserver/linux-i386-ipa.cc | 1 - gdbserver/linux-ia64-low.cc | 1 - gdbserver/linux-loongarch-low.cc | 1 - gdbserver/linux-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-mips-low.cc | 1 - gdbserver/linux-nios2-low.cc | 1 - gdbserver/linux-or1k-low.cc | 1 - gdbserver/linux-ppc-ipa.cc | 1 - gdbserver/linux-ppc-low.cc | 1 - gdbserver/linux-riscv-low.cc | 1 - gdbserver/linux-s390-ipa.cc | 1 - gdbserver/linux-s390-low.cc | 1 - gdbserver/linux-sh-low.cc | 1 - gdbserver/linux-sparc-low.cc | 1 - gdbserver/linux-tic6x-low.cc | 1 - gdbserver/linux-x86-low.cc | 1 - gdbserver/linux-x86-tdesc.cc | 1 - gdbserver/linux-xtensa-low.cc | 1 - gdbserver/mem-break.cc | 1 - gdbserver/netbsd-aarch64-low.cc | 1 - gdbserver/netbsd-amd64-low.cc | 1 - gdbserver/netbsd-i386-low.cc | 1 - gdbserver/netbsd-low.cc | 1 - gdbserver/notif.cc | 1 - gdbserver/proc-service.cc | 1 - gdbserver/regcache.cc | 1 - gdbserver/remote-utils.cc | 1 - gdbserver/server.cc | 1 - gdbserver/symbol.cc | 1 - gdbserver/target.cc | 1 - gdbserver/tdesc.cc | 1 - gdbserver/thread-db.cc | 1 - gdbserver/tracepoint.cc | 1 - gdbserver/utils.cc | 1 - gdbserver/win32-i386-low.cc | 1 - gdbserver/win32-low.cc | 1 - gdbserver/x86-low.cc | 1 - gdbsupport/agent.cc | 1 - gdbsupport/btrace-common.cc | 1 - gdbsupport/cleanups.cc | 1 - gdbsupport/common-debug.cc | 1 - gdbsupport/common-exceptions.cc | 1 - gdbsupport/common-inferior.cc | 1 - gdbsupport/common-regcache.cc | 1 - gdbsupport/common-utils.cc | 1 - gdbsupport/environ.cc | 1 - gdbsupport/errors.cc | 1 - gdbsupport/event-loop.cc | 1 - gdbsupport/event-pipe.cc | 1 - gdbsupport/fileio.cc | 1 - gdbsupport/filestuff.cc | 1 - gdbsupport/format.cc | 1 - gdbsupport/gdb-dlfcn.cc | 1 - gdbsupport/gdb-hashtab.cc | 1 - gdbsupport/gdb_obstack.cc | 1 - gdbsupport/gdb_regex.cc | 1 - gdbsupport/gdb_tilde_expand.cc | 1 - gdbsupport/gdb_vecs.cc | 1 - gdbsupport/gdb_wait.cc | 1 - gdbsupport/job-control.cc | 1 - gdbsupport/netstuff.cc | 1 - gdbsupport/new-op.cc | 1 - gdbsupport/pathstuff.cc | 1 - gdbsupport/print-utils.cc | 1 - gdbsupport/ptid.cc | 1 - gdbsupport/rsp-low.cc | 1 - gdbsupport/run-time-clock.cc | 1 - gdbsupport/safe-strerror.cc | 1 - gdbsupport/scoped_mmap.cc | 1 - gdbsupport/search.cc | 1 - gdbsupport/selftest.cc | 1 - gdbsupport/signals-state-save-restore.cc | 1 - gdbsupport/signals.cc | 1 - gdbsupport/task-group.cc | 1 - gdbsupport/tdesc.cc | 1 - gdbsupport/thread-pool.cc | 1 - gdbsupport/xml-utils.cc | 1 - 892 files changed, 1 insertion(+), 902 deletions(-) diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c index 8c1b3ab49cc..edff97b0ea9 100644 --- a/gdb/aarch32-linux-nat.c +++ b/gdb/aarch32-linux-nat.c @@ -15,7 +15,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 "defs.h" #include "regcache.h" #include "arm-tdep.h" diff --git a/gdb/aarch32-tdep.c b/gdb/aarch32-tdep.c index 0b7783c3e15..5a54a71ba4f 100644 --- a/gdb/aarch32-tdep.c +++ b/gdb/aarch32-tdep.c @@ -15,8 +15,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 "gdbsupport/common-defs.h" - #include "aarch32-tdep.h" #include "gdbsupport/common-regcache.h" diff --git a/gdb/aarch64-fbsd-nat.c b/gdb/aarch64-fbsd-nat.c index 89ed12bb8e5..7ca8463ece8 100644 --- a/gdb/aarch64-fbsd-nat.c +++ b/gdb/aarch64-fbsd-nat.c @@ -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 "defs.h" #include "arch-utils.h" #include "inferior.h" #include "regcache.h" diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c index 44ca6c90c81..e2ff57e8390 100644 --- a/gdb/aarch64-fbsd-tdep.c +++ b/gdb/aarch64-fbsd-tdep.c @@ -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 "defs.h" #include "gdbarch.h" #include "fbsd-tdep.h" diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index cf7d5f8c6b1..3face34ce79 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -18,7 +18,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 "defs.h" #include "inferior.h" #include "gdbcore.h" diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 4ebc173a0a0..0b9784f38e4 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -18,7 +18,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 "defs.h" #include "gdbarch.h" #include "glibc-tdep.h" diff --git a/gdb/aarch64-nat.c b/gdb/aarch64-nat.c index 802bab6d682..894fb73095b 100644 --- a/gdb/aarch64-nat.c +++ b/gdb/aarch64-nat.c @@ -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 "defs.h" #include "gdbarch.h" #include "inferior.h" #include "cli/cli-cmds.h" diff --git a/gdb/aarch64-newlib-tdep.c b/gdb/aarch64-newlib-tdep.c index c6370066aa3..4ac42a4ae26 100644 --- a/gdb/aarch64-newlib-tdep.c +++ b/gdb/aarch64-newlib-tdep.c @@ -18,7 +18,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 "defs.h" #include "gdbarch.h" #include "aarch64-tdep.h" diff --git a/gdb/aarch64-ravenscar-thread.c b/gdb/aarch64-ravenscar-thread.c index 155641d5b7c..5a877cde89d 100644 --- a/gdb/aarch64-ravenscar-thread.c +++ b/gdb/aarch64-ravenscar-thread.c @@ -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 "defs.h" #include "gdbcore.h" #include "regcache.h" #include "aarch64-tdep.h" diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index d1d5486f90d..545ec872fd8 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -18,7 +18,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 "defs.h" #include "frame.h" #include "language.h" diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 2b205714d7a..b116f31104e 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -35,7 +35,6 @@ %{ -#include "defs.h" #include <ctype.h> #include "expression.h" #include "value.h" diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 493ef3b6c7d..c9f12d72b70 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "defs.h" #include <ctype.h> #include "gdbsupport/gdb_regex.h" #include "frame.h" diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 8ae94dcdbab..864c5cfdf1c 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -15,7 +15,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 "defs.h" #include "observable.h" #include "gdbcmd.h" #include "target.h" diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index df047d82fd6..deead1055db 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -16,7 +16,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 "defs.h" #include "bfd.h" #include "gdbtypes.h" #include "value.h" diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index ac85440b139..6acfb9a48b6 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -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 "defs.h" #include <ctype.h> #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index 0a4c73f9c72..21412dbf220 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -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 "defs.h" #include "ada-lang.h" #include "varobj.h" #include "language.h" diff --git a/gdb/addrmap.c b/gdb/addrmap.c index 162ab84763b..0c60c0c2ceb 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -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 "defs.h" #include "gdbsupport/gdb_obstack.h" #include "addrmap.h" #include "gdbsupport/selftest.h" diff --git a/gdb/agent.c b/gdb/agent.c index a01b02cd4d3..00e75458a79 100644 --- a/gdb/agent.c +++ b/gdb/agent.c @@ -15,7 +15,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 "defs.h" #include "command.h" #include "gdbcmd.h" #include "target.h" diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index c70bd82bc24..0fe87b2b080 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -39,7 +39,6 @@ */ -#include "defs.h" #include "gdbthread.h" #include "target.h" #include "inferior.h" diff --git a/gdb/alloc.c b/gdb/alloc.c index 7c45c45ece3..d07c81f4955 100644 --- a/gdb/alloc.c +++ b/gdb/alloc.c @@ -27,14 +27,9 @@ file can't live there. So, it lives in gdb and is built separately by gdb and gdbserver. - Please be aware of this when modifying it. + Please be aware of this when modifying it. */ - This also explains why this file includes common-defs.h and not - defs.h or server.h -- we'd prefer to avoid depending on the - GDBSERVER define when possible, and for this file it seemed - simple to do so. */ -#include "gdbsupport/common-defs.h" #include "libiberty.h" #include "gdbsupport/errors.h" diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c index 790958e3330..11e1639173a 100644 --- a/gdb/alpha-bsd-nat.c +++ b/gdb/alpha-bsd-nat.c @@ -19,7 +19,6 @@ /* We define this to get types like register_t. */ #define _KERNTYPES -#include "defs.h" #include "inferior.h" #include "regcache.h" diff --git a/gdb/alpha-bsd-tdep.c b/gdb/alpha-bsd-tdep.c index 03becf22d9f..21e39cc937c 100644 --- a/gdb/alpha-bsd-tdep.c +++ b/gdb/alpha-bsd-tdep.c @@ -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 "defs.h" #include "regcache.h" #include "alpha-tdep.h" diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c index 618b0c8140b..83d6bc46858 100644 --- a/gdb/alpha-linux-nat.c +++ b/gdb/alpha-linux-nat.c @@ -16,7 +16,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 "defs.h" #include "target.h" #include "regcache.h" #include "linux-nat-trad.h" diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index 5f5e46d514e..9a40e0cda11 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -16,7 +16,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 "defs.h" #include "frame.h" #include "osabi.h" #include "solib-svr4.h" diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c index 7e9312d2aa7..abded2ac192 100644 --- a/gdb/alpha-mdebug-tdep.c +++ b/gdb/alpha-mdebug-tdep.c @@ -16,7 +16,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 "defs.h" #include "frame.h" #include "frame-unwind.h" #include "frame-base.h" diff --git a/gdb/alpha-netbsd-tdep.c b/gdb/alpha-netbsd-tdep.c index 569fe42a2a9..f3cd62b0b58 100644 --- a/gdb/alpha-netbsd-tdep.c +++ b/gdb/alpha-netbsd-tdep.c @@ -19,7 +19,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 "defs.h" #include "frame.h" #include "gdbcore.h" #include "osabi.h" diff --git a/gdb/alpha-obsd-tdep.c b/gdb/alpha-obsd-tdep.c index 610866835c8..8602e21c64a 100644 --- a/gdb/alpha-obsd-tdep.c +++ b/gdb/alpha-obsd-tdep.c @@ -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 "defs.h" #include "frame.h" #include "gdbcore.h" #include "osabi.h" diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index e5e0860fe24..c93bd69657f 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -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 "defs.h" #include "frame.h" #include "frame-unwind.h" #include "frame-base.h" diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c index 3fdc3cd838a..fcde6d27ffb 100644 --- a/gdb/amd-dbgapi-target.c +++ b/gdb/amd-dbgapi-target.c @@ -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 "defs.h" #include "amd-dbgapi-target.h" #include "amdgpu-tdep.h" diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c index ea9c0f47c6b..e0ba28fa9fb 100644 --- a/gdb/amd64-bsd-nat.c +++ b/gdb/amd64-bsd-nat.c @@ -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 "defs.h" #include "inferior.h" #include "regcache.h" #include "target.h" diff --git a/gdb/amd64-darwin-tdep.c b/gdb/amd64-darwin-tdep.c index 001f5379def..b0bead084fe 100644 --- a/gdb/amd64-darwin-tdep.c +++ b/gdb/amd64-darwin-tdep.c @@ -18,7 +18,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 "defs.h" #include "frame.h" #include "inferior.h" #include "gdbcore.h" diff --git a/gdb/amd64-dicos-tdep.c b/gdb/amd64-dicos-tdep.c index cc91b92f6dc..7624289dc25 100644 --- a/gdb/amd64-dicos-tdep.c +++ b/gdb/amd64-dicos-tdep.c @@ -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 "defs.h" #include "osabi.h" #include "amd64-tdep.h" #include "gdbsupport/x86-xstate.h" diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c index 6a742034cbc..6ce7c45b8b3 100644 --- a/gdb/amd64-fbsd-nat.c +++ b/gdb/amd64-fbsd-nat.c @@ -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 "defs.h" #include "inferior.h" #include "regcache.h" #include "target.h" diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c index a837bd197ff..de295099052 100644 --- a/gdb/amd64-fbsd-tdep.c +++ b/gdb/amd64-fbsd-tdep.c @@ -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 "defs.h" #include "osabi.h" #include "regset.h" #include "target.h" diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 0ee878f5401..aa9295d5723 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -18,7 +18,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 "defs.h" #include "inferior.h" #include "regcache.h" #include "elf/common.h" diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 1deb13b4e9a..9d560ac4fbf 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -18,7 +18,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 "defs.h" #include "arch-utils.h" #include "frame.h" #include "gdbcore.h" diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c index cb76658ab58..5c5c368c93d 100644 --- a/gdb/amd64-nat.c +++ b/gdb/amd64-nat.c @@ -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 "defs.h" #include "gdbarch.h" #include "regcache.h" diff --git a/gdb/amd64-netbsd-nat.c b/gdb/amd64-netbsd-nat.c index abd92abd77f..8bd3e122e7b 100644 --- a/gdb/amd64-netbsd-nat.c +++ b/gdb/amd64-netbsd-nat.c @@ -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 "defs.h" #include "target.h" #include "netbsd-nat.h" diff --git a/gdb/amd64-netbsd-tdep.c b/gdb/amd64-netbsd-tdep.c index 40500ee5f76..264042059b7 100644 --- a/gdb/amd64-netbsd-tdep.c +++ b/gdb/amd64-netbsd-tdep.c @@ -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 "defs.h" #include "arch-utils.h" #include "frame.h" #include "gdbcore.h" diff --git a/gdb/amd64-obsd-nat.c b/gdb/amd64-obsd-nat.c index 16c2c2d67a5..717f6bd7867 100644 --- a/gdb/amd64-obsd-nat.c +++ b/gdb/amd64-obsd-nat.c @@ -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 "defs.h" #include "gdbcore.h" #include "regcache.h" #include "target.h" diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c index 6b37e8954ee..f6f63bbf8ed 100644 --- a/gdb/amd64-obsd-tdep.c +++ b/gdb/amd64-obsd-tdep.c @@ -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 "defs.h" #include "frame.h" #include "frame-unwind.h" #include "gdbcore.h" diff --git a/gdb/amd64-ravenscar-thread.c b/gdb/amd64-ravenscar-thread.c index a97ed3c43cf..a0de0d73135 100644 --- a/gdb/amd64-ravenscar-thread.c +++ b/gdb/amd64-ravenscar-thread.c @@ -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 "defs.h" #include "gdbarch.h" #include "gdbcore.h" #include "regcache.h" diff --git a/gdb/amd64-sol2-tdep.c b/gdb/amd64-sol2-tdep.c index 6cc84017f74..070d7ed324b 100644 --- a/gdb/amd64-sol2-tdep.c +++ b/gdb/amd64-sol2-tdep.c @@ -19,7 +19,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 "defs.h" #include "frame.h" #include "gdbcore.h" #include "regcache.h" diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 60d6b7aa198..0bb7a24cbd0 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -19,7 +19,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 "defs.h" #include "language.h" #include "opcode/i386.h" #include "dis-asm.h" diff --git a/gdb/amd64-windows-nat.c b/gdb/amd64-windows-nat.c index b4625b2f0de..a282762d027 100644 --- a/gdb/amd64-windows-nat.c +++ b/gdb/amd64-windows-nat.c @@ -15,7 +15,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 "defs.h" #include "windows-nat.h" #include "x86-nat.h" #include "amd64-tdep.h" diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index af17886c080..a559d967b3c 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -15,7 +15,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 "defs.h" #include "osabi.h" #include "amd64-tdep.h" #include "gdbsupport/x86-xstate.h" diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c index ac137d9acc4..49996aeefc3 100644 --- a/gdb/amdgpu-tdep.c +++ b/gdb/amdgpu-tdep.c @@ -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 "defs.h" #include "amd-dbgapi-target.h" #include "amdgpu-tdep.h" diff --git a/gdb/annotate.c b/gdb/annotate.c index 468b9698f02..19195ac7097 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -16,7 +16,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 "defs.h" #include "annotate.h" #include "value.h" #include "target.h" diff --git a/gdb/arc-linux-nat.c b/gdb/arc-linux-nat.c index 9f8125f8a23..66f00008089 100644 --- a/gdb/arc-linux-nat.c +++ b/gdb/arc-linux-nat.c @@ -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 "defs.h" #include "frame.h" #include "inferior.h" #include "gdbcore.h" diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c index ca630ab6df0..54406ac5b90 100644 --- a/gdb/arc-linux-tdep.c +++ b/gdb/arc-linux-tdep.c @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* GDB header files. */ -#include "defs.h" #include "linux-tdep.h" #include "objfiles.h" #include "opcode/arc.h" diff --git a/gdb/arc-newlib-tdep.c b/gdb/arc-newlib-tdep.c index 2efea56a7c4..dbc096142b5 100644 --- a/gdb/arc-newlib-tdep.c +++ b/gdb/arc-newlib-tdep.c @@ -18,7 +18,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 "defs.h" #include "gdbarch.h" #include "arc-tdep.h" diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 63a1fd918d1..5684f324233 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* GDB header files. */ -#include "defs.h" #include "arch-utils.h" #include "elf-bfd.h" #include "disasm.h" diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index d404d1fc38a..456bfe971ff 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -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 "defs.h" #include "arch-utils.h" #include "gdbcmd.h" diff --git a/gdb/arch/aarch32.c b/gdb/arch/aarch32.c index 9f3e25088f4..ead368f5fb5 100644 --- a/gdb/arch/aarch32.c +++ b/gdb/arch/aarch32.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "aarch32.h" #include "../features/arm/arm-core.c" diff --git a/gdb/arch/aarch64-insn.c b/gdb/arch/aarch64-insn.c index 65a2841eef5..3caef45df70 100644 --- a/gdb/arch/aarch64-insn.c +++ b/gdb/arch/aarch64-insn.c @@ -16,7 +16,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 "gdbsupport/common-defs.h" #include "aarch64-insn.h" /* Toggle this file's internal debugging dump. */ diff --git a/gdb/arch/aarch64-mte-linux.h b/gdb/arch/aarch64-mte-linux.h index e0f4a9845b5..460b10e05c9 100644 --- a/gdb/arch/aarch64-mte-linux.h +++ b/gdb/arch/aarch64-mte-linux.h @@ -20,7 +20,6 @@ #ifndef ARCH_AARCH64_MTE_LINUX_H #define ARCH_AARCH64_MTE_LINUX_H -#include "gdbsupport/common-defs.h" /* Feature check for Memory Tagging Extension. */ #ifndef HWCAP2_MTE diff --git a/gdb/arch/aarch64-scalable-linux.h b/gdb/arch/aarch64-scalable-linux.h index 43577c43797..4d2ace8f153 100644 --- a/gdb/arch/aarch64-scalable-linux.h +++ b/gdb/arch/aarch64-scalable-linux.h @@ -21,7 +21,6 @@ #ifndef ARCH_AARCH64_SCALABLE_LINUX_H #define ARCH_AARCH64_SCALABLE_LINUX_H -#include "gdbsupport/common-defs.h" #include "gdbsupport/common-regcache.h" /* Feature check for Scalable Matrix Extension. */ diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c index dfa4f592ef7..5526aa1b580 100644 --- a/gdb/arch/aarch64.c +++ b/gdb/arch/aarch64.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "aarch64.h" #include <stdlib.h> diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c index b8ff4270079..cb9683c6931 100644 --- a/gdb/arch/amd64.c +++ b/gdb/arch/amd64.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "amd64.h" #include "gdbsupport/x86-xstate.h" #include <stdlib.h> diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c index aeb476df1a0..e807b60539f 100644 --- a/gdb/arch/arc.c +++ b/gdb/arch/arc.c @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "gdbsupport/common-defs.h" #include "arc.h" #include <stdlib.h> #include <unordered_map> diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c index 3657ac799c3..03115cf2138 100644 --- a/gdb/arch/arm-get-next-pcs.c +++ b/gdb/arch/arm-get-next-pcs.c @@ -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 "gdbsupport/common-defs.h" #include "gdbsupport/gdb_vecs.h" #include "gdbsupport/common-regcache.h" #include "arm.h" diff --git a/gdb/arch/arm-linux.c b/gdb/arch/arm-linux.c index 80c3cdd2e33..246bade658f 100644 --- a/gdb/arch/arm-linux.c +++ b/gdb/arch/arm-linux.c @@ -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 "gdbsupport/common-defs.h" #include "gdbsupport/common-regcache.h" #include "arch/arm.h" #include "arm-linux.h" diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c index 111803027d7..f1c292b44c9 100644 --- a/gdb/arch/arm.c +++ b/gdb/arch/arm.c @@ -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 "gdbsupport/common-defs.h" #include "gdbsupport/common-regcache.h" #include "arm.h" diff --git a/gdb/arch/csky.c b/gdb/arch/csky.c index 3ecba618764..32df2ade718 100644 --- a/gdb/arch/csky.c +++ b/gdb/arch/csky.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "csky.h" #include <stdlib.h> diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c index 0e46b6afd5f..f3165c5b7f0 100644 --- a/gdb/arch/i386.c +++ b/gdb/arch/i386.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "i386.h" #include "gdbsupport/tdesc.h" #include "gdbsupport/x86-xstate.h" diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c index 22f2d3936ca..04b6dfc8279 100644 --- a/gdb/arch/loongarch.c +++ b/gdb/arch/loongarch.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "loongarch.h" #include <stdlib.h> #include <unordered_map> diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c index e67327872b6..0a6915cdc09 100644 --- a/gdb/arch/ppc-linux-common.c +++ b/gdb/arch/ppc-linux-common.c @@ -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 "gdbsupport/common-defs.h" #include "arch/ppc-linux-common.h" #include "arch/ppc-linux-tdesc.h" diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c index cafcda50e54..9a84844a645 100644 --- a/gdb/arch/riscv.c +++ b/gdb/arch/riscv.c @@ -15,7 +15,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 "gdbsupport/common-defs.h" #include "riscv.h" #include <stdlib.h> #include <unordered_map> diff --git a/gdb/arch/tic6x.c b/gdb/arch/tic6x.c index dea409a3946..680a7942070 100644 --- a/gdb/arch/tic6x.c +++ b/gdb/arch/tic6x.c @@ -17,7 +17,6 @@ #include "gdbsupport/tdesc.h" #include "tic6x.h" -#include "gdbsupport/common-defs.h" #include "../features/tic6x-core.c" #include "../features/tic6x-gp.c" diff --git a/gdb/arm-bsd-tdep.c b/gdb/arm-bsd-tdep.c index 1a9ebcf202c..1ccabcb24f0 100644 --- a/gdb/arm-bsd-tdep.c +++ b/gdb/arm-bsd-tdep.c @@ -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 "defs.h" #include "osabi.h" #include "regcache.h" #include "regset.h" diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c index 80c901842ee..cbe9867f49d 100644 --- a/gdb/arm-fbsd-nat.c +++ b/gdb/arm-fbsd-nat.c @@ -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 "defs.h" #include "inferior.h" #include "target.h" diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c index 7b82de2166b..dfb75329cd8 100644 --- a/gdb/arm-fbsd-tdep.c +++ b/gdb/arm-fbsd-tdep.c @@ -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 "defs.h" #include "elf/common.h" #include "target-descriptions.h" diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 75f498cd5b3..50c24ecfcd2 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -16,7 +16,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 "defs.h" #include "inferior.h" #include "gdbcore.h" #include "regcache.h" diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index a8b27a7463a..8511abcd11d 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -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 "defs.h" #include "target.h" #include "value.h" #include "gdbtypes.h" diff --git a/gdb/arm-netbsd-nat.c b/gdb/arm-netbsd-nat.c index 4b9f9294641..37f6530a0fe 100644 --- a/gdb/arm-netbsd-nat.c +++ b/gdb/arm-netbsd-nat.c @@ -19,7 +19,6 @@ /* We define this to get types like register_t. */ #define _KERNTYPES -#include "defs.h" #include "gdbcore.h" #include "inferior.h" #include "regcache.h" diff --git a/gdb/arm-netbsd-tdep.c b/gdb/arm-netbsd-tdep.c index 829e1d3d4b8..f77fec7894a 100644 --- a/gdb/arm-netbsd-tdep.c +++ b/gdb/arm-netbsd-tdep.c @@ -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 "defs.h" #include "osabi.h" #include "arch/arm.h" diff --git a/gdb/arm-none-tdep.c b/gdb/arm-none-tdep.c index 72eff2c0b17..453e75234d4 100644 --- a/gdb/arm-none-tdep.c +++ b/gdb/arm-none-tdep.c @@ -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 "defs.h" #include "arm-tdep.h" #include "arch-utils.h" #include "regcache.h" diff --git a/gdb/arm-obsd-tdep.c b/gdb/arm-obsd-tdep.c index 0bdecec3b6f..56102b03815 100644 --- a/gdb/arm-obsd-tdep.c +++ b/gdb/arm-obsd-tdep.c @@ -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 "defs.h" #include "osabi.h" #include "trad-frame.h" #include "tramp-frame.h" diff --git a/gdb/arm-pikeos-tdep.c b/gdb/arm-pikeos-tdep.c index 5354af6ac7b..4760755a32a 100644 --- a/gdb/arm-pikeos-tdep.c +++ b/gdb/arm-pikeos-tdep.c @@ -15,7 +15,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 "defs.h" #include "objfiles.h" #include "arm-tdep.h" #include "osabi.h" diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 3a5fbe71b8b..b4062a8f922 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -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 "defs.h" #include <ctype.h> diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c index b722851e7e1..eab496c2c0b 100644 --- a/gdb/arm-wince-tdep.c +++ b/gdb/arm-wince-tdep.c @@ -18,7 +18,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 "defs.h" #include "osabi.h" #include "gdbcore.h" #include "target.h" diff --git a/gdb/async-event.c b/gdb/async-event.c index 7097c482fff..32b58652e58 100644 --- a/gdb/async-event.c +++ b/gdb/async-event.c @@ -16,7 +16,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 "defs.h" #include "async-event.h" #include "ser-event.h" diff --git a/gdb/auto-load.c b/gdb/auto-load.c index a097a3bd2f4..db6d6ae0f73 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -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 "defs.h" #include <ctype.h> #include "auto-load.h" #include "progspace.h" diff --git a/gdb/auxv.c b/gdb/auxv.c index 323ea831d54..1dc0587c007 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -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 "defs.h" #include "target.h" #include "gdbtypes.h" #include "command.h" diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 2d38f41cd7f..be95034abd5 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -22,7 +22,6 @@ /* Portions of this file were taken from the original gdb-4.18 patch developed by Denis Chertykov, denisc@overta.ru */ -#include "defs.h" #include "frame.h" #include "frame-unwind.h" #include "frame-base.h" diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index f6d2bc5772b..ae0992a298a 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -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 "defs.h" #include "symtab.h" #include "symfile.h" #include "gdbtypes.h" diff --git a/gdb/ax-general.c b/gdb/ax-general.c index 19c684c04e0..3d007456a52 100644 --- a/gdb/ax-general.c +++ b/gdb/ax-general.c @@ -21,7 +21,6 @@ dependencies, since we want to be able to use them in contexts outside of GDB (test suites, the stub, etc.) */ -#include "defs.h" #include "ax.h" #include "gdbarch.h" diff --git a/gdb/bcache.c b/gdb/bcache.c index 674ba796833..a9aab28ab84 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -19,7 +19,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 "defs.h" #include "gdbsupport/gdb_obstack.h" #include "bcache.h" diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c index 296e767d026..96e045e4e52 100644 --- a/gdb/bfd-target.c +++ b/gdb/bfd-target.c @@ -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 "defs.h" #include "target.h" #include "bfd-target.h" #include "exec.h" diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c index 31aa14765ae..f67e06478eb 100644 --- a/gdb/bfin-linux-tdep.c +++ b/gdb/bfin-linux-tdep.c @@ -19,7 +19,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 "defs.h" #include "arch-utils.h" #include "regcache.h" #include "tramp-frame.h" diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index 357866ef953..dbc339d9336 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -19,7 +19,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 "defs.h" #include "inferior.h" #include "gdbcore.h" #include "arch-utils.h" diff --git a/gdb/block.c b/gdb/block.c index 6d0d33fa85e..511689c9738 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -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 "defs.h" #include "block.h" #include "symtab.h" #include "symfile.h" diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 451818332de..b7c751300cb 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -18,7 +18,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 "defs.h" #include "symtab.h" #include "bfd.h" #include "objfiles.h" diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c index 1b3f3e72c5b..098a08aa7e7 100644 --- a/gdb/bpf-tdep.c +++ b/gdb/bpf-tdep.c @@ -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 "defs.h" #include "arch-utils.h" #include "dis-asm.h" #include "frame.h" diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c index 35b126ce904..bd412fccdb7 100644 --- a/gdb/break-catch-exec.c +++ b/gdb/break-catch-exec.c @@ -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 "defs.h" #include "annotate.h" #include "arch-utils.h" diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index 9417babdbd1..afbd84741f2 100644 --- a/gdb/break-catch-fork.c +++ b/gdb/break-catch-fork.c @@ -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 "defs.h" #include "annotate.h" #include "arch-utils.h" diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 9582a7ccaad..ce30b6fd427 100644 --- a/gdb/break-catch-load.c +++ b/gdb/break-catch-load.c @@ -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 "defs.h" #include "annotate.h" #include "arch-utils.h" diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index b1cee147ef1..f077fa29a0c 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -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 "defs.h" #include "arch-utils.h" #include <ctype.h> #include "breakpoint.h" diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index e5ddd835c92..a0e6e6788fe 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -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 "defs.h" #include <ctype.h> #include "breakpoint.h" #include "gdbcmd.h" diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index d053bd5fbe0..ce614ac8fe3 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -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 "defs.h" #include "arch-utils.h" #include <ctype.h> #include "breakpoint.h" diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 39c13107ba2..053d17df03e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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 "defs.h" #include "arch-utils.h" #include <ctype.h> #include "hashtab.h" diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index 76021df1ed5..a1020b05b19 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define _KMEMUSER -#include "defs.h" #include "cli/cli-cmds.h" #include "command.h" #include "filenames.h" diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 10e2ca5939e..576a9ec1cfb 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -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 "defs.h" #include "gdbcore.h" #include "gdbthread.h" #include "inferior.h" diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c index 6f68e269c51..cbca4a9b7b8 100644 --- a/gdb/bt-utils.c +++ b/gdb/bt-utils.c @@ -15,7 +15,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 "defs.h" #include "bt-utils.h" #include "command.h" #include "gdbcmd.h" diff --git a/gdb/btrace.c b/gdb/btrace.c index b5a047b245b..04ae3fd0b5e 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -19,7 +19,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 "defs.h" #include "btrace.h" #include "gdbthread.h" #include "inferior.h" diff --git a/gdb/build-id.c b/gdb/build-id.c index a40c56087ed..d1ebd8d37d7 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -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 "defs.h" #include "bfd.h" #include "gdb_bfd.h" #include "build-id.h" diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index 84bc96e843b..a2d786b4877 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -16,7 +16,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 "defs.h" #include "buildsym-legacy.h" #include "symtab.h" diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 506110989bf..1c762ad81bf 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -16,7 +16,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 "defs.h" #include "buildsym-legacy.h" #include "bfd.h" #include "gdbsupport/gdb_obstack.h" diff --git a/gdb/c-exp.y b/gdb/c-exp.y index fb85914805c..459a4cf1e8f 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -35,7 +35,6 @@ %{ -#include "defs.h" #include <ctype.h> #include "expression.h" #include "value.h" diff --git a/gdb/c-lang.c b/gdb/c-lang.c index cc33aad088e..922bf8c0de3 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -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 "defs.h" #include "symtab.h" #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index da269dae13b..3e299356308 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -16,7 +16,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 "defs.h" #include "gdbsupport/gdb_obstack.h" #include "bfd.h" #include "symtab.h" diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 8911a169604..28a6a6afea2 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -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 "defs.h" #include "symtab.h" #include "gdbtypes.h" #include "expression.h" diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index 4a747644909..4751f0a957a 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -15,7 +15,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 "defs.h" #include "value.h" #include "varobj.h" #include "gdbthread.h" diff --git a/gdb/charset.c b/gdb/charset.c index 2b759495f17..4c1debef614 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -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 "defs.h" #include "charset.h" #include "gdbcmd.h" #include "gdbsupport/gdb_obstack.h" diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 2a1e72125f9..1c303f09662 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -20,7 +20,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 "defs.h" #include "ui-out.h" #include "cli-out.h" #include "completer.h" diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index df11f956245..3afe2178199 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -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 "defs.h" #include "arch-utils.h" #include "readline/tilde.h" #include "completer.h" diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index bbabd40db07..d9a2ab40575 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -15,7 +15,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 "defs.h" #include "symtab.h" #include <ctype.h> #include "gdbsupport/gdb_regex.h" diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 765117bcbb5..9b44c6edcf2 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -19,7 +19,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 "defs.h" #include "cli/cli-decode.h" #include "cli/cli-cmds.h" #include "value.h" diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index a0bf32fd585..7cefc3902d8 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -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/>. */ [...] [diff truncated at 100000 bytes]
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ab7daea3ad0d9a553ac0e0d37898bdda45ad2c37 commit ab7daea3ad0d9a553ac0e0d37898bdda45ad2c37 Author: Simon Marchi <simon.marchi@efficios.com> Date: Tue Mar 26 15:06:45 2024 -0400 gdb, gdbserver, gdbsupport: include early header files with `-include` The motivation for this change is for analysis tools and IDEs to be better at analyzing header files on their own. There are some definitions and includes we want to occur at the very beginning of all translation units. The way we currently do that is by requiring all source files (.c and .cc files) to include one of defs.h (for gdb), server.h (for gdbserver) of common-defs.h (for gdbsupport and shared source files). These special header files define and include everything that needs to be included at the very beginning. Other header files are written in a way that assume that these special "prologue" header files have already been included. My problem with that is that my editor (clangd-based) provides a very bad experience when editing header files. Since clangd doesn't know that one of defs.h/server.h/common-defs.h was included already, a lot of things are flagged as errors. For instance, CORE_ADDR is not known. It's possible to edit the files in this state, but a lot of the power of the editor is unavailable. My proposal to help with this is to include those things we always want to be there using the compilers' `-include` option. Tom Tromey said that the current approach might exist because not all compilers used to have an option like this. But I believe that it's safe to assume they do today. With this change, clangd picks up the -include option from the compile command, and is able to analyze the header file correctly, as it sees all that stuff included or defined by that -include option. That works because when editing a header file, clangd tries to get the compilation flags from a source file that includes said header file. This change is a bit self-serving, because it addresses one of my frustrations when editing header files, but it might help others too. I'd be curious to know if others encounter the same kinds of problems when editing header files. Also, even if the change is not necessary by any means, I think the solution of using -include for stuff we always want to be there is more elegant than the current solution. Even with this -include flag, many header files currently don't include what they use, but rather depend on files included before them. This will still cause errors when editing them, but it should be easily fixable by adding the appropriate include. There's no rush to do so, as long as the code still compiles, it's just a convenience thing. The changes are: - Add the appropriate `-include` option to the various Makefiles. - There is one particularity for gdbserver's Makefile: we do not want to include server.h when building `gdbreplay.o`, as `gdbreplay.cc` doesn't include it. So we can't simply put the `-include` in `INTERNAL_CFLAGS`. Add the `-include server.h` option to the `COMPILE` and `IPAGENT_COMPILE` variables, and added a special rule to compile `gdbreplay.o` with `-include gdbsupport/common-defs.h`. - Remove the `-include` option from the `check-headers` rule in gdb/Makefile.in, since it is already included in `INTERNAL_CFLAGS`. Change-Id: If3e345d00a9fc42336322f1d8286687d22134340 Approved-By: Pedro Alves <pedro@palves.net> Diff: --- gdb/Makefile.in | 3 ++- gdbserver/Makefile.in | 14 ++++++++++++-- gdbsupport/Makefile.am | 1 + gdbsupport/Makefile.in | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a5139ea7580..a9f641c0659 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -607,6 +607,7 @@ GDB_CFLAGS = \ -I. \ -I$(srcdir) \ -I$(srcdir)/config \ + -include $(srcdir)/defs.h \ -DLOCALEDIR="\"$(localedir)\"" \ $(DEFS) @@ -2050,7 +2051,7 @@ check-headers: @echo Checking headers. for i in $(CHECK_HEADERS) ; do \ $(CXX) $(CXX_DIALECT) -x c++-header -c -fsyntax-only \ - $(INTERNAL_CFLAGS) $(CXXFLAGS) -include defs.h $(srcdir)/$$i ; \ + $(INTERNAL_CFLAGS) $(CXXFLAGS) $(srcdir)/$$i ; \ done .PHONY: check-headers diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index 45073abca49..5180e7336cb 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -69,9 +69,12 @@ COMPILE.pre = $(CXX) $(CXX_DIALECT) COMPILE.post = -c -o $@ POSTCOMPILE = @true +INCLUDE_SERVER_H = -include $(srcdir)/server.h + # CXXFLAGS is at the very end on purpose, so that user-supplied flags can # override internal flags. -COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) $(COMPILE.post) +COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(INCLUDE_SERVER_H) \ + $(CXXFLAGS) $(COMPILE.post) # It is also possible that you will need to add -I/usr/include/sys to the # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which @@ -509,7 +512,8 @@ IPAGENT_CFLAGS = \ # CXXFLAGS is at the very end on purpose, so that user-supplied flags can # override internal flags. -IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(CXXFLAGS) $(COMPILE.post) +IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) \ + $(INCLUDE_SERVER_H) $(CXXFLAGS) $(COMPILE.post) # Rules for special cases. @@ -589,6 +593,12 @@ target/%.o: ../gdb/target/%.c %-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh) $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@ +# Rule for gdbreplay.o. This is the same as COMPILE, but includes common-defs.h +# instead of server.h. +gdbreplay.o: gdbreplay.cc + $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) \ + -include gdbsupport/common-defs.h $(COMPILE.post) $< + # # Dependency tracking. # diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am index 7c360aa413e..2b0f987125c 100644 --- a/gdbsupport/Makefile.am +++ b/gdbsupport/Makefile.am @@ -35,6 +35,7 @@ AM_CPPFLAGS = \ $(INCINTL) \ -I../bfd \ -I$(srcdir)/../bfd \ + -include $(srcdir)/common-defs.h \ @LARGEFILE_CPPFLAGS@ override CXX += $(CXX_DIALECT) diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in index ab35b9148a5..ee709112aae 100644 --- a/gdbsupport/Makefile.in +++ b/gdbsupport/Makefile.in @@ -403,6 +403,7 @@ AM_CPPFLAGS = \ $(INCINTL) \ -I../bfd \ -I$(srcdir)/../bfd \ + -include $(srcdir)/common-defs.h \ @LARGEFILE_CPPFLAGS@ AM_CXXFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1d43b17eac183eee00f3168733c055bdf572731d commit 1d43b17eac183eee00f3168733c055bdf572731d Author: Simon Marchi <simon.marchi@efficios.com> Date: Tue Mar 26 15:06:44 2024 -0400 {gdb,gdbserver}/Makefile.in: remove unnecessary intermediary variables Remove `INTERNAL_CFLAGS_BASE` and `INTERNAL_WARN_CFLAGS`, inline their contents in `INTERNAL_CFLAGS`. Not functional changes expected. Change-Id: I6a09794835ca2cfd4a88a3e9f2e627c8f5bd569f Approved-By: Pedro Alves <pedro@palves.net> Diff: --- gdb/Makefile.in | 8 ++++---- gdbserver/Makefile.in | 12 +++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index bf57a9a3e62..a5139ea7580 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -631,7 +631,7 @@ INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@ \ @LARGEFILE_CPPFLAGS@ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS_BASE = \ +INTERNAL_CFLAGS = \ $(GLOBAL_CFLAGS) \ $(PROFILE_CFLAGS) \ $(GDB_CFLAGS) \ @@ -653,9 +653,9 @@ INTERNAL_CFLAGS_BASE = \ $(PTHREAD_CFLAGS) \ $(DEBUGINFOD_CFLAGS) \ $(GMPINC) \ - $(AMD_DBGAPI_CFLAGS) -INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS) -INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS) + $(AMD_DBGAPI_CFLAGS) \ + $(GDB_WARN_CFLAGS) \ + $(GDB_WERROR_CFLAGS) # LDFLAGS is specifically reserved for setting from the command line # when running make. diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index 3aa7aa760ea..45073abca49 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -163,19 +163,13 @@ WIN32APILIBS = @WIN32APILIBS@ MAYBE_LIBICONV = @MAYBE_LIBICONV@ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS_BASE = \ +INTERNAL_CFLAGS = \ ${GLOBAL_CFLAGS} \ ${PROFILE_CFLAGS} \ ${INCLUDE_CFLAGS} \ ${CPPFLAGS} \ - $(PTHREAD_CFLAGS) - -INTERNAL_WARN_CFLAGS = \ - ${INTERNAL_CFLAGS_BASE} \ - $(WARN_CFLAGS) - -INTERNAL_CFLAGS = \ - ${INTERNAL_WARN_CFLAGS} \ + $(PTHREAD_CFLAGS) \ + $(WARN_CFLAGS) \ $(WERROR_CFLAGS) \ -DGDBSERVER
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2f3dfa7f90806fe1bbaeb16d22d0740a5cde69a2 commit 2f3dfa7f90806fe1bbaeb16d22d0740a5cde69a2 Author: Simon Marchi <simon.marchi@efficios.com> Date: Tue Mar 26 15:06:43 2024 -0400 gdb, gdbserver, gdbsupport: reformat some Makefile variables, one entry per line Reformat some variables definitions. I think it makes them easier to read, and it also makes diffs clearer. Change-Id: I82f63ba0e6d0fe268eb1f1ad5ab22c3cd016ab02 Approved-By: Pedro Alves <pedro@palves.net> Diff: --- gdb/Makefile.in | 39 ++++++++++++++++++++++++++++++--------- gdbserver/Makefile.in | 50 ++++++++++++++++++++++++++++++++++++++------------ gdbsupport/Makefile.am | 15 +++++++++++---- gdbsupport/Makefile.in | 15 +++++++++++---- 4 files changed, 90 insertions(+), 29 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 331620375ae..bf57a9a3e62 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -260,7 +260,9 @@ LIBBACKTRACE_LIB=@LIBBACKTRACE_LIB@ SUPPORT = ../gdbsupport LIBSUPPORT = $(SUPPORT)/libgdbsupport.a -INCSUPPORT = -I$(srcdir)/.. -I.. +INCSUPPORT = \ + -I$(srcdir)/.. \ + -I.. # # CLI sub directory definitons @@ -601,8 +603,12 @@ CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR)) # your system doesn't have fcntl.h in /usr/include (which is where it # should be according to Posix). DEFS = @DEFS@ -GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config \ - -DLOCALEDIR="\"$(localedir)\"" $(DEFS) +GDB_CFLAGS = \ + -I. \ + -I$(srcdir) \ + -I$(srcdir)/config \ + -DLOCALEDIR="\"$(localedir)\"" \ + $(DEFS) # MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory. GLOBAL_CFLAGS = $(MH_CFLAGS) @@ -626,12 +632,27 @@ INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@ \ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. INTERNAL_CFLAGS_BASE = \ - $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \ - $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(BFD_CFLAGS) $(INCLUDE_CFLAGS) \ - $(READLINE_CFLAGS) $(ZLIBINC) $(ZSTD_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ - $(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(LIBBACKTRACE_INC) \ - $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) \ - $(TOP_CFLAGS) $(PTHREAD_CFLAGS) $(DEBUGINFOD_CFLAGS) $(GMPINC) \ + $(GLOBAL_CFLAGS) \ + $(PROFILE_CFLAGS) \ + $(GDB_CFLAGS) \ + $(OPCODES_CFLAGS) \ + $(BFD_CFLAGS) \ + $(INCLUDE_CFLAGS) \ + $(READLINE_CFLAGS) \ + $(ZLIBINC) \ + $(ZSTD_CFLAGS) \ + $(LIBDECNUMBER_CFLAGS) \ + $(INTL_CFLAGS) \ + $(INCGNU) \ + $(INCSUPPORT) \ + $(LIBBACKTRACE_INC) \ + $(ENABLE_CFLAGS) \ + $(INTERNAL_CPPFLAGS) \ + $(SRCHIGH_CFLAGS) \ + $(TOP_CFLAGS) \ + $(PTHREAD_CFLAGS) \ + $(DEBUGINFOD_CFLAGS) \ + $(GMPINC) \ $(AMD_DBGAPI_CFLAGS) INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS) INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS) diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index c7120895a26..3aa7aa760ea 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -114,7 +114,9 @@ INTL = @LIBINTL@ INTL_DEPS = @LIBINTL_DEP@ INTL_CFLAGS = @INCINTL@ -INCSUPPORT = -I$(srcdir)/.. -I.. +INCSUPPORT = \ + -I$(srcdir)/.. \ + -I.. # All the includes used for CFLAGS and for lint. # -I. for config files. @@ -125,9 +127,15 @@ INCSUPPORT = -I$(srcdir)/.. -I.. # in those directories should be included with the subdirectory. # e.g.: "target/wait.h". # -INCLUDE_CFLAGS = -I. -I${srcdir} \ - -I$(srcdir)/../gdb/regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \ - -I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT) \ +INCLUDE_CFLAGS = \ + -I. \ + -I${srcdir} \ + -I$(srcdir)/../gdb/regformats \ + -I$(srcdir)/.. \ + -I$(INCLUDE_DIR) \ + -I$(srcdir)/../gdb \ + $(INCGNU) \ + $(INCSUPPORT) \ $(INTL_CFLAGS) # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS @@ -155,10 +163,21 @@ WIN32APILIBS = @WIN32APILIBS@ MAYBE_LIBICONV = @MAYBE_LIBICONV@ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \ - ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS) -INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS) -INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER +INTERNAL_CFLAGS_BASE = \ + ${GLOBAL_CFLAGS} \ + ${PROFILE_CFLAGS} \ + ${INCLUDE_CFLAGS} \ + ${CPPFLAGS} \ + $(PTHREAD_CFLAGS) + +INTERNAL_WARN_CFLAGS = \ + ${INTERNAL_CFLAGS_BASE} \ + $(WARN_CFLAGS) + +INTERNAL_CFLAGS = \ + ${INTERNAL_WARN_CFLAGS} \ + $(WERROR_CFLAGS) \ + -DGDBSERVER # LDFLAGS is specifically reserved for setting from the command line # when running make. @@ -472,17 +491,24 @@ MAKEOVERRIDES = regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh -UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION +UST_CFLAGS = \ + $(ustinc) \ + -DCONFIG_UST_GDB_INTEGRATION # Undo gnulib replacements for the IPA shared library build. # The gnulib headers are still needed, but gnulib is not linked # into the IPA lib so replacement apis don't work. -UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r -Drpl_free=free \ - -Drpl_malloc=malloc -Drpl_realloc=realloc +UNDO_GNULIB_CFLAGS = \ + -Drpl_strerror_r=strerror_r \ + -Drpl_free=free \ + -Drpl_malloc=malloc \ + -Drpl_realloc=realloc # Note, we only build the IPA if -fvisibility=hidden is supported in # the first place. -IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \ +IPAGENT_CFLAGS = \ + $(INTERNAL_CFLAGS) \ + $(UST_CFLAGS) \ $(UNDO_GNULIB_CFLAGS) \ -fPIC -DIN_PROCESS_AGENT \ -fvisibility=hidden diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am index 88414b4c927..7c360aa413e 100644 --- a/gdbsupport/Makefile.am +++ b/gdbsupport/Makefile.am @@ -25,10 +25,17 @@ ACLOCAL_AMFLAGS = -I . -I ../config # ZW_GNU_GETTEXT_SISTER_DIR, but doesn't have any translations (currently). SUBDIRS = -AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \ - -I../gnulib/import -I$(srcdir)/../gnulib/import \ - -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd \ - @LARGEFILE_CPPFLAGS@ +AM_CPPFLAGS = \ + -I$(srcdir)/../include \ + -I$(srcdir)/../gdb \ + -I../gnulib/import \ + -I$(srcdir)/../gnulib/import \ + -I.. \ + -I$(srcdir)/.. \ + $(INCINTL) \ + -I../bfd \ + -I$(srcdir)/../bfd \ + @LARGEFILE_CPPFLAGS@ override CXX += $(CXX_DIALECT) diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in index 6f8dacc157f..ab35b9148a5 100644 --- a/gdbsupport/Makefile.in +++ b/gdbsupport/Makefile.in @@ -393,10 +393,17 @@ ACLOCAL_AMFLAGS = -I . -I ../config # from Automake, as gdbsupport uses AM_GNU_GETTEXT through # ZW_GNU_GETTEXT_SISTER_DIR, but doesn't have any translations (currently). SUBDIRS = -AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \ - -I../gnulib/import -I$(srcdir)/../gnulib/import \ - -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd \ - @LARGEFILE_CPPFLAGS@ +AM_CPPFLAGS = \ + -I$(srcdir)/../include \ + -I$(srcdir)/../gdb \ + -I../gnulib/import \ + -I$(srcdir)/../gnulib/import \ + -I.. \ + -I$(srcdir)/.. \ + $(INCINTL) \ + -I../bfd \ + -I$(srcdir)/../bfd \ + @LARGEFILE_CPPFLAGS@ AM_CXXFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) noinst_LIBRARIES = libgdbsupport.a
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f61e97cc86a4003e4c731e356985fdd291d7cb69 commit f61e97cc86a4003e4c731e356985fdd291d7cb69 Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Sat Mar 16 13:21:03 2024 -0400 gdb: make gdbarch_types.py non-executable I noticed that gdbarch_types.py is executable. It's not needed, since it's only imported from gdbarch.py. Change-Id: I481170714af66fc3fc3a48c55a7268e0789cf83e Diff: --- gdb/gdbarch_types.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gdb/gdbarch_types.py b/gdb/gdbarch_types.py old mode 100755 new mode 100644
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=56f703d39d6f4793ba73b2364a4ea052e8ad755d commit 56f703d39d6f4793ba73b2364a4ea052e8ad755d Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:53:31 2024 +0000 Revert "gdbserver: convert have_ptrace_getregset to a tribool" This reverts commit 5920765d7513aaae9241a1850d62d73e0477f81c. Diff: --- gdbserver/linux-arm-low.cc | 6 +++--- gdbserver/linux-low.cc | 2 +- gdbserver/linux-low.h | 2 +- gdbserver/linux-x86-low.cc | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index b4f0e071c92..396ec88081b 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -1007,9 +1007,9 @@ arm_target::low_arch_setup () /* Check if PTRACE_GETREGSET works. */ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) == 0) - have_ptrace_getregset = TRIBOOL_TRUE; + have_ptrace_getregset = 1; else - have_ptrace_getregset = TRIBOOL_FALSE; + have_ptrace_getregset = 0; } bool @@ -1122,7 +1122,7 @@ arm_target::get_regs_info () { const struct target_desc *tdesc = current_process ()->tdesc; - if (have_ptrace_getregset == TRIBOOL_TRUE + if (have_ptrace_getregset == 1 && (is_aarch32_linux_description (tdesc) || arm_linux_get_tdesc_fp_type (tdesc) == ARM_FP_TYPE_VFPV3)) return ®s_info_aarch32; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index dfa26d451b0..9d5a6242803 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -135,7 +135,7 @@ typedef struct #endif /* Does the current host support PTRACE_GETREGSET? */ -enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN; +int have_ptrace_getregset = -1; /* Return TRUE if THREAD is the leader thread of the process. */ diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index eaf87527338..d34d2738238 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -951,7 +951,7 @@ void thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid); bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len); -extern enum tribool have_ptrace_getregset; +extern int have_ptrace_getregset; /* Search for the value with type MATCH in the auxv vector, with entries of length WORDSIZE bytes, of process with pid PID. If found, store the diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 04202e355bb..933d1fb012a 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -899,7 +899,7 @@ x86_linux_read_description (void) if (ptrace (PTRACE_GETFPXREGS, tid, 0, (long) &fpxregs) < 0) { have_ptrace_getfpxregs = 0; - have_ptrace_getregset = TRIBOOL_FALSE; + have_ptrace_getregset = 0; return i386_linux_read_description (X86_XSTATE_X87); } else @@ -918,7 +918,7 @@ x86_linux_read_description (void) return tdesc_i386_linux_no_xml.get (); } - if (have_ptrace_getregset == TRIBOOL_UNKNOWN) + if (have_ptrace_getregset == -1) { uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))]; struct iovec iov; @@ -929,10 +929,10 @@ x86_linux_read_description (void) /* Check if PTRACE_GETREGSET works. */ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) - have_ptrace_getregset = TRIBOOL_FALSE; + have_ptrace_getregset = 0; else { - have_ptrace_getregset = TRIBOOL_TRUE; + have_ptrace_getregset = 1; /* Get XCR0 from XSAVE extended state. */ xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET @@ -955,7 +955,7 @@ x86_linux_read_description (void) } /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ - xcr0_features = (have_ptrace_getregset == TRIBOOL_TRUE + xcr0_features = (have_ptrace_getregset && (xcr0 & X86_XSTATE_ALL_MASK)); if (xcr0_features)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9480801c1f446952d6b499f5fb45e3474ac87a90 commit 9480801c1f446952d6b499f5fb45e3474ac87a90 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:53:17 2024 +0000 Revert "gdb/x86: move reading of cs and ds state into gdb/nat directory" This reverts commit 01ed1674d4435aa4e194fd9373b7705e425ef354. Diff: --- gdb/nat/x86-linux.c | 47 ----------------------------------------------- gdb/nat/x86-linux.h | 28 ---------------------------- gdb/x86-linux-nat.c | 42 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 80 deletions(-) diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c index 4242a1baafb..e61f4d749ba 100644 --- a/gdb/nat/x86-linux.c +++ b/gdb/nat/x86-linux.c @@ -20,8 +20,6 @@ #include "gdbsupport/common-defs.h" #include "x86-linux.h" #include "x86-linux-dregs.h" -#include "nat/gdb_ptrace.h" -#include <sys/user.h> /* Per-thread arch-specific data we want to keep. */ @@ -82,48 +80,3 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) { x86_linux_update_debug_registers (lwp); } - -#ifdef __x86_64__ -/* Value of CS segment register: - 64bit process: 0x33 - 32bit process: 0x23 */ -#define AMD64_LINUX_USER64_CS 0x33 - -/* Value of DS segment register: - LP64 process: 0x0 - X32 process: 0x2b */ -#define AMD64_LINUX_X32_DS 0x2b -#endif - -/* See nat/x86-linux.h. */ - -x86_linux_arch_size -x86_linux_ptrace_get_arch_size (int tid) -{ -#ifdef __x86_64__ - unsigned long cs; - unsigned long ds; - - /* Get CS register. */ - errno = 0; - cs = ptrace (PTRACE_PEEKUSER, tid, - offsetof (struct user_regs_struct, cs), 0); - if (errno != 0) - perror_with_name (_("Couldn't get CS register")); - - bool is_64bit = cs == AMD64_LINUX_USER64_CS; - - /* Get DS register. */ - errno = 0; - ds = ptrace (PTRACE_PEEKUSER, tid, - offsetof (struct user_regs_struct, ds), 0); - if (errno != 0) - perror_with_name (_("Couldn't get DS register")); - - bool is_x32 = ds == AMD64_LINUX_X32_DS; - - return x86_linux_arch_size (is_64bit, is_x32); -#else - return x86_linux_arch_size (false, false); -#endif -} diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h index 15153ea277e..822882173f9 100644 --- a/gdb/nat/x86-linux.h +++ b/gdb/nat/x86-linux.h @@ -47,32 +47,4 @@ extern void x86_linux_delete_thread (struct arch_lwp_info *arch_lwp); extern void x86_linux_prepare_to_resume (struct lwp_info *lwp); -/* Return value from x86_linux_ptrace_get_arch_size function. Indicates if - a thread is 32-bit, 64-bit, or x32. */ - -struct x86_linux_arch_size -{ - explicit x86_linux_arch_size (bool is_64bit, bool is_x32) - : m_is_64bit (is_64bit), - m_is_x32 (is_x32) - { - /* Nothing. */ - } - - bool is_64bit () const - { return m_is_64bit; } - - bool is_x32 () const - { return m_is_x32; } - -private: - bool m_is_64bit = false; - bool m_is_x32 = false; -}; - -/* Use ptrace calls to figure out if thread TID is 32-bit, 64-bit, or - 64-bit running in x32 mode. */ - -extern x86_linux_arch_size x86_linux_ptrace_get_arch_size (int tid); - #endif /* NAT_X86_LINUX_H */ diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index b39d05c401f..b93ffca38db 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -91,6 +91,18 @@ x86_linux_nat_target::post_startup_inferior (ptid_t ptid) linux_nat_target::post_startup_inferior (ptid); } +#ifdef __x86_64__ +/* Value of CS segment register: + 64bit process: 0x33 + 32bit process: 0x23 */ +#define AMD64_LINUX_USER64_CS 0x33 + +/* Value of DS segment register: + LP64 process: 0x0 + X32 process: 0x2b */ +#define AMD64_LINUX_X32_DS 0x2b +#endif + /* Get Linux/x86 target description from running target. */ const struct target_desc * @@ -110,11 +122,31 @@ x86_linux_nat_target::read_description () tid = inferior_ptid.pid (); #ifdef __x86_64__ - - x86_linux_arch_size arch_size = x86_linux_ptrace_get_arch_size (tid); - is_64bit = arch_size.is_64bit (); - is_x32 = arch_size.is_x32 (); - + { + unsigned long cs; + unsigned long ds; + + /* Get CS register. */ + errno = 0; + cs = ptrace (PTRACE_PEEKUSER, tid, + offsetof (struct user_regs_struct, cs), 0); + if (errno != 0) + perror_with_name (_("Couldn't get CS register")); + + is_64bit = cs == AMD64_LINUX_USER64_CS; + + /* Get DS register. */ + errno = 0; + ds = ptrace (PTRACE_PEEKUSER, tid, + offsetof (struct user_regs_struct, ds), 0); + if (errno != 0) + perror_with_name (_("Couldn't get DS register")); + + is_x32 = ds == AMD64_LINUX_X32_DS; + + if (sizeof (void *) == 4 && is_64bit && !is_x32) + error (_("Can't debug 64-bit process with 32-bit GDB")); + } #elif HAVE_PTRACE_GETFPXREGS if (have_ptrace_getfpxregs == -1) {
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=59b198a6163a23de5fdba04eb107686e1b871be0 commit 59b198a6163a23de5fdba04eb107686e1b871be0 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:53:05 2024 +0000 Revert "gdbserver/x86: move no-xml code earlier in x86_linux_read_description" This reverts commit 0a7bb97ad2f2fe2d18a442dad265051e34eab13e. Diff: --- gdbserver/linux-x86-low.cc | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 872c3fc69c7..04202e355bb 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -891,22 +891,6 @@ x86_linux_read_description (void) #endif } - /* If we are not allowed to send an XML target description then we need - to use the hard-wired target descriptions. This corresponds to GDB's - default machine for x86. - - This check needs to occur before any returns statements that might - generate some alternative target descriptions. */ - if (!use_xml) - { -#ifdef __x86_64__ - if (machine == EM_X86_64) - return tdesc_amd64_linux_no_xml.get (); - else -#endif - return tdesc_i386_linux_no_xml.get (); - } - #if !defined __x86_64__ && defined HAVE_PTRACE_GETFPXREGS if (machine == EM_386 && have_ptrace_getfpxregs == -1) { @@ -923,6 +907,17 @@ x86_linux_read_description (void) } #endif + if (!use_xml) + { + /* Don't use XML. */ +#ifdef __x86_64__ + if (machine == EM_X86_64) + return tdesc_amd64_linux_no_xml.get (); + else +#endif + return tdesc_i386_linux_no_xml.get (); + } + if (have_ptrace_getregset == TRIBOOL_UNKNOWN) { uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))];
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f06daade43dc8ec839e2eb3bd8b200c4b3f9682b commit f06daade43dc8ec839e2eb3bd8b200c4b3f9682b Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:51 2024 +0000 Revert "gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition" This reverts commit 7816b81e9b36ea0f57662bfd7446b573bf0c9e54. Diff: --- gdb/amd64-linux-tdep.c | 1 - gdb/i386-linux-tdep.c | 1 - gdb/i386-linux-tdep.h | 20 ++++++++++++++++++++ gdb/nat/x86-linux.h | 20 -------------------- gdbserver/linux-x86-low.cc | 22 +++++++++++++++++++++- 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index a512ec5dd02..1deb13b4e9a 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -42,7 +42,6 @@ #include "arch/amd64.h" #include "target-descriptions.h" #include "expop.h" -#include "nat/x86-linux.h" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 8dd7203b6c3..a2f937690c2 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -40,7 +40,6 @@ #include "i387-tdep.h" #include "gdbsupport/x86-xstate.h" -#include "nat/x86-linux.h" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml" diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index 07593c6a8ec..5891747572b 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -58,6 +58,26 @@ extern void i386_linux_report_signal_info (struct gdbarch *gdbarch, /* Return the target description according to XCR0. */ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); +/* Format of XSAVE extended state is: + struct + { + fxsave_bytes[0..463] + sw_usable_bytes[464..511] + xstate_hdr_bytes[512..575] + extended state regions (AVX, MPX, AVX512, PKRU, etc.) + }; + + Same memory layout will be used for the coredump NT_X86_XSTATE + representing the XSAVE extended state registers. + + The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled + extended state mask, which is the same as the extended control register + 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask + together with the mask saved in the xstate_hdr_bytes to determine what + states the processor/OS supports and what state, used or initialized, + the process/thread is in. */ +#define I386_LINUX_XSAVE_XCR0_OFFSET 464 + extern int i386_linux_gregset_reg_offset[]; /* Return x86 siginfo type. */ diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h index 855a8d14f91..15153ea277e 100644 --- a/gdb/nat/x86-linux.h +++ b/gdb/nat/x86-linux.h @@ -22,26 +22,6 @@ #include "nat/linux-nat.h" -/* Format of XSAVE extended state is: - struct - { - fxsave_bytes[0..463] - sw_usable_bytes[464..511] - xstate_hdr_bytes[512..575] - extended state regions (AVX, MPX, AVX512, PKRU, etc.) - }; - - Same memory layout will be used for the coredump NT_X86_XSTATE - representing the XSAVE extended state registers. - - The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled - extended state mask, which is the same as the extended control register - 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask - together with the mask saved in the xstate_hdr_bytes to determine what - states the processor/OS supports and what state, used or initialized, - the process/thread is in. */ -#define I386_LINUX_XSAVE_XCR0_OFFSET 464 - /* Set whether our local mirror of LWP's debug registers has been changed since the values were last written to the thread. Nonzero indicates that a change has been made, zero indicates no change. */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 30d876efc5d..872c3fc69c7 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -27,7 +27,6 @@ #include "gdbsupport/x86-xstate.h" #include "nat/x86-xstate.h" #include "nat/gdb_ptrace.h" -#include "nat/x86-linux.h" #ifdef __x86_64__ #include "nat/amd64-linux-siginfo.h" @@ -833,6 +832,27 @@ x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) \f static int use_xml; +/* Format of XSAVE extended state is: + struct + { + fxsave_bytes[0..463] + sw_usable_bytes[464..511] + xstate_hdr_bytes[512..575] + avx_bytes[576..831] + future_state etc + }; + + Same memory layout will be used for the coredump NT_X86_XSTATE + representing the XSAVE extended state registers. + + The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled + extended state mask, which is the same as the extended control register + 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask + together with the mask saved in the xstate_hdr_bytes to determine what + states the processor/OS supports and what state, used or initialized, + the process/thread is in. */ +#define I386_LINUX_XSAVE_XCR0_OFFSET 464 + /* Does the current host support the GETFPXREGS request? The header file may or may not define it, and even if it is defined, the kernel will return EIO if it's running on a pre-SSE processor. */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=49a7660fb50cc3c68e7830eb098905d068a3ccbf commit 49a7660fb50cc3c68e7830eb098905d068a3ccbf Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:44 2024 +0000 Revert "gdb/gdbserver: share some code relating to target description creation" This reverts commit cd9b374ffe372dcaf7e4c15548cf53a301d8dcdd. Diff: --- gdb/Makefile.in | 1 - gdb/amd64-linux-tdep.c | 1 - gdb/amd64-linux-tdep.h | 6 ++ gdb/configure.nat | 4 +- gdb/i386-linux-tdep.c | 1 - gdb/i386-linux-tdep.h | 3 + gdb/nat/x86-linux-tdesc.c | 124 ------------------------------------ gdb/nat/x86-linux-tdesc.h | 75 ---------------------- gdb/x86-linux-nat.c | 91 ++++++++++++++++++++++---- gdbserver/configure.srv | 2 - gdbserver/linux-amd64-ipa.cc | 1 - gdbserver/linux-i386-ipa.cc | 1 - gdbserver/linux-x86-low.cc | 148 ++++++++++++++++++++++++++++++------------- gdbserver/linux-x86-tdesc.cc | 1 - gdbserver/linux-x86-tdesc.h | 7 ++ 15 files changed, 199 insertions(+), 267 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 38f4d5fde98..331620375ae 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1585,7 +1585,6 @@ HFILES_NO_SRCDIR = \ 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 \ diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 7e0900dc6f9..a512ec5dd02 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -43,7 +43,6 @@ #include "target-descriptions.h" #include "expop.h" #include "nat/x86-linux.h" -#include "nat/x86-linux-tdesc.h" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" diff --git a/gdb/amd64-linux-tdep.h b/gdb/amd64-linux-tdep.h index 0ec49e7fe03..2003dcda78f 100644 --- a/gdb/amd64-linux-tdep.h +++ b/gdb/amd64-linux-tdep.h @@ -43,6 +43,12 @@ extern struct target_desc *tdesc_x32_linux; extern struct target_desc *tdesc_x32_avx_linux; extern struct target_desc *tdesc_x32_avx_avx512_linux; +/* Return the right amd64-linux target descriptions according to + XCR0_FEATURES_BIT and IS_X32. */ + +const target_desc *amd64_linux_read_description (uint64_t xcr0_features_bit, + bool is_x32); + /* Enum that defines the syscall identifiers for amd64 linux. Used for process record/replay, these will be translated into a gdb-canonical set of syscall ids in linux-record.c. */ diff --git a/gdb/configure.nat b/gdb/configure.nat index 4bcc0696027..8b98511cef7 100644 --- a/gdb/configure.nat +++ b/gdb/configure.nat @@ -256,7 +256,7 @@ case ${gdb_host} in NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ nat/x86-xstate.o \ i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \ - nat/x86-linux.o nat/x86-linux-dregs.o nat/x86-linux-tdesc.o" + nat/x86-linux.o nat/x86-linux-dregs.o" ;; ia64) # Host: Intel IA-64 running GNU/Linux @@ -322,7 +322,7 @@ case ${gdb_host} in NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ nat/x86-xstate.o amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \ nat/linux-btrace.o \ - nat/x86-linux.o nat/x86-linux-dregs.o nat/x86-linux-tdesc.o \ + nat/x86-linux.o nat/x86-linux-dregs.o \ nat/amd64-linux-siginfo.o" ;; sparc) diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index f5f7a36bf36..8dd7203b6c3 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -41,7 +41,6 @@ #include "i387-tdep.h" #include "gdbsupport/x86-xstate.h" #include "nat/x86-linux.h" -#include "nat/x86-linux-tdesc.h" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml" diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index e8691cd778e..07593c6a8ec 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -55,6 +55,9 @@ extern void i386_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal); +/* Return the target description according to XCR0. */ +extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); + extern int i386_linux_gregset_reg_offset[]; /* Return x86 siginfo type. */ diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c deleted file mode 100644 index be7014d2b5f..00000000000 --- a/gdb/nat/x86-linux-tdesc.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Target description related code for GNU/Linux x86 (i386 and x86-64). - - Copyright (C) 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 "gdbsupport/common-defs.h" -#include "nat/x86-linux-tdesc.h" -#ifdef __x86_64__ -#include "arch/amd64.h" -#endif -#include "arch/i386.h" - -#include "gdbsupport/common-defs.h" -#include "nat/x86-linux.h" -#include "nat/x86-linux-dregs.h" -#include "nat/gdb_ptrace.h" -#include "nat/x86-xstate.h" -#include "nat/x86-linux-tdesc.h" - -#include <cstdint> -#include <cstdlib> -#include <linux/uio.h> -#include <elf.h> -#include <sys/user.h> -#include <sys/user.h> - -/* See nat/x86-linux-tdesc.h. */ - -const target_desc * -x86_linux_tdesc_for_tid (int tid, enum tribool *have_ptrace_getregset, - gdb::function_view<void (uint64_t)> xcr0_init_cb, - const char *error_msg, uint64_t *xcr0_storage) -{ -#ifdef __x86_64__ - - x86_linux_arch_size arch_size = x86_linux_ptrace_get_arch_size (tid); - bool is_64bit = arch_size.is_64bit (); - bool is_x32 = arch_size.is_x32 (); - - if (sizeof (void *) == 4 && is_64bit && !is_x32) - error ("%s", error_msg); - -#elif HAVE_PTRACE_GETFPXREGS - if (have_ptrace_getfpxregs == -1) - { - elf_fpxregset_t fpxregs; - - if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) - { - have_ptrace_getfpxregs = 0; - *have_ptrace_getregset = TRIBOOL_FALSE; - return i386_linux_read_description (X86_XSTATE_X87_MASK); - } - } -#endif - - if (*have_ptrace_getregset == TRIBOOL_UNKNOWN) - { - uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))]; - struct iovec iov; - - iov.iov_base = xstateregs; - iov.iov_len = sizeof (xstateregs); - - /* Check if PTRACE_GETREGSET works. */ - if (ptrace (PTRACE_GETREGSET, tid, - (unsigned int) NT_X86_XSTATE, &iov) < 0) - { - *have_ptrace_getregset = TRIBOOL_FALSE; - *xcr0_storage = 0; - } - else - { - *have_ptrace_getregset = TRIBOOL_TRUE; - - /* Get XCR0 from XSAVE extended state. */ - *xcr0_storage = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET - / sizeof (uint64_t))]; - -#ifdef __x86_64__ - /* No MPX on x32. */ - if (is_64bit && is_x32) - *xcr0_storage &= ~X86_XSTATE_MPX; -#endif /* __x86_64__ */ - - xcr0_init_cb (*xcr0_storage); - } - } - - /* Check the native XCR0 only if PTRACE_GETREGSET is available. If - PTRACE_GETREGSET is not available then set xcr0_features_bits to - zero so that the "no-features" descriptions are returned by the - switches below. */ - uint64_t xcr0_features_bits; - if (*have_ptrace_getregset == TRIBOOL_TRUE) - xcr0_features_bits = *xcr0_storage & X86_XSTATE_ALL_MASK; - else - xcr0_features_bits = 0; - -#ifdef __x86_64__ - if (is_64bit) - { - return amd64_linux_read_description (xcr0_features_bits, is_x32); - } - else -#endif - return i386_linux_read_description (xcr0_features_bits); - - gdb_assert_not_reached ("failed to return tdesc"); -} diff --git a/gdb/nat/x86-linux-tdesc.h b/gdb/nat/x86-linux-tdesc.h deleted file mode 100644 index 3727a8bf95e..00000000000 --- a/gdb/nat/x86-linux-tdesc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Target description related code for GNU/Linux x86 (i386 and x86-64). - - Copyright (C) 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 NAT_X86_LINUX_TDESC_H -#define NAT_X86_LINUX_TDESC_H - -#include "gdbsupport/function-view.h" - -struct target_desc; - -/* Return the target description for Linux thread TID. - - When *HAVE_PTRACE_GETREGSET is TRIBOOL_UNKNOWN then the current value of - xcr0 is read using ptrace calls and stored into *XCR0_STORAGE. Then - XCR0_INIT_CB is called with the value of *XCR0_STORAGE and - *HAVE_PTRACE_GETREGSET is set to TRIBOOL_TRUE. - - If the attempt to read xcr0 using ptrace fails then *XCR0_STORAGE is set - to zero and *HAVE_PTRACE_GETREGSET is set to TRIBOOL_FALSE. - - The storage pointed to by XCR0_STORAGE must exist until the program - terminates, this storage is used to cache the xcr0 value. As such - XCR0_INIT_CB will only be called once if xcr0 is successfully read using - ptrace, or not at all if the ptrace call fails. - - This function returns a target description based on the extracted xcr0 - value along with other characteristics of the thread identified by TID. - - This function can return nullptr if we encounter a machine configuration - for which a target_desc cannot be created. Ideally this would not be - the case, we should be able to create a target description for every - possible machine configuration. See amd64_linux_read_description and - i386_linux_read_description for cases when nullptr might be - returned. - - ERROR_MSG is using in an error() call if we try to create a target - description for a 64-bit process but this is a 32-bit build of GDB. */ - -extern const target_desc * -x86_linux_tdesc_for_tid (int tid, enum tribool *have_ptrace_getregset, - gdb::function_view<void (uint64_t)> xcr0_init_cb, - const char *error_msg, uint64_t *xcr0_storage); - -#ifdef __x86_64__ - -/* Return the right amd64-linux target descriptions according to - XCR0_FEATURES_BIT and IS_X32. This is implemented separately in both - GDB and gdbserver. */ - -extern const target_desc *amd64_linux_read_description - (uint64_t xcr0_features_bit, bool is_x32); - -#endif - -/* Return the target description according to XCR0. This is implemented - separately in both GDB and gdbserver. */ -extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); - -#endif /* NAT_X86_LINUX_TDESC_H */ diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index 872e27e739f..b39d05c401f 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -42,7 +42,6 @@ #include "nat/x86-linux.h" #include "nat/x86-linux-dregs.h" #include "nat/linux-ptrace.h" -#include "nat/x86-linux-tdesc.h" /* linux_nat_target::low_new_fork implementation. */ @@ -97,26 +96,90 @@ x86_linux_nat_target::post_startup_inferior (ptid_t ptid) const struct target_desc * x86_linux_nat_target::read_description () { - static uint64_t xcr0_storage; + int tid; + int is_64bit = 0; +#ifdef __x86_64__ + int is_x32; +#endif + static uint64_t xcr0; + uint64_t xcr0_features_bits; if (inferior_ptid == null_ptid) return this->beneath ()->read_description (); - int tid = inferior_ptid.pid (); + tid = inferior_ptid.pid (); + +#ifdef __x86_64__ + + x86_linux_arch_size arch_size = x86_linux_ptrace_get_arch_size (tid); + is_64bit = arch_size.is_64bit (); + is_x32 = arch_size.is_x32 (); + +#elif HAVE_PTRACE_GETFPXREGS + if (have_ptrace_getfpxregs == -1) + { + elf_fpxregset_t fpxregs; + + if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) + { + have_ptrace_getfpxregs = 0; + have_ptrace_getregset = TRIBOOL_FALSE; + return i386_linux_read_description (X86_XSTATE_X87_MASK); + } + } +#endif + + if (have_ptrace_getregset == TRIBOOL_UNKNOWN) + { + uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))]; + struct iovec iov; + + iov.iov_base = xstateregs; + iov.iov_len = sizeof (xstateregs); + + /* Check if PTRACE_GETREGSET works. */ + if (ptrace (PTRACE_GETREGSET, tid, + (unsigned int) NT_X86_XSTATE, &iov) < 0) + have_ptrace_getregset = TRIBOOL_FALSE; + else + { + have_ptrace_getregset = TRIBOOL_TRUE; + + /* Get XCR0 from XSAVE extended state. */ + xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET + / sizeof (uint64_t))]; + + m_xsave_layout = x86_fetch_xsave_layout (xcr0, x86_xsave_length ()); + } + } + + /* Check the native XCR0 only if PTRACE_GETREGSET is available. If + PTRACE_GETREGSET is not available then set xcr0_features_bits to + zero so that the "no-features" descriptions are returned by the + switches below. */ + if (have_ptrace_getregset == TRIBOOL_TRUE) + xcr0_features_bits = xcr0 & X86_XSTATE_ALL_MASK; + else + xcr0_features_bits = 0; + + if (is_64bit) + { +#ifdef __x86_64__ + return amd64_linux_read_description (xcr0_features_bits, is_x32); +#endif + } + else + { + const struct target_desc * tdesc + = i386_linux_read_description (xcr0_features_bits); - const char *error_msg - = _("Can't debug 64-bit process with 32-bit GDB"); + if (tdesc == NULL) + tdesc = i386_linux_read_description (X86_XSTATE_SSE_MASK); - /* Callback that is triggered the first time x86_linux_tdesc_for_tid - reads the xcr0 register. Setup other bits of state */ - auto cb = [&] (uint64_t xcr0) - { - this->m_xsave_layout - = x86_fetch_xsave_layout (xcr0, x86_xsave_length ()); - }; + return tdesc; + } - return x86_linux_tdesc_for_tid (tid, &have_ptrace_getregset, cb, - error_msg, &xcr0_storage); + gdb_assert_not_reached ("failed to return tdesc"); } \f diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 7a2702d78bf..9e861a75088 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -109,7 +109,6 @@ case "${gdbserver_host}" in srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o" srv_tgtobj="${srv_tgtobj} nat/x86-linux.o" srv_tgtobj="${srv_tgtobj} nat/x86-linux-dregs.o" - srv_tgtobj="${srv_tgtobj} nat/x86-linux-tdesc.o" srv_linux_usrregs=yes srv_linux_regsets=yes srv_linux_thread_db=yes @@ -372,7 +371,6 @@ case "${gdbserver_host}" in srv_tgtobj="${srv_tgtobj} nat/linux-btrace.o" srv_tgtobj="${srv_tgtobj} nat/x86-linux.o" srv_tgtobj="${srv_tgtobj} nat/x86-linux-dregs.o" - srv_tgtobj="${srv_tgtobj} nat/x86-linux-tdesc.o" srv_tgtobj="${srv_tgtobj} nat/amd64-linux-siginfo.o" srv_linux_usrregs=yes # This is for i386 progs. srv_linux_regsets=yes diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc index f97b0d6a1d9..54e4c9812bb 100644 --- a/gdbserver/linux-amd64-ipa.cc +++ b/gdbserver/linux-amd64-ipa.cc @@ -23,7 +23,6 @@ #include "tracepoint.h" #include "linux-x86-tdesc.h" #include "gdbsupport/x86-xstate.h" -#include "nat/x86-linux-tdesc.h" /* Defined in auto-generated file amd64-linux.c. */ void init_registers_amd64_linux (void); diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc index 459b8055b5c..2e4646f8c03 100644 --- a/gdbserver/linux-i386-ipa.cc +++ b/gdbserver/linux-i386-ipa.cc @@ -23,7 +23,6 @@ #include "tracepoint.h" #include "linux-x86-tdesc.h" #include "gdbsupport/x86-xstate.h" -#include "nat/x86-linux-tdesc.h" /* GDB register numbers. */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 9bf369f8a34..30d876efc5d 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -48,7 +48,6 @@ #include "nat/x86-linux.h" #include "nat/x86-linux-dregs.h" #include "linux-x86-tdesc.h" -#include "nat/x86-linux-tdesc.h" #ifdef __x86_64__ static target_desc_up tdesc_amd64_linux_no_xml; @@ -845,20 +844,32 @@ int have_ptrace_getfpxregs = #endif ; -/* Cached xcr0 value. This is initialised the first time - x86_linux_read_description is called. */ - -static uint64_t xcr0_storage; - /* Get Linux/x86 target description from running target. */ static const struct target_desc * x86_linux_read_description (void) { - int tid = lwpid_of (current_thread); + unsigned int machine; + int is_elf64; + int xcr0_features; + int tid; + static uint64_t xcr0; + static int xsave_len; + struct regset_info *regset; + + tid = lwpid_of (current_thread); + + is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); - const char *error_msg - = _("Can't debug 64-bit process with 32-bit GDBserver"); + if (sizeof (void *) == 4) + { + if (is_elf64 > 0) + error (_("Can't debug 64-bit process with 32-bit GDBserver")); +#ifndef __x86_64__ + else if (machine == EM_X86_64) + error (_("Can't debug x86-64 process with 32-bit GDBserver")); +#endif + } /* If we are not allowed to send an XML target description then we need to use the hard-wired target descriptions. This corresponds to GDB's @@ -868,54 +879,103 @@ x86_linux_read_description (void) generate some alternative target descriptions. */ if (!use_xml) { - x86_linux_arch_size arch_size = x86_linux_ptrace_get_arch_size (tid); - bool is_64bit = arch_size.is_64bit (); - bool is_x32 = arch_size.is_x32 (); - - if (sizeof (void *) == 4 && is_64bit && !is_x32) - error ("%s", error_msg); - #ifdef __x86_64__ - if (is_64bit && !is_x32) + if (machine == EM_X86_64) return tdesc_amd64_linux_no_xml.get (); else #endif return tdesc_i386_linux_no_xml.get (); } - /* Callback that is triggered the first time x86_linux_tdesc_for_tid - reads the xcr0 register. Setup other bits of state */ - auto cb = [] (uint64_t xcr0) - { - i387_set_xsave_mask (xcr0, x86_xsave_length ()); - }; +#if !defined __x86_64__ && defined HAVE_PTRACE_GETFPXREGS + if (machine == EM_386 && have_ptrace_getfpxregs == -1) + { + elf_fpxregset_t fpxregs; - /* If have_ptrace_getregset is changed to true by calling - x86_linux_tdesc_for_tid then we will perform some additional - initialisation. */ - bool have_ptrace_getregset_is_unknown - = have_ptrace_getregset == TRIBOOL_UNKNOWN; + if (ptrace (PTRACE_GETFPXREGS, tid, 0, (long) &fpxregs) < 0) + { + have_ptrace_getfpxregs = 0; + have_ptrace_getregset = TRIBOOL_FALSE; + return i386_linux_read_description (X86_XSTATE_X87); + } + else + have_ptrace_getfpxregs = 1; + } +#endif - const target_desc *tdesc - = x86_linux_tdesc_for_tid (tid, &have_ptrace_getregset, cb, error_msg, - &xcr0_storage); + if (have_ptrace_getregset == TRIBOOL_UNKNOWN) + { + uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))]; + struct iovec iov; - if (have_ptrace_getregset_is_unknown - && have_ptrace_getregset == TRIBOOL_TRUE) + iov.iov_base = xstateregs; + iov.iov_len = sizeof (xstateregs); + + /* Check if PTRACE_GETREGSET works. */ + if (ptrace (PTRACE_GETREGSET, tid, + (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) + have_ptrace_getregset = TRIBOOL_FALSE; + else + { + have_ptrace_getregset = TRIBOOL_TRUE; + + /* Get XCR0 from XSAVE extended state. */ + xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET + / sizeof (uint64_t))]; + + /* No MPX on x32. */ + if (machine == EM_X86_64 && !is_elf64) + xcr0 &= ~X86_XSTATE_MPX; + + xsave_len = x86_xsave_length (); + + /* Use PTRACE_GETREGSET if it is available. */ + for (regset = x86_regsets; + regset->fill_function != NULL; regset++) + if (regset->get_request == PTRACE_GETREGSET) + regset->size = xsave_len; + else if (regset->type != GENERAL_REGS) + regset->size = 0; + } + } + + /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ + xcr0_features = (have_ptrace_getregset == TRIBOOL_TRUE + && (xcr0 & X86_XSTATE_ALL_MASK)); + + if (xcr0_features) + i387_set_xsave_mask (xcr0, xsave_len); + + if (machine == EM_X86_64) + { +#ifdef __x86_64__ + const target_desc *tdesc = NULL; + + if (xcr0_features) + { + tdesc = amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK, + !is_elf64); + } + + if (tdesc == NULL) + tdesc = amd64_linux_read_description (X86_XSTATE_SSE_MASK, !is_elf64); + return tdesc; +#endif + } + else { - int xsave_len = x86_xsave_length (); - - /* Use PTRACE_GETREGSET if it is available. */ - for (regset_info *regset = x86_regsets; - regset->fill_function != nullptr; - regset++) - if (regset->get_request == PTRACE_GETREGSET) - regset->size = xsave_len; - else if (regset->type != GENERAL_REGS) - regset->size = 0; + const target_desc *tdesc = NULL; + + if (xcr0_features) + tdesc = i386_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK); + + if (tdesc == NULL) + tdesc = i386_linux_read_description (X86_XSTATE_SSE); + + return tdesc; } - return tdesc; + gdb_assert_not_reached ("failed to return tdesc"); } /* Update all the target description of all processes; a new GDB diff --git a/gdbserver/linux-x86-tdesc.cc b/gdbserver/linux-x86-tdesc.cc index 9fd64d8574b..626207fc477 100644 --- a/gdbserver/linux-x86-tdesc.cc +++ b/gdbserver/linux-x86-tdesc.cc @@ -26,7 +26,6 @@ #include "arch/amd64.h" #endif #include "x86-tdesc.h" -#include "nat/x86-linux-tdesc.h" /* Return the right x86_linux_tdesc index for a given XCR0. Return X86_TDESC_LAST if can't find a match. */ diff --git a/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h index 576aaf5e165..f9561b129ae 100644 --- a/gdbserver/linux-x86-tdesc.h +++ b/gdbserver/linux-x86-tdesc.h @@ -46,4 +46,11 @@ int amd64_get_ipa_tdesc_idx (const struct target_desc *tdesc); const struct target_desc *i386_get_ipa_tdesc (int idx); +#ifdef __x86_64__ +const struct target_desc *amd64_linux_read_description (uint64_t xcr0, + bool is_x32); +#endif + +const struct target_desc *i386_linux_read_description (uint64_t xcr0); + #endif /* GDBSERVER_LINUX_X86_TDESC_H */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0991b56074af7e6b106015c67925fdcfe039f077 commit 0991b56074af7e6b106015c67925fdcfe039f077 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:36 2024 +0000 Revert "gdb/arch: assert that X86_XSTATE_MPX is not set for x32" This reverts commit efba976d9713a92b4507ccfef2257e4589da2798. Diff: --- gdb/arch/amd64.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gdb/arch/amd64.c b/gdb/arch/amd64.c index f182e686dda..b8ff4270079 100644 --- a/gdb/arch/amd64.c +++ b/gdb/arch/amd64.c @@ -66,12 +66,8 @@ amd64_create_target_description (uint64_t xcr0, bool is_x32, bool is_linux, if (xcr0 & X86_XSTATE_AVX) regnum = create_feature_i386_64bit_avx (tdesc.get (), regnum); - if (xcr0 & X86_XSTATE_MPX) - { - /* MPX is not available on x32. */ - gdb_assert (!is_x32); - regnum = create_feature_i386_64bit_mpx (tdesc.get (), regnum); - } + if ((xcr0 & X86_XSTATE_MPX) && !is_x32) + regnum = create_feature_i386_64bit_mpx (tdesc.get (), regnum); if (xcr0 & X86_XSTATE_AVX512) regnum = create_feature_i386_64bit_avx512 (tdesc.get (), regnum);
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cba2791ca6a984bd533ab643f4d92e3f5b278b43 commit cba2791ca6a984bd533ab643f4d92e3f5b278b43 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:27 2024 +0000 Revert "gdbserver: update target description creation for x86/linux" This reverts commit 61bb321605fc74703adc994fd7a78e9d2495ca7a. Diff: --- gdbserver/linux-amd64-ipa.cc | 43 ++++-- gdbserver/linux-i386-ipa.cc | 23 +++- gdbserver/linux-x86-low.cc | 15 +-- gdbserver/linux-x86-tdesc.cc | 315 ++++++++++++------------------------------- gdbserver/linux-x86-tdesc.h | 49 ++++--- 5 files changed, 168 insertions(+), 277 deletions(-) diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc index 42de7d2da16..f97b0d6a1d9 100644 --- a/gdbserver/linux-amd64-ipa.cc +++ b/gdbserver/linux-amd64-ipa.cc @@ -169,21 +169,47 @@ supply_static_tracepoint_registers (struct regcache *regcache, #endif /* HAVE_UST */ +#if !defined __ILP32__ +/* Map the tdesc index to xcr0 mask. */ +static uint64_t idx2mask[X86_TDESC_LAST] = { + X86_XSTATE_X87_MASK, + X86_XSTATE_SSE_MASK, + X86_XSTATE_AVX_MASK, + X86_XSTATE_MPX_MASK, + X86_XSTATE_AVX_MPX_MASK, + X86_XSTATE_AVX_AVX512_MASK, + X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, +}; +#endif + /* Return target_desc to use for IPA, given the tdesc index passed by gdbserver. */ const struct target_desc * get_ipa_tdesc (int idx) { - uint64_t xcr0 = x86_linux_tdesc_idx_to_xcr0 (idx); + if (idx >= X86_TDESC_LAST) + { + internal_error ("unknown ipa tdesc index: %d", idx); + } #if defined __ILP32__ - bool is_x32 = true; + switch (idx) + { + case X86_TDESC_SSE: + return amd64_linux_read_description (X86_XSTATE_SSE_MASK, true); + case X86_TDESC_AVX: + return amd64_linux_read_description (X86_XSTATE_AVX_MASK, true); + case X86_TDESC_AVX_AVX512: + return amd64_linux_read_description (X86_XSTATE_AVX_AVX512_MASK, true); + default: + break; + } #else - bool is_x32 = false; + return amd64_linux_read_description (idx2mask[idx], false); #endif - return amd64_linux_read_description (xcr0, is_x32); + internal_error ("unknown ipa tdesc index: %d", idx); } /* Allocate buffer for the jump pads. The branch instruction has a @@ -251,10 +277,11 @@ void initialize_low_tracepoint (void) { #if defined __ILP32__ - for (auto i = 0; i < x86_linux_x32_ipa_tdesc_count (); i++) - amd64_linux_read_description (x86_linux_tdesc_idx_to_xcr0 (i), true); + amd64_linux_read_description (X86_XSTATE_SSE_MASK, true); + amd64_linux_read_description (X86_XSTATE_AVX_MASK, true); + amd64_linux_read_description (X86_XSTATE_AVX_AVX512_MASK, true); #else - for (auto i = 0; i < x86_linux_amd64_ipa_tdesc_count (); i++) - amd64_linux_read_description (x86_linux_tdesc_idx_to_xcr0 (i), false); + for (auto i = 0; i < X86_TDESC_LAST; i++) + amd64_linux_read_description (idx2mask[i], false); #endif } diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc index 246bcb9813b..459b8055b5c 100644 --- a/gdbserver/linux-i386-ipa.cc +++ b/gdbserver/linux-i386-ipa.cc @@ -246,15 +246,28 @@ initialize_fast_tracepoint_trampoline_buffer (void) } } +/* Map the tdesc index to xcr0 mask. */ +static uint64_t idx2mask[X86_TDESC_LAST] = { + X86_XSTATE_X87_MASK, + X86_XSTATE_SSE_MASK, + X86_XSTATE_AVX_MASK, + X86_XSTATE_MPX_MASK, + X86_XSTATE_AVX_MPX_MASK, + X86_XSTATE_AVX_AVX512_MASK, + X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, +}; + /* Return target_desc to use for IPA, given the tdesc index passed by gdbserver. */ const struct target_desc * get_ipa_tdesc (int idx) { - uint64_t xcr0 = x86_linux_tdesc_idx_to_xcr0 (idx); - - return i386_linux_read_description (xcr0); + if (idx >= X86_TDESC_LAST) + { + internal_error ("unknown ipa tdesc index: %d", idx); + } + return i386_linux_read_description (idx2mask[idx]); } /* Allocate buffer for the jump pads. On i386, we can reach an arbitrary @@ -276,6 +289,6 @@ void initialize_low_tracepoint (void) { initialize_fast_tracepoint_trampoline_buffer (); - for (auto i = 0; i < x86_linux_i386_ipa_tdesc_count (); i++) - i386_linux_read_description (x86_linux_tdesc_idx_to_xcr0 (i)); + for (auto i = 0; i < X86_TDESC_LAST; i++) + i386_linux_read_description (idx2mask[i]); } diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 6dbefdb2f26..9bf369f8a34 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -2892,17 +2892,14 @@ x86_target::get_ipa_tdesc_idx () struct regcache *regcache = get_thread_regcache (current_thread, 0); const struct target_desc *tdesc = regcache->tdesc; - if (!use_xml) - { - if (tdesc == tdesc_i386_linux_no_xml.get () #ifdef __x86_64__ - || tdesc == tdesc_amd64_linux_no_xml.get () -#endif /* __x86_64__ */ - ) - return x86_linux_xcr0_to_tdesc_idx (X86_XSTATE_SSE_MASK); - } + return amd64_get_ipa_tdesc_idx (tdesc); +#endif + + if (tdesc == tdesc_i386_linux_no_xml.get ()) + return X86_TDESC_SSE; - return x86_linux_xcr0_to_tdesc_idx (xcr0_storage); + return i386_get_ipa_tdesc_idx (tdesc); } /* The linux target ops object. */ diff --git a/gdbserver/linux-x86-tdesc.cc b/gdbserver/linux-x86-tdesc.cc index 87cf368a336..9fd64d8574b 100644 --- a/gdbserver/linux-x86-tdesc.cc +++ b/gdbserver/linux-x86-tdesc.cc @@ -28,277 +28,96 @@ #include "x86-tdesc.h" #include "nat/x86-linux-tdesc.h" -/* A structure used to describe a single cpu feature that might, or might - not, be checked for when creating a target description for one of i386, - amd64, or x32. */ +/* Return the right x86_linux_tdesc index for a given XCR0. Return + X86_TDESC_LAST if can't find a match. */ -struct x86_tdesc_feature { - /* The cpu feature mask. This is a mask against an xcr0 value. */ - uint64_t feature; - - /* Is this feature checked when creating an i386 target description. */ - bool is_i386; - - /* Is this feature checked when creating an amd64 target description. */ - bool is_amd64; - - /* Is this feature checked when creating an x32 target description. */ - bool is_x32; -}; - -/* A constant table that describes all of the cpu features that are - checked when building a target description for i386, amd64, or x32. */ - -static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { - /* Feature, i386, amd64, x32. */ - { X86_XSTATE_PKRU, true, true, true }, - { X86_XSTATE_AVX512, true, true, true }, - { X86_XSTATE_AVX, true, true, true }, - { X86_XSTATE_MPX, true, true, false }, - { X86_XSTATE_SSE, true, false, false }, - { X86_XSTATE_X87, true, false, false } -}; - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an i386 target description. */ - -static constexpr uint64_t -x86_linux_i386_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_i386) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an amd64 target description. */ - -static constexpr uint64_t -x86_linux_amd64_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_amd64) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an x32 target description. */ - -static constexpr uint64_t -x86_linux_x32_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_x32) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an i386 target description. */ - -static constexpr int -x86_linux_i386_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_i386) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an amd64 target description. */ - -static constexpr int -x86_linux_amd64_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_amd64) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an x32 target description. */ - -static constexpr int -x86_linux_x32_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_x32) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -#ifdef IN_PROCESS_AGENT - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_amd64_ipa_tdesc_count () -{ - return x86_linux_amd64_tdesc_count (); -} - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_x32_ipa_tdesc_count () -{ - return x86_linux_x32_tdesc_count (); -} - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_i386_ipa_tdesc_count () -{ - return x86_linux_i386_tdesc_count (); -} - -#endif /* IN_PROCESS_AGENT */ - -/* Convert an xcr0 value into an integer. The integer will be passed to - the in-process-agent where it will then be passed to - x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ - -int -x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0) +static enum x86_linux_tdesc +xcr0_to_tdesc_idx (uint64_t xcr0, bool is_x32) { - /* The following table shows which features are checked for when creating - the target descriptions (see nat/x86-linux-tdesc.c), the feature order - represents the bit order within the generated index number. - - i386 | x87 sse mpx avx avx512 pkru - amd64 | mpx avx avx512 pkru - i32 | avx avx512 pkru - - The features are ordered so that for each mode (i386, amd64, i32) the - generated index will form a continuous range. */ - - int idx = 0; - - for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) + if (xcr0 & X86_XSTATE_PKRU) { - if ((xcr0 & x86_linux_all_tdesc_features[i].feature) != 0) - idx |= (1 << i); + if (is_x32) + { + /* No x32 MPX and PKU, fall back to avx_avx512. */ + return X86_TDESC_AVX_AVX512; + } + else + return X86_TDESC_AVX_MPX_AVX512_PKU; } - - return idx; -} - - -#ifdef IN_PROCESS_AGENT - -/* 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. */ - -uint64_t -x86_linux_tdesc_idx_to_xcr0 (int idx) -{ - uint64_t xcr0 = 0; - - for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) + else if (xcr0 & X86_XSTATE_AVX512) + return X86_TDESC_AVX_AVX512; + else if ((xcr0 & X86_XSTATE_AVX_MPX_MASK) == X86_XSTATE_AVX_MPX_MASK) { - if ((idx & (1 << i)) != 0) - xcr0 |= x86_linux_all_tdesc_features[i].feature; + if (is_x32) /* No MPX on x32. */ + return X86_TDESC_AVX; + else + return X86_TDESC_AVX_MPX; } - - return xcr0; + else if (xcr0 & X86_XSTATE_MPX) + { + if (is_x32) /* No MPX on x32. */ + return X86_TDESC_AVX; + else + return X86_TDESC_MPX; + } + else if (xcr0 & X86_XSTATE_AVX) + return X86_TDESC_AVX; + else if (xcr0 & X86_XSTATE_SSE) + return X86_TDESC_SSE; + else if (xcr0 & X86_XSTATE_X87) + return X86_TDESC_MMX; + else + return X86_TDESC_LAST; } -#endif /* IN_PROCESS_AGENT */ - #if defined __i386__ || !defined IN_PROCESS_AGENT -/* A cache of all possible i386 target descriptions. */ +static struct target_desc *i386_tdescs[X86_TDESC_LAST] = { }; -static struct target_desc *i386_tdescs[x86_linux_i386_tdesc_count ()] = { }; - -/* See nat/x86-linux-tdesc.h. */ +/* Return the target description according to XCR0. */ const struct target_desc * i386_linux_read_description (uint64_t xcr0) { - xcr0 &= x86_linux_i386_tdesc_feature_mask (); - int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); + enum x86_linux_tdesc idx = xcr0_to_tdesc_idx (xcr0, false); - gdb_assert (idx >= 0 && idx < x86_linux_i386_tdesc_count ()); + if (idx == X86_TDESC_LAST) + return NULL; - target_desc **tdesc = &i386_tdescs[idx]; + struct target_desc **tdesc = &i386_tdescs[idx]; - if (*tdesc == nullptr) + if (*tdesc == NULL) { *tdesc = i386_create_target_description (xcr0, true, false); init_target_desc (*tdesc, i386_expedite_regs); } - return *tdesc; + return *tdesc;; } #endif #ifdef __x86_64__ -/* A cache of all possible amd64 target descriptions. */ - -static target_desc *amd64_tdescs[x86_linux_amd64_tdesc_count ()] = { }; - -/* A cache of all possible x32 target descriptions. */ - -static target_desc *x32_tdescs[x86_linux_x32_tdesc_count ()] = { }; - -/* See nat/x86-linux-tdesc.h. */ +static target_desc *amd64_tdescs[X86_TDESC_LAST] = { }; +static target_desc *x32_tdescs[X86_TDESC_LAST] = { }; const struct target_desc * amd64_linux_read_description (uint64_t xcr0, bool is_x32) { - if (is_x32) - xcr0 &= x86_linux_x32_tdesc_feature_mask (); - else - xcr0 &= x86_linux_amd64_tdesc_feature_mask (); - - int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); + enum x86_linux_tdesc idx = xcr0_to_tdesc_idx (xcr0, is_x32); - if (is_x32) - gdb_assert (idx >= 0 && idx < x86_linux_x32_tdesc_count ()); - else - gdb_assert (idx >= 0 && idx < x86_linux_amd64_tdesc_count ()); + if (idx == X86_TDESC_LAST) + return NULL; - target_desc **tdesc = nullptr; + struct target_desc **tdesc = NULL; if (is_x32) tdesc = &x32_tdescs[idx]; else tdesc = &amd64_tdescs[idx]; - if (*tdesc == nullptr) + if (*tdesc == NULL) { *tdesc = amd64_create_target_description (xcr0, is_x32, true, true); @@ -308,3 +127,39 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32) } #endif + +#ifndef IN_PROCESS_AGENT + +int +i386_get_ipa_tdesc_idx (const struct target_desc *tdesc) +{ + for (int i = 0; i < X86_TDESC_LAST; i++) + { + if (tdesc == i386_tdescs[i]) + return i; + } + + /* If none tdesc is found, return the one with minimum features. */ + return X86_TDESC_MMX; +} + +#if defined __x86_64__ +int +amd64_get_ipa_tdesc_idx (const struct target_desc *tdesc) +{ + for (int i = 0; i < X86_TDESC_LAST; i++) + { + if (tdesc == amd64_tdescs[i]) + return i; + } + for (int i = 0; i < X86_TDESC_LAST; i++) + { + if (tdesc == x32_tdescs[i]) + return i; + } + + return X86_TDESC_SSE; +} + +#endif +#endif diff --git a/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h index 70456e4be44..576aaf5e165 100644 --- a/gdbserver/linux-x86-tdesc.h +++ b/gdbserver/linux-x86-tdesc.h @@ -21,30 +21,29 @@ #ifndef GDBSERVER_LINUX_X86_TDESC_H #define GDBSERVER_LINUX_X86_TDESC_H -/* Convert an xcr0 value into an integer. The integer will be passed to - the in-process-agent where it will then be passed to - x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ - -extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0); - -#ifdef IN_PROCESS_AGENT - -/* 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. */ - -extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx); - -/* Within the in-process-agent we need to pre-initialise all of the target - descriptions, to do this we need to know how many target descriptions - there are for each different target type. These functions return the - target description count for the relevant target. */ - -extern int x86_linux_amd64_ipa_tdesc_count (); -extern int x86_linux_x32_ipa_tdesc_count (); -extern int x86_linux_i386_ipa_tdesc_count (); - - -#endif /* IN_PROCESS_AGENT */ +/* Note: since IPA obviously knows what ABI it's running on (i386 vs x86_64 + vs x32), it's sufficient to pass only the register set here. This, + together with the ABI known at IPA compile time, maps to a tdesc. */ + +enum x86_linux_tdesc { + X86_TDESC_MMX = 0, + X86_TDESC_SSE = 1, + X86_TDESC_AVX = 2, + X86_TDESC_MPX = 3, + X86_TDESC_AVX_MPX = 4, + X86_TDESC_AVX_AVX512 = 5, + X86_TDESC_AVX_MPX_AVX512_PKU = 6, + X86_TDESC_LAST = 7, +}; + +#if defined __i386__ || !defined IN_PROCESS_AGENT +int i386_get_ipa_tdesc_idx (const struct target_desc *tdesc); +#endif + +#if defined __x86_64__ && !defined IN_PROCESS_AGENT +int amd64_get_ipa_tdesc_idx (const struct target_desc *tdesc); +#endif + +const struct target_desc *i386_get_ipa_tdesc (int idx); #endif /* GDBSERVER_LINUX_X86_TDESC_H */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=69324a74e344e640e0c2d4e76e4e4dfd3368cd76 commit 69324a74e344e640e0c2d4e76e4e4dfd3368cd76 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:17 2024 +0000 Revert "gdb/gdbserver: share x86/linux tdesc caching" This reverts commit 198ff6ff819c240545f9fc68b39636fd376d4ba9. Diff: --- gdb/amd64-linux-tdep.c | 31 +++++ gdb/i386-linux-tdep.c | 30 +++-- gdb/nat/x86-linux-tdesc.c | 287 ------------------------------------------- gdb/nat/x86-linux-tdesc.h | 56 ++------- gdbserver/Makefile.in | 4 - gdbserver/configure.srv | 2 - gdbserver/linux-amd64-ipa.cc | 1 + gdbserver/linux-i386-ipa.cc | 1 + gdbserver/linux-x86-low.cc | 1 + gdbserver/linux-x86-tdesc.cc | 285 +++++++++++++++++++++++++++++++++++++++++- gdbserver/linux-x86-tdesc.h | 50 ++++++++ 11 files changed, 393 insertions(+), 355 deletions(-) diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index e149034de21..7e0900dc6f9 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1579,6 +1579,37 @@ amd64_linux_record_signal (struct gdbarch *gdbarch, return 0; } +const target_desc * +amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32) +{ + static target_desc *amd64_linux_tdescs \ + [2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {}; + static target_desc *x32_linux_tdescs \ + [2/*AVX*/][2/*AVX512*/][2/*PKRU*/] = {}; + + target_desc **tdesc; + + if (is_x32) + { + tdesc = &x32_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0 ] + [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0]; + } + else + { + tdesc = &amd64_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_MPX) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0]; + } + + if (*tdesc == NULL) + *tdesc = amd64_create_target_description (xcr0_features_bit, is_x32, + true, true); + + return *tdesc; +} + /* Get Linux/x86 target description from core dump. */ static const struct target_desc * diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index ed1442236e8..f5f7a36bf36 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -681,12 +681,29 @@ i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch, layout) != 0; } -/* See nat/x86-linux-tdesc.h. */ +/* See i386-linux-tdep.h. */ -void -x86_linux_post_init_tdesc (target_desc *tdesc, bool is_64bit) +const struct target_desc * +i386_linux_read_description (uint64_t xcr0) { - /* Nothing. */ + if (xcr0 == 0) + return NULL; + + static struct target_desc *i386_linux_tdescs \ + [2/*X87*/][2/*SSE*/][2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {}; + struct target_desc **tdesc; + + tdesc = &i386_linux_tdescs[(xcr0 & X86_XSTATE_X87) ? 1 : 0] + [(xcr0 & X86_XSTATE_SSE) ? 1 : 0] + [(xcr0 & X86_XSTATE_AVX) ? 1 : 0] + [(xcr0 & X86_XSTATE_MPX) ? 1 : 0] + [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0] + [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]; + + if (*tdesc == NULL) + *tdesc = i386_create_target_description (xcr0, true, false); + + return *tdesc; } /* Get Linux/x86 target description from core dump. */ @@ -699,10 +716,7 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, /* Linux/i386. */ x86_xsave_layout layout; uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); - - const struct target_desc *tdesc; - if (xcr0 != 0) - tdesc = i386_linux_read_description (xcr0); + const struct target_desc *tdesc = i386_linux_read_description (xcr0); if (tdesc != NULL) return tdesc; diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c index c438dfae84f..be7014d2b5f 100644 --- a/gdb/nat/x86-linux-tdesc.c +++ b/gdb/nat/x86-linux-tdesc.c @@ -38,8 +38,6 @@ #include <sys/user.h> #include <sys/user.h> -#ifndef IN_PROCESS_AGENT - /* See nat/x86-linux-tdesc.h. */ const target_desc * @@ -124,288 +122,3 @@ x86_linux_tdesc_for_tid (int tid, enum tribool *have_ptrace_getregset, gdb_assert_not_reached ("failed to return tdesc"); } - -#endif /* !IN_PROCESS_AGENT */ - - - -/* A structure used to describe a single cpu feature that might, or might - not, be checked for when creating a target description for one of i386, - amd64, or x32. */ - -struct x86_tdesc_feature { - /* The cpu feature mask. This is a mask against an xcr0 value. */ - uint64_t feature; - - /* Is this feature checked when creating an i386 target description. */ - bool is_i386; - - /* Is this feature checked when creating an amd64 target description. */ - bool is_amd64; - - /* Is this feature checked when creating an x32 target description. */ - bool is_x32; -}; - -/* A constant table that describes all of the cpu features that are - checked when building a target description for i386, amd64, or x32. */ - -static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { - /* Feature, i386, amd64, x32. */ - { X86_XSTATE_PKRU, true, true, true }, - { X86_XSTATE_AVX512, true, true, true }, - { X86_XSTATE_AVX, true, true, true }, - { X86_XSTATE_MPX, true, true, false }, - { X86_XSTATE_SSE, true, false, false }, - { X86_XSTATE_X87, true, false, false } -}; - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an i386 target description. */ - -static constexpr uint64_t -x86_linux_i386_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_i386) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an amd64 target description. */ - -static constexpr uint64_t -x86_linux_amd64_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_amd64) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a mask of all the cpu features - that are checked for when building an x32 target description. */ - -static constexpr uint64_t -x86_linux_x32_tdesc_feature_mask () -{ - uint64_t mask = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_x32) - mask |= entry.feature; - - return mask; -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an i386 target description. */ - -static constexpr int -x86_linux_i386_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_i386) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an amd64 target description. */ - -static constexpr int -x86_linux_amd64_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_amd64) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -/* Return a compile time constant which is a count of the number of cpu - features that are checked for when building an x32 target description. */ - -static constexpr int -x86_linux_x32_tdesc_count () -{ - uint64_t count = 0; - - for (const auto &entry : x86_linux_all_tdesc_features) - if (entry.is_x32) - ++count; - - gdb_assert (count > 0); - - return (1 << count); -} - -#ifdef IN_PROCESS_AGENT - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_amd64_ipa_tdesc_count () -{ - return x86_linux_amd64_tdesc_count (); -} - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_x32_ipa_tdesc_count () -{ - return x86_linux_x32_tdesc_count (); -} - -/* See linux-x86-tdesc.h. */ - -int -x86_linux_i386_ipa_tdesc_count () -{ - return x86_linux_i386_tdesc_count (); -} - -#endif /* IN_PROCESS_AGENT */ - -/* Convert an xcr0 value into an integer. The integer will be passed to - the in-process-agent where it will then be passed to - x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ - -int -x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0) -{ - /* The following table shows which features are checked for when creating - the target descriptions (see nat/x86-linux-tdesc.c), the feature order - represents the bit order within the generated index number. - - i386 | x87 sse mpx avx avx512 pkru - amd64 | mpx avx avx512 pkru - i32 | avx avx512 pkru - - The features are ordered so that for each mode (i386, amd64, i32) the - generated index will form a continuous range. */ - - int idx = 0; - - for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) - { - if ((xcr0 & x86_linux_all_tdesc_features[i].feature) != 0) - idx |= (1 << i); - } - - return idx; -} - - -#ifdef IN_PROCESS_AGENT - -/* 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. */ - -uint64_t -x86_linux_tdesc_idx_to_xcr0 (int idx) -{ - uint64_t xcr0 = 0; - - for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) - { - if ((idx & (1 << i)) != 0) - xcr0 |= x86_linux_all_tdesc_features[i].feature; - } - - return xcr0; -} - -#endif /* IN_PROCESS_AGENT */ - -#if defined __i386__ || !defined IN_PROCESS_AGENT - -/* A cache of all possible i386 target descriptions. */ - -static struct target_desc *i386_tdescs[x86_linux_i386_tdesc_count ()] = { }; - -/* See nat/x86-linux-tdesc.h. */ - -const struct target_desc * -i386_linux_read_description (uint64_t xcr0) -{ - xcr0 &= x86_linux_i386_tdesc_feature_mask (); - int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); - - gdb_assert (idx >= 0 && idx < x86_linux_i386_tdesc_count ()); - - target_desc **tdesc = &i386_tdescs[idx]; - - if (*tdesc == nullptr) - { - *tdesc = i386_create_target_description (xcr0, true, false); - - x86_linux_post_init_tdesc (*tdesc, false); - } - - return *tdesc; -} -#endif - -#ifdef __x86_64__ - -/* A cache of all possible amd64 target descriptions. */ - -static target_desc *amd64_tdescs[x86_linux_amd64_tdesc_count ()] = { }; - -/* A cache of all possible x32 target descriptions. */ - -static target_desc *x32_tdescs[x86_linux_x32_tdesc_count ()] = { }; - -/* See nat/x86-linux-tdesc.h. */ - -const struct target_desc * -amd64_linux_read_description (uint64_t xcr0, bool is_x32) -{ - if (is_x32) - xcr0 &= x86_linux_x32_tdesc_feature_mask (); - else - xcr0 &= x86_linux_amd64_tdesc_feature_mask (); - - int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); - - if (is_x32) - gdb_assert (idx >= 0 && idx < x86_linux_x32_tdesc_count ()); - else - gdb_assert (idx >= 0 && idx < x86_linux_amd64_tdesc_count ()); - - target_desc **tdesc = nullptr; - - if (is_x32) - tdesc = &x32_tdescs[idx]; - else - tdesc = &amd64_tdescs[idx]; - - if (*tdesc == nullptr) - { - *tdesc = amd64_create_target_description (xcr0, is_x32, true, true); - - x86_linux_post_init_tdesc (*tdesc, true); - } - return *tdesc; -} - -#endif diff --git a/gdb/nat/x86-linux-tdesc.h b/gdb/nat/x86-linux-tdesc.h index 648fe0ed0b2..3727a8bf95e 100644 --- a/gdb/nat/x86-linux-tdesc.h +++ b/gdb/nat/x86-linux-tdesc.h @@ -24,8 +24,6 @@ struct target_desc; -#ifndef IN_PROCESS_AGENT - /* Return the target description for Linux thread TID. When *HAVE_PTRACE_GETREGSET is TRIBOOL_UNKNOWN then the current value of @@ -59,57 +57,19 @@ x86_linux_tdesc_for_tid (int tid, enum tribool *have_ptrace_getregset, gdb::function_view<void (uint64_t)> xcr0_init_cb, const char *error_msg, uint64_t *xcr0_storage); -#endif /* !IN_PROCESS_AGENT */ - #ifdef __x86_64__ -/* Return the AMD64 target descriptions corresponding to XCR0 and IS_X32. */ +/* Return the right amd64-linux target descriptions according to + XCR0_FEATURES_BIT and IS_X32. This is implemented separately in both + GDB and gdbserver. */ -extern const target_desc *amd64_linux_read_description (uint64_t xcr0, - bool is_x32); +extern const target_desc *amd64_linux_read_description + (uint64_t xcr0_features_bit, bool is_x32); -#endif /* __x86_64__ */ - -/* Return the i386 target description corresponding to XCR0. */ +#endif +/* Return the target description according to XCR0. This is implemented + separately in both GDB and gdbserver. */ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); -/* This function is called from amd64_linux_read_description and - i386_linux_read_description after a new target description has been - created, TDESC is the new target description, IS_64BIT will be true - when called from amd64_linux_read_description, otherwise IS_64BIT will - be false. If the *_linux_read_description functions found a cached - target description then this function will not be called. - - Both GDB and gdbserver have their own implementations of this - function. */ - -extern void x86_linux_post_init_tdesc (target_desc *tdesc, bool is_64bit); - -/* Convert an xcr0 value into an integer. The integer will be passed to - the in-process-agent where it will then be passed to - x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ - -extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0); - - -#ifdef IN_PROCESS_AGENT - -/* 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. */ - -extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx); - -/* Within the in-process-agent we need to pre-initialise all of the target - descriptions, to do this we need to know how many target descriptions - there are for each different target type. These functions return the - target description count for the relevant target. */ - -extern int x86_linux_amd64_ipa_tdesc_count (); -extern int x86_linux_x32_ipa_tdesc_count (); -extern int x86_linux_i386_ipa_tdesc_count (); - -#endif /* IN_PROCESS_AGENT */ - #endif /* NAT_X86_LINUX_TDESC_H */ diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index bd6f68e7f2c..c7120895a26 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -519,10 +519,6 @@ gdbsupport/%-ipa.o: ../gdbsupport/%.cc $(IPAGENT_COMPILE) $< $(POSTCOMPILE) -nat/%-ipa.o: ../gdb/nat/%.c - $(IPAGENT_COMPILE) $< - $(POSTCOMPILE) - %-ipa.o: ../gdb/%.c $(IPAGENT_COMPILE) -x c++ $< $(POSTCOMPILE) diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 36a457f21ed..7a2702d78bf 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -116,7 +116,6 @@ case "${gdbserver_host}" in srv_linux_btrace=yes ipa_obj="linux-i386-ipa.o linux-x86-tdesc-ipa.o" ipa_obj="${ipa_obj} arch/i386-ipa.o" - ipa_obj="${ipa_obj} nat/x86-linux-tdesc-ipa.o" ;; i[34567]86-*-mingw*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" @@ -381,7 +380,6 @@ case "${gdbserver_host}" in srv_linux_btrace=yes ipa_obj="linux-amd64-ipa.o linux-x86-tdesc-ipa.o" ipa_obj="${ipa_obj} arch/amd64-ipa.o" - ipa_obj="${ipa_obj} nat/x86-linux-tdesc-ipa.o" ;; x86_64-*-mingw*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o" diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc index afa6aab5bab..42de7d2da16 100644 --- a/gdbserver/linux-amd64-ipa.cc +++ b/gdbserver/linux-amd64-ipa.cc @@ -21,6 +21,7 @@ #include "server.h" #include <sys/mman.h> #include "tracepoint.h" +#include "linux-x86-tdesc.h" #include "gdbsupport/x86-xstate.h" #include "nat/x86-linux-tdesc.h" diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc index f6d26f784af..246bcb9813b 100644 --- a/gdbserver/linux-i386-ipa.cc +++ b/gdbserver/linux-i386-ipa.cc @@ -21,6 +21,7 @@ #include "server.h" #include <sys/mman.h> #include "tracepoint.h" +#include "linux-x86-tdesc.h" #include "gdbsupport/x86-xstate.h" #include "nat/x86-linux-tdesc.h" diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 7134d20dd7f..6dbefdb2f26 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -47,6 +47,7 @@ #include "nat/linux-nat.h" #include "nat/x86-linux.h" #include "nat/x86-linux-dregs.h" +#include "linux-x86-tdesc.h" #include "nat/x86-linux-tdesc.h" #ifdef __x86_64__ diff --git a/gdbserver/linux-x86-tdesc.cc b/gdbserver/linux-x86-tdesc.cc index 39d1d51b8c0..87cf368a336 100644 --- a/gdbserver/linux-x86-tdesc.cc +++ b/gdbserver/linux-x86-tdesc.cc @@ -19,19 +19,292 @@ #include "server.h" #include "tdesc.h" +#include "linux-x86-tdesc.h" +#include "arch/i386.h" +#include "gdbsupport/x86-xstate.h" +#ifdef __x86_64__ +#include "arch/amd64.h" +#endif #include "x86-tdesc.h" #include "nat/x86-linux-tdesc.h" +/* A structure used to describe a single cpu feature that might, or might + not, be checked for when creating a target description for one of i386, + amd64, or x32. */ + +struct x86_tdesc_feature { + /* The cpu feature mask. This is a mask against an xcr0 value. */ + uint64_t feature; + + /* Is this feature checked when creating an i386 target description. */ + bool is_i386; + + /* Is this feature checked when creating an amd64 target description. */ + bool is_amd64; + + /* Is this feature checked when creating an x32 target description. */ + bool is_x32; +}; + +/* A constant table that describes all of the cpu features that are + checked when building a target description for i386, amd64, or x32. */ + +static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { + /* Feature, i386, amd64, x32. */ + { X86_XSTATE_PKRU, true, true, true }, + { X86_XSTATE_AVX512, true, true, true }, + { X86_XSTATE_AVX, true, true, true }, + { X86_XSTATE_MPX, true, true, false }, + { X86_XSTATE_SSE, true, false, false }, + { X86_XSTATE_X87, true, false, false } +}; + +/* Return a compile time constant which is a mask of all the cpu features + that are checked for when building an i386 target description. */ + +static constexpr uint64_t +x86_linux_i386_tdesc_feature_mask () +{ + uint64_t mask = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_i386) + mask |= entry.feature; + + return mask; +} + +/* Return a compile time constant which is a mask of all the cpu features + that are checked for when building an amd64 target description. */ + +static constexpr uint64_t +x86_linux_amd64_tdesc_feature_mask () +{ + uint64_t mask = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_amd64) + mask |= entry.feature; + + return mask; +} + +/* Return a compile time constant which is a mask of all the cpu features + that are checked for when building an x32 target description. */ + +static constexpr uint64_t +x86_linux_x32_tdesc_feature_mask () +{ + uint64_t mask = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_x32) + mask |= entry.feature; + + return mask; +} + +/* Return a compile time constant which is a count of the number of cpu + features that are checked for when building an i386 target description. */ + +static constexpr int +x86_linux_i386_tdesc_count () +{ + uint64_t count = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_i386) + ++count; + + gdb_assert (count > 0); + + return (1 << count); +} + +/* Return a compile time constant which is a count of the number of cpu + features that are checked for when building an amd64 target description. */ + +static constexpr int +x86_linux_amd64_tdesc_count () +{ + uint64_t count = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_amd64) + ++count; + + gdb_assert (count > 0); + + return (1 << count); +} + +/* Return a compile time constant which is a count of the number of cpu + features that are checked for when building an x32 target description. */ + +static constexpr int +x86_linux_x32_tdesc_count () +{ + uint64_t count = 0; + + for (const auto &entry : x86_linux_all_tdesc_features) + if (entry.is_x32) + ++count; + + gdb_assert (count > 0); + + return (1 << count); +} + +#ifdef IN_PROCESS_AGENT + +/* See linux-x86-tdesc.h. */ + +int +x86_linux_amd64_ipa_tdesc_count () +{ + return x86_linux_amd64_tdesc_count (); +} + +/* See linux-x86-tdesc.h. */ + +int +x86_linux_x32_ipa_tdesc_count () +{ + return x86_linux_x32_tdesc_count (); +} + +/* See linux-x86-tdesc.h. */ + +int +x86_linux_i386_ipa_tdesc_count () +{ + return x86_linux_i386_tdesc_count (); +} + +#endif /* IN_PROCESS_AGENT */ + +/* Convert an xcr0 value into an integer. The integer will be passed to + the in-process-agent where it will then be passed to + x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ + +int +x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0) +{ + /* The following table shows which features are checked for when creating + the target descriptions (see nat/x86-linux-tdesc.c), the feature order + represents the bit order within the generated index number. + + i386 | x87 sse mpx avx avx512 pkru + amd64 | mpx avx avx512 pkru + i32 | avx avx512 pkru + + The features are ordered so that for each mode (i386, amd64, i32) the + generated index will form a continuous range. */ + + int idx = 0; + + for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) + { + if ((xcr0 & x86_linux_all_tdesc_features[i].feature) != 0) + idx |= (1 << i); + } + + return idx; +} + + +#ifdef IN_PROCESS_AGENT + +/* 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. */ + +uint64_t +x86_linux_tdesc_idx_to_xcr0 (int idx) +{ + uint64_t xcr0 = 0; + + for (int i = 0; i < ARRAY_SIZE (x86_linux_all_tdesc_features); ++i) + { + if ((idx & (1 << i)) != 0) + xcr0 |= x86_linux_all_tdesc_features[i].feature; + } + + return xcr0; +} + +#endif /* IN_PROCESS_AGENT */ + +#if defined __i386__ || !defined IN_PROCESS_AGENT + +/* A cache of all possible i386 target descriptions. */ + +static struct target_desc *i386_tdescs[x86_linux_i386_tdesc_count ()] = { }; + /* See nat/x86-linux-tdesc.h. */ -void -x86_linux_post_init_tdesc (target_desc *tdesc, bool is_64bit) +const struct target_desc * +i386_linux_read_description (uint64_t xcr0) { + xcr0 &= x86_linux_i386_tdesc_feature_mask (); + int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); + + gdb_assert (idx >= 0 && idx < x86_linux_i386_tdesc_count ()); + + target_desc **tdesc = &i386_tdescs[idx]; + + if (*tdesc == nullptr) + { + *tdesc = i386_create_target_description (xcr0, true, false); + + init_target_desc (*tdesc, i386_expedite_regs); + } + + return *tdesc; +} +#endif + #ifdef __x86_64__ - if (is_64bit) - init_target_desc (tdesc, amd64_expedite_regs); + +/* A cache of all possible amd64 target descriptions. */ + +static target_desc *amd64_tdescs[x86_linux_amd64_tdesc_count ()] = { }; + +/* A cache of all possible x32 target descriptions. */ + +static target_desc *x32_tdescs[x86_linux_x32_tdesc_count ()] = { }; + +/* See nat/x86-linux-tdesc.h. */ + +const struct target_desc * +amd64_linux_read_description (uint64_t xcr0, bool is_x32) +{ + if (is_x32) + xcr0 &= x86_linux_x32_tdesc_feature_mask (); else -#endif - init_target_desc (tdesc, i386_expedite_regs); + xcr0 &= x86_linux_amd64_tdesc_feature_mask (); + + int idx = x86_linux_xcr0_to_tdesc_idx (xcr0); + + if (is_x32) + gdb_assert (idx >= 0 && idx < x86_linux_x32_tdesc_count ()); + else + gdb_assert (idx >= 0 && idx < x86_linux_amd64_tdesc_count ()); + + target_desc **tdesc = nullptr; + + if (is_x32) + tdesc = &x32_tdescs[idx]; + else + tdesc = &amd64_tdescs[idx]; + + if (*tdesc == nullptr) + { + *tdesc = amd64_create_target_description (xcr0, is_x32, true, true); + + init_target_desc (*tdesc, amd64_expedite_regs); + } + return *tdesc; } +#endif diff --git a/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h new file mode 100644 index 00000000000..70456e4be44 --- /dev/null +++ b/gdbserver/linux-x86-tdesc.h @@ -0,0 +1,50 @@ +/* Low level support for x86 (i386 and x86-64), shared between gdbserver + and IPA. + + Copyright (C) 2016-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 GDBSERVER_LINUX_X86_TDESC_H +#define GDBSERVER_LINUX_X86_TDESC_H + +/* Convert an xcr0 value into an integer. The integer will be passed to + the in-process-agent where it will then be passed to + x86_linux_tdesc_idx_to_xcr0 to get back the xcr0 value. */ + +extern int x86_linux_xcr0_to_tdesc_idx (uint64_t xcr0); + +#ifdef IN_PROCESS_AGENT + +/* 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. */ + +extern uint64_t x86_linux_tdesc_idx_to_xcr0 (int idx); + +/* Within the in-process-agent we need to pre-initialise all of the target + descriptions, to do this we need to know how many target descriptions + there are for each different target type. These functions return the + target description count for the relevant target. */ + +extern int x86_linux_amd64_ipa_tdesc_count (); +extern int x86_linux_x32_ipa_tdesc_count (); +extern int x86_linux_i386_ipa_tdesc_count (); + + +#endif /* IN_PROCESS_AGENT */ + +#endif /* GDBSERVER_LINUX_X86_TDESC_H */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=57d8b51d901585a07524ece1188b1892b207e950 commit 57d8b51d901585a07524ece1188b1892b207e950 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:52:01 2024 +0000 Revert "gdbserver/Makefile.in: add missing `-x c++`" This reverts commit c7c9820071f8b81a64221f5cfafb3cbfeafe7916. Diff: --- gdbserver/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index 5506701106d..bd6f68e7f2c 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -520,7 +520,7 @@ gdbsupport/%-ipa.o: ../gdbsupport/%.cc $(POSTCOMPILE) nat/%-ipa.o: ../gdb/nat/%.c - $(IPAGENT_COMPILE) -x c++ $< + $(IPAGENT_COMPILE) $< $(POSTCOMPILE) %-ipa.o: ../gdb/%.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c17389078ae2a2a4f6aade6bfbabbf3a41d28f14 commit c17389078ae2a2a4f6aade6bfbabbf3a41d28f14 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:50:58 2024 +0000 Revert "gdb: fix possible uninitialised variable use" This reverts commit 24df37a10f8773ad5db07dc000f694d6405e3a36. Diff: --- gdb/i386-linux-tdep.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 2e84384306d..ed1442236e8 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -700,15 +700,17 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, x86_xsave_layout layout; uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); - if (xcr0 == 0) - { - if (bfd_get_section_by_name (abfd, ".reg-xfp") != nullptr) - xcr0 = X86_XSTATE_SSE_MASK; - else - xcr0 = X86_XSTATE_X87_MASK; - } + const struct target_desc *tdesc; + if (xcr0 != 0) + tdesc = i386_linux_read_description (xcr0); - return i386_linux_read_description (xcr0); + if (tdesc != NULL) + return tdesc; + + if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL) + return i386_linux_read_description (X86_XSTATE_SSE_MASK); + else + return i386_linux_read_description (X86_XSTATE_X87_MASK); } /* Similar to i386_supply_fpregset, but use XSAVE extended state. */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4c48ff3e92ab45de7b8bb9de30fcc6d70669e2ab commit 4c48ff3e92ab45de7b8bb9de30fcc6d70669e2ab Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 18:50:48 2024 +0000 Revert "gdb/gdbserver: fix some defined but unused function warnings" This reverts commit f4c19f89ef43dbce8065532c808e1aeb05d08994. Diff: --- gdb/nat/x86-linux-tdesc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c index 8a02f77fa6a..c438dfae84f 100644 --- a/gdb/nat/x86-linux-tdesc.c +++ b/gdb/nat/x86-linux-tdesc.c @@ -160,8 +160,6 @@ static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { { X86_XSTATE_X87, true, false, false } }; -#if defined __i386__ || !defined IN_PROCESS_AGENT - /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an i386 target description. */ @@ -177,10 +175,6 @@ x86_linux_i386_tdesc_feature_mask () return mask; } -#endif /* __i386__ || !IN_PROCESS_AGENT */ - -#ifdef __x86_64__ - /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an amd64 target description. */ @@ -211,8 +205,6 @@ x86_linux_x32_tdesc_feature_mask () return mask; } -#endif /* __x86_64__ */ - /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an i386 target description. */ @@ -230,8 +222,6 @@ x86_linux_i386_tdesc_count () return (1 << count); } -#if defined __x86_64__ || defined IN_PROCESS_AGENT - /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an amd64 target description. */ @@ -266,8 +256,6 @@ x86_linux_x32_tdesc_count () return (1 << count); } -#endif /* __x86_64__ || IN_PROCESS_AGENT */ - #ifdef IN_PROCESS_AGENT /* See linux-x86-tdesc.h. */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fc36b8d1e074ed13c97c2d3836f5e060781eebeb commit fc36b8d1e074ed13c97c2d3836f5e060781eebeb Author: Tom Tromey <tromey@adacore.com> Date: Tue Mar 26 10:52:00 2024 -0600 Remove redundant check from parse_number.exp A user on irc pointed out that parse_number.exp has a redundant check. This patch removes the duplicate. Diff: --- gdb/testsuite/gdb.base/parse_number.exp | 2 -- 1 file changed, 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/parse_number.exp b/gdb/testsuite/gdb.base/parse_number.exp index 648c34f5bc2..64ce14ccd65 100644 --- a/gdb/testsuite/gdb.base/parse_number.exp +++ b/gdb/testsuite/gdb.base/parse_number.exp @@ -110,8 +110,6 @@ proc parse_number { lang n } { return [list "i64" $n] } elseif { [fits_in_type $n 128 u] } { return [list "i128" $n] - } elseif { [fits_in_type $n 128 u] } { - return [list "i128" $n] } else { # Overflow. return [list $re_overflow $re_overflow]
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eecab42fb33fcb888fbfdbf457a98a2231fd491e commit eecab42fb33fcb888fbfdbf457a98a2231fd491e Author: Tom de Vries <tdevries@suse.de> Date: Tue Mar 26 17:32:09 2024 +0100 [gdb/testsuite] Fix valgrind tests on debian On debian 12, I run into: ... (gdb) target remote | vgdb --wait=2 --max-invoke-ms=2500 --pid=618591^M Remote debugging using | vgdb --wait=2 --max-invoke-ms=2500 --pid=618591^M relaying data between gdb and process 618591^M warning: remote target does not support file transfer, \ attempting to access files from local filesystem.^M Reading symbols from /lib/ld-linux-aarch64.so.1...^M (No debugging symbols found in /lib/ld-linux-aarch64.so.1)^M 0x000000000401a980 in ?? () from /lib/ld-linux-aarch64.so.1^M (gdb) FAIL: gdb.base/valgrind-infcall.exp: target remote for vgdb ... The problem is that we're expecting to match either of these regexps: ... set start_re1 " in \\.?_start " set start_re2 "\\.?_start \\(\\) at " ... but there are no dwarf or elf symbols present. Fix this by also allowing: ... set start_re3 "$::hex in \\?\\? \\(\\) from " ... Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com> Diff: --- gdb/testsuite/lib/valgrind.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/valgrind.exp b/gdb/testsuite/lib/valgrind.exp index 2f2d58844f4..c952e929bae 100644 --- a/gdb/testsuite/lib/valgrind.exp +++ b/gdb/testsuite/lib/valgrind.exp @@ -94,7 +94,8 @@ proc vgdb_start { {active_at_startup 1} } { if { $active_at_startup } { set start_re1 " in \\.?_start " set start_re2 "\\.?_start \\(\\) at " - gdb_test "$vgdbcmd" "($start_re1|$start_re2).*" \ + set start_re3 "$::hex in \\?\\? \\(\\) from " + gdb_test "$vgdbcmd" "($start_re1|$start_re2|$start_re3).*" \ "target remote for vgdb" } else { # Let $binfile run a bit before attaching. This is a bit of a hack,
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=818ef5f4137aaff3afdb52f8bbd3a4c3a9ffa28b commit 818ef5f4137aaff3afdb52f8bbd3a4c3a9ffa28b Author: Tom Tromey <tromey@adacore.com> Date: Tue Feb 13 13:55:34 2024 -0700 Capture warnings when writing to the index cache PR symtab/30837 points out a race that can occur when writing to the index cache: a call to ada_encode can cause a warning, which is forbidden on a worker thread. This patch fixes the problem by arranging to capture any such warnings. This is v2 of the patch. It is rebased on top of some other changes in the same area. v1 was here: https://sourceware.org/pipermail/gdb-patches/2024-February/206595.html Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30837 Diff: --- gdb/dwarf2/cooked-index.c | 18 +++++++++++++----- gdb/dwarf2/cooked-index.h | 9 ++++++--- gdb/dwarf2/read-debug-names.c | 2 +- gdb/dwarf2/read.c | 2 +- gdb/utils.h | 14 +++++++++++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 2a1ca6fd225..f78b00df446 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -581,10 +581,18 @@ cooked_index_worker::set (cooked_state desired_state) /* See cooked-index.h. */ void -cooked_index_worker::write_to_cache (const cooked_index *idx) const +cooked_index_worker::write_to_cache (const cooked_index *idx, + deferred_warnings *warn) const { if (idx != nullptr) - m_cache_store.store (); + { + /* Writing to the index cache may cause a warning to be emitted. + See PR symtab/30837. This arranges to capture all such + warnings. This is safe because we know the deferred_warnings + object isn't in use by any other thread at this point. */ + scoped_restore_warning_hook defer (*warn); + m_cache_store.store (); + } } cooked_index::cooked_index (dwarf2_per_objfile *per_objfile, @@ -623,7 +631,7 @@ cooked_index::wait (cooked_state desired_state, bool allow_quit) } void -cooked_index::set_contents (vec_type &&vec) +cooked_index::set_contents (vec_type &&vec, deferred_warnings *warn) { gdb_assert (m_vector.empty ()); m_vector = std::move (vec); @@ -635,10 +643,10 @@ cooked_index::set_contents (vec_type &&vec) finalization. However, that would take a slot in the global thread pool, and if enough such tasks were submitted at once, it would cause a livelock. */ - gdb::task_group finalizers ([this] () + gdb::task_group finalizers ([=] () { m_state->set (cooked_state::FINALIZED); - m_state->write_to_cache (index_for_writing ()); + m_state->write_to_cache (index_for_writing (), warn); m_state->set (cooked_state::CACHE_DONE); }); diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index e73bd7c73c3..7ff609b9d73 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -494,7 +494,8 @@ protected: void set (cooked_state desired_state); /* Write to the index cache. */ - void write_to_cache (const cooked_index *idx) const; + void write_to_cache (const cooked_index *idx, + deferred_warnings *warn) const; /* Helper function that does the work of reading. This must be able to be run in a worker thread without problems. */ @@ -615,8 +616,10 @@ public: void start_reading (); /* Called by cooked_index_worker to set the contents of this index - and transition to the MAIN_AVAILABLE state. */ - void set_contents (vec_type &&vec); + and transition to the MAIN_AVAILABLE state. WARN is used to + collect any warnings that may arise when writing to the + cache. */ + void set_contents (vec_type &&vec, deferred_warnings *warn); /* A range over a vector of subranges. */ using range = range_chain<cooked_index_shard::range>; diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index 0add8040894..0d60b01f408 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -352,7 +352,7 @@ cooked_index_debug_names::do_reading () cooked_index *table = (gdb::checked_static_cast<cooked_index *> (per_bfd->index_table.get ())); - table->set_contents (std::move (indexes)); + table->set_contents (std::move (indexes), &m_warnings); bfd_thread_cleanup (); } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7442094874c..a747922a4ed 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -4924,7 +4924,7 @@ cooked_index_debug_info::done_reading () cooked_index *table = (gdb::checked_static_cast<cooked_index *> (per_bfd->index_table.get ())); - table->set_contents (std::move (indexes)); + table->set_contents (std::move (indexes), &m_warnings); } void diff --git a/gdb/utils.h b/gdb/utils.h index 2acd1fc4624..d7db1d84e2f 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -21,6 +21,7 @@ #include "exceptions.h" #include "gdbsupport/array-view.h" +#include "gdbsupport/function-view.h" #include "gdbsupport/scoped_restore.h" #include <chrono> @@ -374,7 +375,7 @@ assign_return_if_changed (T &lval, const T &val) } /* A function that can be used to intercept warnings. */ -typedef void (*warning_hook_handler) (const char *, va_list); +typedef gdb::function_view<void (const char *, va_list)> warning_hook_handler; /* Set the thread-local warning hook, and restore the old value when finished. */ @@ -439,6 +440,17 @@ struct deferred_warnings m_warnings.emplace_back (std::move (msg)); } + /* A variant of 'warn' so that this object can be used as a warning + hook; see scoped_restore_warning_hook. Note that no locking is + done, so users have to be careful to only install this into a + single thread at a time. */ + void operator() (const char *format, va_list args) ATTRIBUTE_PRINTF (2, 0) + { + string_file msg (m_can_style); + msg.vprintf (format, args); + m_warnings.emplace_back (std::move (msg)); + } + /* Emit all warnings. */ void emit () const {
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f4c19f89ef43dbce8065532c808e1aeb05d08994 commit f4c19f89ef43dbce8065532c808e1aeb05d08994 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 12:09:27 2024 +0000 gdb/gdbserver: fix some defined but unused function warnings This commit: commit 198ff6ff819c240545f9fc68b39636fd376d4ba9 Date: Tue Jan 30 15:37:23 2024 +0000 gdb/gdbserver: share x86/linux tdesc caching added some functions which are always defined, but their use is guarded within various #ifdef blocks. As a result we were seeing errors about defined, but unused, functions. I've fixed this problem in this commit by wrapping the function definitions within #ifdef blocks. I'm a little worried that there might be too many #ifdef blocks within this file, however, I'm going to commit this fix for now as this will fix the build, then I'll think about if there's a better way to split this file so we might avoid some of these #ifdef blocks. Diff: --- gdb/nat/x86-linux-tdesc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c index c438dfae84f..8a02f77fa6a 100644 --- a/gdb/nat/x86-linux-tdesc.c +++ b/gdb/nat/x86-linux-tdesc.c @@ -160,6 +160,8 @@ static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { { X86_XSTATE_X87, true, false, false } }; +#if defined __i386__ || !defined IN_PROCESS_AGENT + /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an i386 target description. */ @@ -175,6 +177,10 @@ x86_linux_i386_tdesc_feature_mask () return mask; } +#endif /* __i386__ || !IN_PROCESS_AGENT */ + +#ifdef __x86_64__ + /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an amd64 target description. */ @@ -205,6 +211,8 @@ x86_linux_x32_tdesc_feature_mask () return mask; } +#endif /* __x86_64__ */ + /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an i386 target description. */ @@ -222,6 +230,8 @@ x86_linux_i386_tdesc_count () return (1 << count); } +#if defined __x86_64__ || defined IN_PROCESS_AGENT + /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an amd64 target description. */ @@ -256,6 +266,8 @@ x86_linux_x32_tdesc_count () return (1 << count); } +#endif /* __x86_64__ || IN_PROCESS_AGENT */ + #ifdef IN_PROCESS_AGENT /* See linux-x86-tdesc.h. */
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=24df37a10f8773ad5db07dc000f694d6405e3a36 commit 24df37a10f8773ad5db07dc000f694d6405e3a36 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 12:05:07 2024 +0000 gdb: fix possible uninitialised variable use After this commit: commit 198ff6ff819c240545f9fc68b39636fd376d4ba9 Date: Tue Jan 30 15:37:23 2024 +0000 gdb/gdbserver: share x86/linux tdesc caching a possible use of an uninitialised variable was introduced, the 'tdesc' variable in i386_linux_core_read_description might be read without being written too if 'xcr0' was 0. This is fixed in this commit. I've updated the function to follow the same pattern as amd64_linux_core_read_description, if xcr0 is 0 then we select a default xcr0 value and use that to select a tdesc. Diff: --- gdb/i386-linux-tdep.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index ed1442236e8..2e84384306d 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -700,17 +700,15 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, x86_xsave_layout layout; uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); - const struct target_desc *tdesc; - if (xcr0 != 0) - tdesc = i386_linux_read_description (xcr0); - - if (tdesc != NULL) - return tdesc; + if (xcr0 == 0) + { + if (bfd_get_section_by_name (abfd, ".reg-xfp") != nullptr) + xcr0 = X86_XSTATE_SSE_MASK; + else + xcr0 = X86_XSTATE_X87_MASK; + } - if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL) - return i386_linux_read_description (X86_XSTATE_SSE_MASK); - else - return i386_linux_read_description (X86_XSTATE_X87_MASK); + return i386_linux_read_description (xcr0); } /* Similar to i386_supply_fpregset, but use XSAVE extended state. */