#include "inferior.h"
#include "elf/common.h"
#include "gdb_proc_service.h"
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <sys/user.h>
#include <sys/procfs.h>
#include <sys/uio.h>
#include "nat/linux-nat.h"
#include "nat/x86-linux.h"
#include "nat/x86-linux-dregs.h"
+#include "nat/linux-ptrace.h"
/* Per-thread arch-specific data we want to keep. */
int debug_registers_changed;
};
-/* Does the current host support PTRACE_GETREGSET? */
-int have_ptrace_getregset = -1;
-
-/* Called prior to resuming a thread. */
-
-static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
-{
- x86_linux_update_debug_registers (lwp);
-}
-
-/* Called when a new thread is detected. */
-
-static void
-x86_linux_new_thread (struct lwp_info *lwp)
-{
- lwp_set_debug_registers_changed (lwp, 1);
-}
\f
/* linux_nat_new_fork hook. */
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
{
have_ptrace_getfpxregs = 0;
- have_ptrace_getregset = 0;
+ have_ptrace_getregset = TRIBOOL_FALSE;
return tdesc_i386_mmx_linux;
}
}
#endif
- if (have_ptrace_getregset == -1)
+ if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
{
uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))];
struct iovec iov;
/* Check if PTRACE_GETREGSET works. */
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, &iov) < 0)
- have_ptrace_getregset = 0;
+ have_ptrace_getregset = TRIBOOL_FALSE;
else
{
- have_ptrace_getregset = 1;
+ have_ptrace_getregset = TRIBOOL_TRUE;
/* Get XCR0 from XSAVE extended state. */
xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
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)
+ if (have_ptrace_getregset == TRIBOOL_TRUE)
xcr0_features_bits = xcr0 & X86_XSTATE_ALL_MASK;
else
xcr0_features_bits = 0;
error (_("Could not enable branch tracing for %s: %s."),
target_pid_to_str (ptid), safe_strerror (errno));
- /* Fill in the size of a pointer in bits. */
- if (tinfo->ptr_bits == 0)
- {
- gdbarch = target_thread_architecture (ptid);
- tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch);
- }
return tinfo;
}
}
\f
+/* to_always_non_stop_p implementation. */
+
+static int
+x86_linux_always_non_stop_p (struct target_ops *self)
+{
+ /* Enabling this breaks the btrace target. */
+ return 0;
+}
+
/* Create an x86 GNU/Linux target. */
struct target_ops *
t->to_read_btrace = x86_linux_read_btrace;
t->to_btrace_conf = x86_linux_btrace_conf;
+ t->to_always_non_stop_p = x86_linux_always_non_stop_p;
+
return t;
}