Skip to content

Instantly share code, notes, and snippets.

@deepak1556
Created April 15, 2015 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepak1556/9d98a181735ecf8d7366 to your computer and use it in GitHub Desktop.
Save deepak1556/9d98a181735ecf8d7366 to your computer and use it in GitHub Desktop.
Exposing startdebug, use_debug_agent and debug_wait_connect
commit a90c4c4e8ec298823a5421bca96a102f78971515
Author: Robo <hop2deep@gmail.com>
Date: Tue Apr 14 07:47:25 2015 +0530
Exposing startdebug, use_debug_agent and debug_wait_connect
diff --git a/src/node.cc b/src/node.cc
index aa0af85..5f8dc07 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -119,8 +119,6 @@ static bool abort_on_uncaught_exception = false;
static const char* eval_string = nullptr;
static unsigned int preload_module_count = 0;
static const char** preload_modules = nullptr;
-static bool use_debug_agent = false;
-static bool debug_wait_connect = false;
static int debug_port = 5858;
static bool v8_is_profiling = false;
static bool node_is_initialized = false;
@@ -129,6 +127,10 @@ static node_module* modlist_builtin;
static node_module* modlist_linked;
static node_module* modlist_addon;
+// Exposed for use from atom::NodeMain.
+bool use_debug_agent = false;
+bool debug_wait_connect = false;
+
#if defined(NODE_HAVE_I18N_SUPPORT)
// Path to ICU data (for i18n / Intl)
static const char* icu_data_dir = nullptr;
@@ -3200,8 +3202,8 @@ static void DispatchMessagesDebugAgentCallback(Environment* env) {
uv_async_send(&dispatch_debug_messages_async);
}
-
-static void StartDebug(Environment* env, bool wait) {
+// Called from atom::NodeMain.
+void StartDebug(Environment* env, bool wait) {
CHECK(!debugger_running);
env->debugger_agent()->set_dispatch_handler(
diff --git a/src/node.h b/src/node.h
index 03db051..7ab6999 100644
--- a/src/node.h
+++ b/src/node.h
@@ -151,6 +151,8 @@ typedef intptr_t ssize_t;
namespace node {
NODE_EXTERN extern bool no_deprecation;
+NODE_EXTERN extern bool use_debug_agent;
+NODE_EXTERN extern bool debug_wait_connect;
NODE_EXTERN int Start(int argc, char *argv[]);
NODE_EXTERN void Init(int* argc,
@@ -184,6 +186,8 @@ NODE_EXTERN void EmitBeforeExit(Environment* env);
NODE_EXTERN int EmitExit(Environment* env);
NODE_EXTERN void RunAtExit(Environment* env);
+NODE_EXTERN void StartDebug(Environment* env, bool wait);
+
/* Converts a unixtime to V8 Date */
#define NODE_UNIXTIME_V8(t) v8::Date::New(v8::Isolate::GetCurrent(), \
1000 * static_cast<double>(t))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment