/* Fetch register(s) from the current thread context. */ static void child_fetch_inferior_registers (struct regcache *regcache, int r) { int regno; win32_thread_info *th = thread_rec (current_inferior_ptid (), TRUE); if (r == -1 || r > NUM_REGS) child_fetch_inferior_registers (regcache, NUM_REGS); else for (regno = 0; regno < r; regno++) (*the_low_target.fetch_inferior_register) (regcache, th, regno); }
static void child_fetch_inferior_registers (int r) { if (r < 0) { for (r = 0; r < NUM_REGS; r++) child_fetch_inferior_registers (r); } else { supply_register (r, 0); } }
/* Wait for the inferior process to change state. STATUS will be filled in with a response code to send to GDB. Returns the signal which caused the process to stop. */ static ptid_t win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) { struct regcache *regcache; while (1) { if (!get_child_debug_event (ourstatus)) continue; switch (ourstatus->kind) { case TARGET_WAITKIND_EXITED: OUTMSG2 (("Child exited with retcode = %x\n", ourstatus->value.integer)); win32_clear_inferiors (); return pid_to_ptid (current_event.dwProcessId); case TARGET_WAITKIND_STOPPED: case TARGET_WAITKIND_LOADED: OUTMSG2 (("Child Stopped with signal = %d \n", ourstatus->value.sig)); regcache = get_thread_regcache (current_inferior, 1); child_fetch_inferior_registers (regcache, -1); if (ourstatus->kind == TARGET_WAITKIND_LOADED && !server_waiting) { /* When gdb connects, we want to be stopped at the initial breakpoint, not in some dll load event. */ child_continue (DBG_CONTINUE, -1); break; } /* We don't expose _LOADED events to gdbserver core. See the `dlls_changed' global. */ if (ourstatus->kind == TARGET_WAITKIND_LOADED) ourstatus->kind = TARGET_WAITKIND_STOPPED; return debug_event_ptid (¤t_event); default: OUTMSG (("Ignoring unknown internal event, %d\n", ourstatus->kind)); /* fall-through */ case TARGET_WAITKIND_SPURIOUS: case TARGET_WAITKIND_EXECD: /* do nothing, just continue */ child_continue (DBG_CONTINUE, -1); break; } } }
/* Wait for the inferior process to change state. STATUS will be filled in with a response code to send to GDB. Returns the signal which caused the process to stop. */ static unsigned char win32_wait (char *status) { struct target_waitstatus our_status; *status = 'T'; while (1) { if (!get_child_debug_event (&our_status)) continue; switch (our_status.kind) { case TARGET_WAITKIND_EXITED: OUTMSG2 (("Child exited with retcode = %x\n", our_status.value.integer)); *status = 'W'; win32_clear_inferiors (); return our_status.value.integer; case TARGET_WAITKIND_STOPPED: case TARGET_WAITKIND_LOADED: OUTMSG2 (("Child Stopped with signal = %d \n", our_status.value.sig)); *status = 'T'; child_fetch_inferior_registers (-1); if (our_status.kind == TARGET_WAITKIND_LOADED && !server_waiting) { /* When gdb connects, we want to be stopped at the initial breakpoint, not in some dll load event. */ child_continue (DBG_CONTINUE, -1); break; } return our_status.value.sig; default: OUTMSG (("Ignoring unknown internal event, %d\n", our_status.kind)); /* fall-through */ case TARGET_WAITKIND_SPURIOUS: case TARGET_WAITKIND_EXECD: /* do nothing, just continue */ child_continue (DBG_CONTINUE, -1); break; } } }
/* Wait for the inferior process to change state. STATUS will be filled in with a response code to send to GDB. Returns the signal which caused the process to stop. */ static ptid_t win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options) { struct regcache *regcache; if (cached_status.kind != TARGET_WAITKIND_IGNORE) { /* The core always does a wait after creating the inferior, and do_initial_child_stuff already ran the inferior to the initial breakpoint (or an exit, if creating the process fails). Report it now. */ *ourstatus = cached_status; cached_status.kind = TARGET_WAITKIND_IGNORE; return debug_event_ptid (¤t_event); } while (1) { if (!get_child_debug_event (ourstatus)) continue; switch (ourstatus->kind) { case TARGET_WAITKIND_EXITED: OUTMSG2 (("Child exited with retcode = %x\n", ourstatus->value.integer)); win32_clear_inferiors (); return pid_to_ptid (current_event.dwProcessId); case TARGET_WAITKIND_STOPPED: case TARGET_WAITKIND_LOADED: OUTMSG2 (("Child Stopped with signal = %d \n", ourstatus->value.sig)); regcache = get_thread_regcache (current_thread, 1); child_fetch_inferior_registers (regcache, -1); return debug_event_ptid (¤t_event); default: OUTMSG (("Ignoring unknown internal event, %d\n", ourstatus->kind)); /* fall-through */ case TARGET_WAITKIND_SPURIOUS: case TARGET_WAITKIND_EXECD: /* do nothing, just continue */ child_continue (DBG_CONTINUE, -1); break; } } }
/* Fetch registers from the inferior process. If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO. */ static void win32_fetch_inferior_registers (struct regcache *regcache, int regno) { child_fetch_inferior_registers (regcache, regno); }
/* Fetch registers from the inferior process. If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO. */ static void win32_fetch_inferior_registers (int regno) { child_fetch_inferior_registers (regno); }