/* 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; } } }