int have_ptrace_getregset = -1;
\f
+/* Return the offset of REGNUM in the u_debugreg field of struct
+ user. */
+
+static int
+u_debugreg_offset (int regnum)
+{
+ return (offsetof (struct user, u_debugreg)
+ + sizeof (((struct user *) 0)->u_debugreg[0]) * regnum);
+}
+
/* Support for debug registers. */
/* Get debug register REGNUM value from only the one LWP of PTID. */
tid = ptid_get_lwp (ptid);
errno = 0;
- value = ptrace (PTRACE_PEEKUSER, tid,
- offsetof (struct user, u_debugreg[regnum]), 0);
+ value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
+
if (errno != 0)
perror_with_name (_("Couldn't read debug register"));
tid = ptid_get_lwp (ptid);
errno = 0;
- ptrace (PTRACE_POKEUSER, tid,
- offsetof (struct user, u_debugreg[regnum]), value);
+ ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
if (errno != 0)
perror_with_name (_("Couldn't write debug register"));
}
lwp->arch_private->debug_registers_changed = 0;
}
- if (clear_status || lwp->stop_reason == LWP_STOPPED_BY_WATCHPOINT)
+ if (clear_status || lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
x86_linux_dr_set (lwp->ptid, DR_STATUS, 0);
}
/* Enable branch tracing. */
static struct btrace_target_info *
-x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid)
+x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid,
+ const struct btrace_config *conf)
{
struct btrace_target_info *tinfo;
struct gdbarch *gdbarch;
errno = 0;
- tinfo = linux_enable_btrace (ptid);
+ tinfo = linux_enable_btrace (ptid, conf);
if (tinfo == NULL)
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. */
- gdbarch = target_thread_architecture (ptid);
- tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch);
-
+ if (tinfo->ptr_bits == 0)
+ {
+ gdbarch = target_thread_architecture (ptid);
+ tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch);
+ }
return tinfo;
}
{
return linux_read_btrace (data, btinfo, type);
}
+
+/* See to_btrace_conf in target.h. */
+
+static const struct btrace_config *
+x86_linux_btrace_conf (struct target_ops *self,
+ const struct btrace_target_info *btinfo)
+{
+ return linux_btrace_conf (btinfo);
+}
+
\f
/* Helper for ps_get_thread_area. Sets BASE_ADDR to a pointer to
t->to_disable_btrace = x86_linux_disable_btrace;
t->to_teardown_btrace = x86_linux_teardown_btrace;
t->to_read_btrace = x86_linux_read_btrace;
+ t->to_btrace_conf = x86_linux_btrace_conf;
return t;
}