Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Ctrl+Break on windows starts debugger server

  • Loading branch information...
indutny authored and ry committed Sep 24, 2011
1 parent 26aab0d commit 82d0ac7ac783e3532fa3f0a833be4721907e0ada
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/node.cc
@@ -2362,6 +2362,7 @@ static void EnableDebug(bool wait_connect) {
}


#ifdef __POSIX__
static void EnableDebugSignalHandler(int signal) {
// Break once process will return execution to v8
v8::Debug::DebugBreak();
@@ -2371,6 +2372,23 @@ static void EnableDebugSignalHandler(int signal) {
EnableDebug(false);
}
}
#endif // __POSIX__

#if defined(__MINGW32__) || defined(_MSC_VER)
static bool EnableDebugSignalHandler(DWORD signal) {
if (signal != CTRL_BREAK_EVENT) return false;

// Break once process will return execution to v8
v8::Debug::DebugBreak();

if (!debugger_running) {
fprintf(stderr, "Hit Ctrl+Break - starting debugger agent.\n");
EnableDebug(false);
}

return true;
}
#endif


#ifdef __POSIX__
@@ -2474,6 +2492,9 @@ char** Init(int argc, char *argv[]) {
#ifdef __POSIX__
RegisterSignalHandler(SIGUSR1, EnableDebugSignalHandler);
#endif // __POSIX__
#if defined(__MINGW32__) || defined(_MSC_VER)
SetConsoleCtrlHandler((PHANDLER_ROUTINE) EnableDebugSignalHandler, TRUE);
#endif
}

return argv;

0 comments on commit 82d0ac7

Please sign in to comment.
You can’t perform that action at this time.