Skip to content

Commit

Permalink
src: move debug agent from deps/ to src/
Browse files Browse the repository at this point in the history
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/.
  • Loading branch information
bnoordhuis committed Nov 3, 2014
1 parent 5901013 commit 29d7fd6
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 103 deletions.
1 change: 0 additions & 1 deletion Makefile.build
Expand Up @@ -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 \
Expand Down
24 changes: 0 additions & 24 deletions deps/debugger-agent/debugger-agent.gyp

This file was deleted.

64 changes: 0 additions & 64 deletions deps/debugger-agent/src/agent.h

This file was deleted.

File renamed without changes.
5 changes: 3 additions & 2 deletions node.gyp
Expand Up @@ -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',
Expand Down Expand Up @@ -67,7 +68,6 @@
'lib/util.js',
'lib/vm.js',
'lib/zlib.js',
'deps/debugger-agent/lib/_debugger_agent.js',
],
},

Expand All @@ -78,7 +78,6 @@

'dependencies': [
'node_js2c#host',
'deps/debugger-agent/debugger-agent.gyp:debugger-agent',
],

'include_dirs': [
Expand All @@ -89,6 +88,7 @@
],

'sources': [
'src/debug-agent.cc',
'src/fs_event_wrap.cc',
'src/cares_wrap.cc',
'src/handle_wrap.cc',
Expand Down Expand Up @@ -124,6 +124,7 @@
'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',
Expand Down
3 changes: 1 addition & 2 deletions deps/debugger-agent/src/agent.cc → src/debug-agent.cc
Expand Up @@ -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
Expand Down
44 changes: 36 additions & 8 deletions deps/debugger-agent/include/debugger-agent.h → src/debug-agent.h
Expand Up @@ -19,21 +19,24 @@
// 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 {
Expand Down Expand Up @@ -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_
2 changes: 1 addition & 1 deletion src/env.h
Expand Up @@ -23,12 +23,12 @@
#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>

Expand Down
2 changes: 1 addition & 1 deletion src/node.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 29d7fd6

Please sign in to comment.