* exceptions.cc (try_to_debug): Prevent recursive spawning of JIT debugger.

Treat special event from debugger as command to continue.
This commit is contained in:
Christopher Faylor 2000-07-04 19:07:35 +00:00
parent 0106a9b755
commit 1d613351e5
2 changed files with 64 additions and 29 deletions

View File

@ -1,8 +1,13 @@
2000-07-04 Vadim Egorov <egorovv@mailandnews.com>
* exceptions.cc (try_to_debug): Prevent recursive spawning of JIT
debugger. Treat special event from debugger as command to continue.
Mon Jul 4 19:29:00 2000 Corinna Vinschen <corinna@vinschen.de> Mon Jul 4 19:29:00 2000 Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Zero out `open_fds' as well. * poll.cc (poll): Zero out `open_fds' as well.
Mon Jul 4 19:22:00 2000 Corinna Vinschen <corinna@vinschen.de> Mon Jul 4 1:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Bump API minor version to 24. * include/cygwin/version.h: Bump API minor version to 24.

View File

@ -287,6 +287,8 @@ cygwin_stackdump()
static int NO_COPY keep_looping = 0; static int NO_COPY keep_looping = 0;
#define TIME_TO_WAIT_FOR_DEBUGGER 10000
extern "C" int extern "C" int
try_to_debug () try_to_debug ()
{ {
@ -316,6 +318,21 @@ try_to_debug ()
ReleaseMutex (pinfo_mutex); ReleaseMutex (pinfo_mutex);
ReleaseMutex (title_mutex); ReleaseMutex (title_mutex);
/* prevent recursive exception handling */
char* rawenv = GetEnvironmentStrings () ;
for (char* p = rawenv; *p != '\0'; p = strchr (p, '\0') + 1)
{
if (strncmp (p, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
{
system_printf ("%s", p);
char* q = strstr (p, "error_start") ;
/* replace 'error_start=...' with '_rror_start=...' */
if (q) *q = '_' ;
SetEnvironmentVariable ("CYGWIN", p + sizeof ("CYGWIN=")) ;
break ;
}
}
dbg = CreateProcess (NULL, dbg = CreateProcess (NULL,
debugger_command, debugger_command,
NULL, NULL,
@ -335,9 +352,22 @@ try_to_debug ()
} }
else else
{ {
char event_name [ sizeof ("cygwin_error_start_event") + 9 ];
DWORD win32_pid = GetCurrentProcessId ();
__small_sprintf (event_name, "cygwin_error_start_event%x", win32_pid);
HANDLE sync_with_dbg = CreateEvent (NULL, TRUE, FALSE, event_name);
keep_looping = 1; keep_looping = 1;
while (keep_looping) while (keep_looping)
Sleep (10000); {
if (sync_with_dbg == NULL)
Sleep (TIME_TO_WAIT_FOR_DEBUGGER);
else
{
if (WaitForSingleObject (sync_with_dbg,
TIME_TO_WAIT_FOR_DEBUGGER) == WAIT_OBJECT_0)
break;
}
}
} }
return 0; return 0;