summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/exceptions.cc14
-rw-r--r--winsup/cygwin/winsup.h2
2 files changed, 9 insertions, 7 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index bb7704f94..c98b92d30 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -461,10 +461,8 @@ cygwin_stackdump ()
exc.dumpstack ();
}
-#define TIME_TO_WAIT_FOR_DEBUGGER 10000
-
extern "C" int
-try_to_debug (bool waitloop)
+try_to_debug ()
{
if (!debugger_command)
return 0;
@@ -532,13 +530,17 @@ try_to_debug (bool waitloop)
&si,
&pi);
+ /* We want to stop here and wait until the error_start process attaches. But
+ we can't wait here for the error_start process to exit, as if it's a
+ debugger, it might want to continue this thread. So we busy wait until a
+ debugger attaches, which stops this process, after which it can decide if
+ we continue or not. */
+
*dbg_end = L'\0';
if (!dbg)
system_printf ("Failed to start debugger, %E");
else
{
- if (!waitloop)
- return dbg;
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
while (!being_debugged ())
Sleep (1);
@@ -812,7 +814,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
if (exit_state >= ES_SIGNAL_EXIT
&& (NTSTATUS) e->ExceptionCode != STATUS_CONTROL_C_EXIT)
api_fatal ("Exception during process exit");
- else if (!try_to_debug (0))
+ else if (!try_to_debug ())
rtl_unwind (frame, e);
else
{
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 79844cb87..0ffd8c5af 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -190,7 +190,7 @@ void close_all_files (bool = false);
/* debug_on_trap support. see exceptions.cc:try_to_debug() */
extern "C" void error_start_init (const char*);
-extern "C" int try_to_debug (bool waitloop = 1);
+extern "C" int try_to_debug ();
void ld_preload ();
void fixup_hooks_after_fork ();