src: move debug agent from deps/ to src/
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 3 Nov 2014 11:03:34 +0000 (12:03 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 3 Nov 2014 11:08:04 +0000 (12:08 +0100)
There is not much point in keeping it a separate project because it
doesn't build standalone, plus it makes applying changes to core more
difficult because of the implicit dependency on header files in src/.

Makefile.build
deps/debugger-agent/debugger-agent.gyp [deleted file]
deps/debugger-agent/src/agent.h [deleted file]
lib/_debug_agent.js [moved from deps/debugger-agent/lib/_debugger_agent.js with 100% similarity]
node.gyp
src/debug-agent.cc [moved from deps/debugger-agent/src/agent.cc with 99% similarity]
src/debug-agent.h [moved from deps/debugger-agent/include/debugger-agent.h with 79% similarity]
src/env.h
src/node.js

index 1aa5f56..dad86cb 100644 (file)
@@ -233,7 +233,6 @@ NACL_ARCHES = nacl_ia32 nacl_x64
 GYPFILES = \
        common.gypi \
        deps/cares/cares.gyp \
-       deps/debugger-agent/debugger-agent.gyp \
        deps/http_parser/http_parser.gyp \
        deps/openssl/openssl.gyp \
        deps/uv/uv.gyp \
diff --git a/deps/debugger-agent/debugger-agent.gyp b/deps/debugger-agent/debugger-agent.gyp
deleted file mode 100644 (file)
index e982068..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  "targets": [{
-    "target_name": "debugger-agent",
-    "type": "<(library)",
-    "include_dirs": [
-      "src",
-      "include",
-      "../v8/include",
-      "../uv/include",
-
-      # Private node.js folder and stuff needed to include from it
-      "../../src",
-      "../cares/include",
-    ],
-    "direct_dependent_settings": {
-      "include_dirs": [
-        "include",
-      ],
-    },
-    "sources": [
-      "src/agent.cc",
-    ],
-  }],
-}
diff --git a/deps/debugger-agent/src/agent.h b/deps/debugger-agent/src/agent.h
deleted file mode 100644 (file)
index 82db5e5..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright Fedor Indutny and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#ifndef DEPS_DEBUGGER_AGENT_SRC_AGENT_H_
-#define DEPS_DEBUGGER_AGENT_SRC_AGENT_H_
-
-#include "v8.h"
-#include "v8-debug.h"
-#include "queue.h"
-
-#include <assert.h>
-#include <string.h>
-
-namespace node {
-namespace debugger {
-
-class AgentMessage {
- public:
-  AgentMessage(uint16_t* val, int length) : length_(length) {
-    if (val == NULL) {
-      data_ = val;
-    } else {
-      data_ = new uint16_t[length];
-      memcpy(data_, val, length * sizeof(*data_));
-    }
-  }
-
-  ~AgentMessage() {
-    delete[] data_;
-    data_ = NULL;
-  }
-
-  inline const uint16_t* data() const { return data_; }
-  inline int length() const { return length_; }
-
-  QUEUE member;
-
- private:
-  uint16_t* data_;
-  int length_;
-};
-
-}  // namespace debugger
-}  // namespace node
-
-#endif  // DEPS_DEBUGGER_AGENT_SRC_AGENT_H_
index b1dc5f2..21391e0 100644 (file)
--- a/node.gyp
+++ b/node.gyp
@@ -16,6 +16,7 @@
     'node_v8_options%': '',
     'library_files': [
       'src/node.js',
+      'lib/_debug_agent.js',
       'lib/_debugger.js',
       'lib/_linklist.js',
       'lib/assert.js',
@@ -67,7 +68,6 @@
       'lib/util.js',
       'lib/vm.js',
       'lib/zlib.js',
-      'deps/debugger-agent/lib/_debugger_agent.js',
     ],
   },
 
@@ -78,7 +78,6 @@
 
       'dependencies': [
         'node_js2c#host',
-        'deps/debugger-agent/debugger-agent.gyp:debugger-agent',
       ],
 
       'include_dirs': [
@@ -89,6 +88,7 @@
       ],
 
       'sources': [
+        'src/debug-agent.cc',
         'src/fs_event_wrap.cc',
         'src/cares_wrap.cc',
         'src/handle_wrap.cc',
         'src/async-wrap-inl.h',
         'src/base-object.h',
         'src/base-object-inl.h',
+        'src/debug-agent.h',
         'src/env.h',
         'src/env-inl.h',
         'src/handle_wrap.h',
similarity index 99%
rename from deps/debugger-agent/src/agent.cc
rename to src/debug-agent.cc
index 335737f..78362af 100644 (file)
@@ -19,8 +19,7 @@
 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 // USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-#include "agent.h"
-#include "debugger-agent.h"
+#include "debug-agent.h"
 
 #include "node.h"
 #include "node_internals.h"  // ARRAY_SIZE
similarity index 79%
rename from deps/debugger-agent/include/debugger-agent.h
rename to src/debug-agent.h
index 762a687..d3c7fcc 100644 (file)
 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 // USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-#ifndef DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
-#define DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
+#ifndef SRC_DEBUG_AGENT_H_
+#define SRC_DEBUG_AGENT_H_
 
 #include "uv.h"
 #include "v8.h"
 #include "v8-debug.h"
+#include "queue.h"
 
-namespace node {
+#include <string.h>
 
-// Forward declaration
+// Forward declaration to break recursive dependency chain with src/env.h.
+namespace node {
 class Environment;
+}  // namespace node
 
+namespace node {
 namespace debugger {
 
-// Forward declaration
 class AgentMessage;
 
 class Agent {
@@ -97,13 +100,38 @@ class Agent {
   uv_loop_t child_loop_;
   v8::Persistent<v8::Object> api_;
 
-  // QUEUE
-  void* messages_[2];
+  QUEUE messages_;
 
   DispatchHandler dispatch_handler_;
 };
 
+class AgentMessage {
+ public:
+  AgentMessage(uint16_t* val, int length) : length_(length) {
+    if (val == NULL) {
+      data_ = val;
+    } else {
+      data_ = new uint16_t[length];
+      memcpy(data_, val, length * sizeof(*data_));
+    }
+  }
+
+  ~AgentMessage() {
+    delete[] data_;
+    data_ = NULL;
+  }
+
+  inline const uint16_t* data() const { return data_; }
+  inline int length() const { return length_; }
+
+  QUEUE member;
+
+ private:
+  uint16_t* data_;
+  int length_;
+};
+
 }  // namespace debugger
 }  // namespace node
 
-#endif  // DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
+#endif  // SRC_DEBUG_AGENT_H_
index 77dbf33..5eac220 100644 (file)
--- a/src/env.h
+++ b/src/env.h
 #define SRC_ENV_H_
 
 #include "ares.h"
+#include "debug-agent.h"
 #include "tree.h"
 #include "util.h"
 #include "uv.h"
 #include "v8.h"
 #include "queue.h"
-#include "debugger-agent.h"
 
 #include <stdint.h>
 
index 19d9506..0a82088 100644 (file)
@@ -85,7 +85,7 @@
 
     } else if (process.argv[1] == '--debug-agent') {
       // Start the debugger agent
-      var d = NativeModule.require('_debugger_agent');
+      var d = NativeModule.require('_debug_agent');
       d.start();
 
     } else if (process._eval != null) {