mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
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
This commit is contained in:
parent
9b6acc27aa
commit
26aab0dc5d
19
src/node.cc
19
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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user