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

EnableDebug immediatly on SIGUSR1

Don't wait for script to break somewhere, because that may not happen if
execution is inside event-loop, not in v8.

Add '\n' to the end of 'debugger listening...' message
  • Loading branch information...
indutny authored and ry committed Sep 24, 2011
1 parent 9b6acc2 commit 26aab0dc5d324bad1fdd6204b6b29e5eafa168a5
Showing with 5 additions and 14 deletions.
  1. +5 −14 src/node.cc
@@ -2356,32 +2356,23 @@ static void EnableDebug(bool wait_connect) {
assert(r);

// Print out some information.
fprintf(stderr, "debugger listening on port %d", debug_port);
fprintf(stderr, "debugger listening on port %d\n", debug_port);

debugger_running = true;
}


static volatile bool hit_signal;

static void EnableDebugSignalHandler(int signal) {
// Break once process will return execution to v8
v8::Debug::DebugBreak();

static void DebugSignalCB(const Debug::EventDetails& details) {
if (!debugger_running && hit_signal && details.GetEvent() == v8::Break) {
hit_signal = false;
if (!debugger_running) {
fprintf(stderr, "Hit SIGUSR1 - starting debugger agent.\n");
EnableDebug(false);
}
}


static void EnableDebugSignalHandler(int signal) {
// This is signal safe.
hit_signal = true;
v8::Debug::SetDebugEventListener2(DebugSignalCB);
v8::Debug::DebugBreak();
}


#ifdef __POSIX__

static int RegisterSignalHandler(int signal, void (*handler)(int)) {

0 comments on commit 26aab0d

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