24 #include <mach_error.h> 25 #include <mach/message.h> 26 #include <mach/exception.h> 32 #include "floatformat.h" 42 #define REG_OFFSET(reg) offsetof (struct i386_thread_state, reg) 54 #define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum]) 63 mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
64 struct i386_float_state state;
67 err = thread_get_state (thread->
port, i386_FLOAT_STATE,
68 (thread_state_t) &state, &count);
71 warning (
_(
"Couldn't fetch floating-point state from %s"),
76 if (!state.initialized)
101 error (
_(
"Can't fetch registers from thread %s: No such thread"),
106 thread_state_t
state;
112 warning (
_(
"Couldn't fetch registers from %s"),
141 proc_debug (thread,
"fetching floating-point registers");
153 mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
154 struct i386_float_state state;
157 err = thread_get_state (thread->
port, i386_FLOAT_STATE,
158 (thread_state_t) &state, &count);
161 warning (
_(
"Couldn't fetch floating-point state from %s"),
170 err = thread_set_state (thread->
port, i386_FLOAT_STATE,
171 (thread_state_t) &state, i386_FLOAT_STATE_COUNT);
174 warning (
_(
"Couldn't store floating-point state into %s"),
194 error (
_(
"Couldn't store registers into thread %s: No such thread"),
199 thread_state_t state;
200 thread_state_data_t old_state;
201 int was_aborted = thread->
aborted;
205 if (!was_aborted && was_valid)
206 memcpy (&old_state, &thread->
state, sizeof (old_state));
211 warning (
_(
"Couldn't store registers into %s"),
218 trace = ((
struct i386_thread_state *)state)->efl & 0x100;
220 if (!was_aborted && was_valid)
225 for (check_regno = 0; check_regno <
I386_NUM_GREGS; check_regno++)
227 && memcpy (
REG_ADDR (&old_state, check_regno),
232 warning (
_(
"Register %s changed after the thread was aborted"),
234 if (regno >= 0 && regno != check_regno)
239 warning (
_(
"... also writing this register! " 264 ((
struct i386_thread_state *)state)->efl &= ~0x100;
265 ((
struct i386_thread_state *)state)->efl |= trace;
270 proc_debug (thread,
"storing floating-point registers");
279 #ifdef i386_DEBUG_STATE 283 i386_gnu_dr_get (
struct i386_debug_state *regs,
struct proc *thread)
285 mach_msg_type_number_t count = i386_DEBUG_STATE_COUNT;
288 err = thread_get_state (thread->
port, i386_DEBUG_STATE,
289 (thread_state_t) regs, &count);
290 if (
err != 0 || count != i386_DEBUG_STATE_COUNT)
291 warning (
_(
"Couldn't fetch debug state from %s"),
298 i386_gnu_dr_set (
const struct i386_debug_state *regs,
struct proc *thread)
302 err = thread_set_state (thread->
port, i386_DEBUG_STATE,
303 (thread_state_t) regs, i386_DEBUG_STATE_COUNT);
305 warning (
_(
"Couldn't store debug state into %s"),
312 i386_gnu_dr_set_control_one (
struct proc *thread,
void *arg)
314 unsigned long *control = (
unsigned long *) arg;
315 struct i386_debug_state regs;
317 i386_gnu_dr_get (®s, thread);
319 i386_gnu_dr_set (®s, thread);
325 i386_gnu_dr_set_control (
unsigned long control)
342 i386_gnu_dr_set_addr_one (
struct proc *thread,
void *arg)
344 struct reg_addr *reg_addr = (
struct reg_addr *) arg;
345 struct i386_debug_state regs;
347 i386_gnu_dr_get (®s, thread);
348 regs.dr[reg_addr->regnum] = reg_addr->addr;
349 i386_gnu_dr_set (®s, thread);
357 struct reg_addr reg_addr;
362 reg_addr.addr = addr;
373 struct i386_debug_state regs;
380 i386_gnu_dr_get (®s, thread);
388 i386_gnu_dr_get_addr (
int regnum)
398 i386_gnu_dr_get_status (
void)
406 i386_gnu_dr_get_control (
void)
420 #ifdef i386_DEBUG_STATE mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
void add_target(struct target_ops *t)
void i387_collect_fsave(const struct regcache *regcache, int regnum, void *fsave)
char * proc_string(struct proc *proc)
void warning(const char *fmt,...)
unsigned long fetched_regs
ptid_t regcache_get_ptid(const struct regcache *regcache)
static void fetch_fpregs(struct regcache *regcache, struct proc *thread)
void inf_threads(struct inf *inf, inf_threads_ftype *f, void *arg)
void i387_supply_fsave(struct regcache *regcache, int regnum, const void *fsave)
void(* set_control)(unsigned long)
struct x86_dr_low_type x86_dr_low
CORE_ADDR(* get_addr)(int)
static void gnu_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regno)
void(* set_addr)(int, CORE_ADDR)
unsigned long(* get_status)(void)
thread_state_data_t state
struct target_ops * gnu_target(void)
#define REG_ADDR(state, regnum)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
long ptid_get_lwp(const ptid_t &ptid)
unsigned long(* get_control)(void)
int inf_update_procs(struct inf *inf)
static void gnu_store_registers(struct target_ops *ops, struct regcache *regcache, int regno)
struct inf * gnu_current_inf
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
enum register_status regcache_register_status(const struct regcache *regcache, int regnum)
const char * target_pid_to_str(ptid_t ptid)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
void x86_set_debug_register_length(int len)
int register_size(struct gdbarch *gdbarch, int regnum)
void _initialize_i386gnu_nat(void)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
void x86_use_watchpoints(struct target_ops *t)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
thread_state_t proc_get_state(struct proc *proc, int will_modify)
void error(const char *fmt,...)
static void store_fpregs(const struct regcache *regcache, struct proc *thread, int regno)
struct proc * inf_tid_to_thread(struct inf *inf, int tid)
#define proc_debug(_proc, msg, args...)