hppa-tdep.h \
i386-bsd-nat.h \
i386-darwin-tdep.h \
- i386-linux-nat.h \
i386-linux-tdep.h \
i386-tdep.h \
i387-tdep.h \
nat/gdb_ptrace.h \
nat/gdb_thread_db.h \
nat/fork-inferior.h \
+ nat/i386-linux.h \
nat/linux-btrace.h \
nat/linux-namespaces.h \
nat/linux-nat.h \
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.o nat/x86-linux-dregs.o nat/i386-linux.o"
;;
ia64)
# Host: Intel IA-64 running GNU/Linux
#include "gregset.h"
#include "gdb_proc_service.h"
-#include "i386-linux-nat.h"
+#include "nat/i386-linux.h"
#include "i387-tdep.h"
#include "i386-tdep.h"
#include "i386-linux-tdep.h"
0
#endif
;
-
-/* 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.
-
- My instinct is to attach this to some architecture- or
- target-specific data structure, but really, a particular GDB
- process can only run on top of one kernel at a time. So it's okay
- for this to be a simple variable. */
-int have_ptrace_getfpxregs =
-#ifdef HAVE_PTRACE_GETFPXREGS
- -1
-#else
- 0
-#endif
-;
\f
/* Accessing registers through the U area, one at a time. */
{
elf_fpxregset_t fpxregs;
- if (! have_ptrace_getfpxregs)
+ if (have_ptrace_getfpxregs == TRIBOOL_FALSE)
return 0;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
{
if (errno == EIO)
{
- have_ptrace_getfpxregs = 0;
+ have_ptrace_getfpxregs = TRIBOOL_FALSE;
return 0;
}
{
elf_fpxregset_t fpxregs;
- if (! have_ptrace_getfpxregs)
+ if (have_ptrace_getfpxregs == TRIBOOL_FALSE)
return 0;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, &fpxregs) == -1)
{
if (errno == EIO)
{
- have_ptrace_getfpxregs = 0;
+ have_ptrace_getfpxregs = TRIBOOL_FALSE;
return 0;
}
/* Native-dependent code for GNU/Linux i386.
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
+ Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of GDB.
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 I386_LINUX_NAT_H
-#define I386_LINUX_NAT_H 1
-
-/* Does the current host support the GETFPXREGS request? */
-extern int have_ptrace_getfpxregs;
+#include "nat/i386-linux.h"
+/* See nat/i386-linux.h. */
+tribool have_ptrace_getfpxregs =
+#ifdef HAVE_PTRACE_GETFPXREGS
+ TRIBOOL_UNKNOWN
+#else
+ TRIBOOL_FALSE
#endif
+;
--- /dev/null
+/* Native-dependent code for GNU/Linux i386.
+
+ 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_I386_LINUX_H
+#define NAT_I386_LINUX_H
+
+/* Does the current host support the GETFPXREGS request? The system header
+ file may or may not define it, but even if it is defined, the kernel
+ will return EIO if it's running on a pre-SSE processor.
+
+ Initially this will be TRIBOOL_UNKNOWN and should be changed to
+ TRIBOOL_FALSE if the ptrace call is attempted and fails or changed to
+ TRIBOOL_TRUE if the ptrace call is attempted and succeeds.
+
+ My instinct is to attach this to some architecture- or target-specific
+ data structure, but really, a particular GDB process can only run on top
+ of one kernel at a time. So it's okay - for this to be a global
+ variable. */
+extern tribool have_ptrace_getfpxregs;
+
+#endif /* NAT_I386_LINUX_H */
#include "x86-nat.h"
#ifndef __x86_64__
-#include "i386-linux-nat.h"
+#include "nat/i386-linux.h"
#endif
#include "x86-linux-nat.h"
#include "i386-linux-tdep.h"
error (_("Can't debug 64-bit process with 32-bit GDB"));
}
#elif HAVE_PTRACE_GETFPXREGS
- if (have_ptrace_getfpxregs == -1)
+ if (have_ptrace_getfpxregs == TRIBOOL_UNKNOWN)
{
elf_fpxregset_t fpxregs;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
{
- have_ptrace_getfpxregs = 0;
+ have_ptrace_getfpxregs = TRIBOOL_FALSE;
have_ptrace_getregset = TRIBOOL_FALSE;
return i386_linux_read_description (X86_XSTATE_X87_MASK);
}
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/i386-linux.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
#ifdef __x86_64__
#include "nat/amd64-linux-siginfo.h"
+#else
+#include "nat/i386-linux.h"
#endif
#include "gdb_proc_service.h"
\f
static int use_xml;
-/* 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. */
-int have_ptrace_getfpxregs =
-#ifdef HAVE_PTRACE_GETFPXREGS
- -1
-#else
- 0
-#endif
-;
-
/* Get Linux/x86 target description from running target. */
static const struct target_desc *
}
#if !defined __x86_64__ && defined HAVE_PTRACE_GETFPXREGS
- if (machine == EM_386 && have_ptrace_getfpxregs == -1)
+ if (machine == EM_386 && have_ptrace_getfpxregs == TRIBOOL_UNKNOWN)
{
elf_fpxregset_t fpxregs;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (long) &fpxregs) < 0)
{
- have_ptrace_getfpxregs = 0;
+ have_ptrace_getfpxregs = TRIBOOL_FALSE;
have_ptrace_getregset = TRIBOOL_FALSE;
return i386_linux_read_description (X86_XSTATE_X87);
}
else
- have_ptrace_getfpxregs = 1;
+ have_ptrace_getfpxregs = TRIBOOL_TRUE;
}
#endif