import gdb-19990422 snapshot

This commit is contained in:
Stan Shebs 1999-04-26 18:25:51 +00:00
parent 3dd8d9225d
commit 0714f9bfa3

View file

@ -50,6 +50,17 @@
#include <sys/param.h>
#include <unistd.h>
/* The ui's event loop. */
extern int (*ui_loop_hook) PARAMS ((int signo));
/* If we're not using the old Cygwin header file set, define the
following which never should have been in the generic Win32 API
headers in the first place since they were our own invention... */
#ifndef _GNU_H_WINDOWS_H
#define FLAG_TRACE_BIT 0x100
#define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
#endif
/* The string sent by cygwin when it processes a signal.
FIXME: This should be in a cygwin include file. */
#define CYGWIN_SIGNAL_STRING "cygwin: signal"
@ -65,6 +76,7 @@ extern struct target_ops child_ops;
static void child_stop PARAMS ((void));
static int win32_child_thread_alive PARAMS ((int));
void child_kill_inferior PARAMS ((void));
static int last_sig = 0; /* Set if a signal was received from the
debugged process */
@ -453,7 +465,9 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
{
char *p;
/*last_sig = */strtol(s + sizeof(CYGWIN_SIGNAL_STRING) - 1, &p, 0);
if (gotasig = (ourstatus->value.sig = target_signal_from_host (last_sig)))
gotasig = target_signal_from_host (last_sig);
ourstatus->value.sig = gotasig;
if (gotasig)
ourstatus->kind = TARGET_WAITKIND_STOPPED;
}
@ -530,9 +544,10 @@ child_continue (DWORD continue_status, int id)
DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=%d, DBG_CONTINUE);\n",
current_event.dwProcessId, current_event.dwThreadId));
if (res = ContinueDebugEvent (current_event.dwProcessId,
res = ContinueDebugEvent (current_event.dwProcessId,
current_event.dwThreadId,
continue_status))
continue_status);
if (res)
for (th = &thread_head; (th = th->next) != NULL; )
if (((id == -1) || (id == th->id)) && th->suspend_count)
{
@ -556,11 +571,13 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
while (1)
{
DWORD continue_status;
BOOL t = WaitForDebugEvent (&current_event, INFINITE);
BOOL debug_event = WaitForDebugEvent (&current_event, 20);
char *p;
thread_info *th;
int sig;
if (debug_event)
{
event_count++;
continue_status = DBG_CONTINUE;
@ -649,6 +666,17 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
CHECK (child_continue (continue_status, -1));
}
else
{
int detach = 0;
if (ui_loop_hook != NULL)
detach = ui_loop_hook (0);
if (detach)
child_kill_inferior ();
}
}
}
/* Attach to process PID, then initialize for debugging it. */