Skip to content

Commit 29d7fd6

Browse files
committed
src: move debug agent from deps/ to src/
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/.
1 parent 5901013 commit 29d7fd6

File tree

9 files changed

+42
-103
lines changed

9 files changed

+42
-103
lines changed

Makefile.build

-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ NACL_ARCHES = nacl_ia32 nacl_x64
233233
GYPFILES = \
234234
common.gypi \
235235
deps/cares/cares.gyp \
236-
deps/debugger-agent/debugger-agent.gyp \
237236
deps/http_parser/http_parser.gyp \
238237
deps/openssl/openssl.gyp \
239238
deps/uv/uv.gyp \

deps/debugger-agent/debugger-agent.gyp

-24
This file was deleted.

deps/debugger-agent/src/agent.h

-64
This file was deleted.
File renamed without changes.

node.gyp

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'node_v8_options%': '',
1717
'library_files': [
1818
'src/node.js',
19+
'lib/_debug_agent.js',
1920
'lib/_debugger.js',
2021
'lib/_linklist.js',
2122
'lib/assert.js',
@@ -67,7 +68,6 @@
6768
'lib/util.js',
6869
'lib/vm.js',
6970
'lib/zlib.js',
70-
'deps/debugger-agent/lib/_debugger_agent.js',
7171
],
7272
},
7373

@@ -78,7 +78,6 @@
7878

7979
'dependencies': [
8080
'node_js2c#host',
81-
'deps/debugger-agent/debugger-agent.gyp:debugger-agent',
8281
],
8382

8483
'include_dirs': [
@@ -89,6 +88,7 @@
8988
],
9089

9190
'sources': [
91+
'src/debug-agent.cc',
9292
'src/fs_event_wrap.cc',
9393
'src/cares_wrap.cc',
9494
'src/handle_wrap.cc',
@@ -124,6 +124,7 @@
124124
'src/async-wrap-inl.h',
125125
'src/base-object.h',
126126
'src/base-object-inl.h',
127+
'src/debug-agent.h',
127128
'src/env.h',
128129
'src/env-inl.h',
129130
'src/handle_wrap.h',

deps/debugger-agent/src/agent.cc renamed to src/debug-agent.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22-
#include "agent.h"
23-
#include "debugger-agent.h"
22+
#include "debug-agent.h"
2423

2524
#include "node.h"
2625
#include "node_internals.h" // ARRAY_SIZE

deps/debugger-agent/include/debugger-agent.h renamed to src/debug-agent.h

+36-8
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,24 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22-
#ifndef DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
23-
#define DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
22+
#ifndef SRC_DEBUG_AGENT_H_
23+
#define SRC_DEBUG_AGENT_H_
2424

2525
#include "uv.h"
2626
#include "v8.h"
2727
#include "v8-debug.h"
28+
#include "queue.h"
2829

29-
namespace node {
30+
#include <string.h>
3031

31-
// Forward declaration
32+
// Forward declaration to break recursive dependency chain with src/env.h.
33+
namespace node {
3234
class Environment;
35+
} // namespace node
3336

37+
namespace node {
3438
namespace debugger {
3539

36-
// Forward declaration
3740
class AgentMessage;
3841

3942
class Agent {
@@ -97,13 +100,38 @@ class Agent {
97100
uv_loop_t child_loop_;
98101
v8::Persistent<v8::Object> api_;
99102

100-
// QUEUE
101-
void* messages_[2];
103+
QUEUE messages_;
102104

103105
DispatchHandler dispatch_handler_;
104106
};
105107

108+
class AgentMessage {
109+
public:
110+
AgentMessage(uint16_t* val, int length) : length_(length) {
111+
if (val == NULL) {
112+
data_ = val;
113+
} else {
114+
data_ = new uint16_t[length];
115+
memcpy(data_, val, length * sizeof(*data_));
116+
}
117+
}
118+
119+
~AgentMessage() {
120+
delete[] data_;
121+
data_ = NULL;
122+
}
123+
124+
inline const uint16_t* data() const { return data_; }
125+
inline int length() const { return length_; }
126+
127+
QUEUE member;
128+
129+
private:
130+
uint16_t* data_;
131+
int length_;
132+
};
133+
106134
} // namespace debugger
107135
} // namespace node
108136

109-
#endif // DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_
137+
#endif // SRC_DEBUG_AGENT_H_

src/env.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
#define SRC_ENV_H_
2424

2525
#include "ares.h"
26+
#include "debug-agent.h"
2627
#include "tree.h"
2728
#include "util.h"
2829
#include "uv.h"
2930
#include "v8.h"
3031
#include "queue.h"
31-
#include "debugger-agent.h"
3232

3333
#include <stdint.h>
3434

src/node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
} else if (process.argv[1] == '--debug-agent') {
8787
// Start the debugger agent
88-
var d = NativeModule.require('_debugger_agent');
88+
var d = NativeModule.require('_debug_agent');
8989
d.start();
9090

9191
} else if (process._eval != null) {

0 commit comments

Comments
 (0)