Reapply "wait for connection" feature implementation (issue491079)

0 views
Skip to first unread message

peter...@gmail.com

unread,
Dec 17, 2009, 1:53:02 PM12/17/09
to sgj...@chromium.org, v8-...@googlegroups.com
Reviewers: Søren Gjesse,

Message:
Hi Sorren

This one I checked with both release/debug tests. However, 2 tests look
flaky
(see below), but they fails for me on HEAD as well.

Peter


/home/prybin/src-v8-4/shell_g --allow-natives-syntax --enable-slow-asserts
--debug-code --verify-heap /home/prybin/src-v8-4/test/mjsunit/mjsunit.js
/home/prybin/src-v8-4/test/mjsunit/fuzz-natives.js

and

obj/test/debug/cctest test-api/Threading
--testing_serialization_file=obj/test/debug/serdes_Threading
--enable-slow-asserts --debug-code --verify-heap

Description:
Reapply "wait for connection" feature implementation

Please review this at http://codereview.chromium.org/491079

Affected files:
M include/v8-debug.h
M src/api.cc
M src/debug.h
M src/debug.cc


Index: include/v8-debug.h
diff --git a/include/v8-debug.h b/include/v8-debug.h
index
b27bacc1080123b11f6a93c3302147aac3013b0d..10b41e2368f34f8e87f2c5ee41cbb8231f2387bf
100644
--- a/include/v8-debug.h
+++ b/include/v8-debug.h
@@ -258,8 +258,11 @@ class EXPORT Debug {
* supplied TCP/IP port for remote debugger connection.
* \param name the name of the embedding application
* \param port the TCP/IP port to listen on
+ * \param wait_for_connection whether V8 should pause on a first statement
+ * allowing remote debugger to connect before anything interesting
happened
*/
- static bool EnableAgent(const char* name, int port);
+ static bool EnableAgent(const char* name, int port,
+ bool wait_for_connection = false);
};


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
d793b9f11c8e004060651b7fbfebf05254e6e4ff..ab5d0a5608e356ff79e2fdae76fe54234de042b2
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3741,8 +3741,8 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value>
obj) {
}


-bool Debug::EnableAgent(const char* name, int port) {
- return i::Debugger::StartAgent(name, port);
+bool Debug::EnableAgent(const char* name, int port, bool
wait_for_connection) {
+ return i::Debugger::StartAgent(name, port, wait_for_connection);
}
#endif // ENABLE_DEBUGGER_SUPPORT

Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index
2c4552effeabb5ab42abea5f91d97a9c7fe99329..fbe09391e27fabe4c9934adb79463a57288565ab
100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -2483,7 +2483,24 @@ Handle<Object> Debugger::Call(Handle<JSFunction> fun,
}


-bool Debugger::StartAgent(const char* name, int port) {
+static void StubMessageHandler2(const v8::Debug::Message& message) {
+ // Simply ignore message.
+}
+
+
+bool Debugger::StartAgent(const char* name, int port,
+ bool wait_for_connection) {
+ if (wait_for_connection) {
+ // Suspend V8 if it is already running or set V8 to suspend whenever
+ // it starts.
+ // Provide stub message handler; V8 auto-continues each suspend
+ // when there is no message handler; we doesn't need it.
+ // Once become suspended, V8 will stay so indefinitely long, until
remote
+ // debugger connects and issues "continue" command.
+ Debugger::message_handler_ = StubMessageHandler2;
+ v8::Debug::DebugBreak();
+ }
+
if (Socket::Setup()) {
agent_ = new DebuggerAgent(name, port);
agent_->Start();
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index
24f0db4133d26986c0823d0f624c63fdf82ece5b..c37e08b38f357dd3070ec866360b6bf9cb24aaa2
100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -636,7 +636,8 @@ class Debugger {
bool* pending_exception);

// Start the debugger agent listening on the provided port.
- static bool StartAgent(const char* name, int port);
+ static bool StartAgent(const char* name, int port,
+ bool wait_for_connection = false);

// Stop the debugger agent.
static void StopAgent();


sgj...@chromium.org

unread,
Dec 18, 2009, 6:01:19 AM12/18/09
to peter...@gmail.com, v8-...@googlegroups.com
LGTM

I guess that the flakey tests give a TIMEOUT error. They can do that when
run
locally depending on the machine used and on whether -j<something> is used.

http://codereview.chromium.org/491079

Peter Rybin

unread,
Dec 18, 2009, 10:11:14 AM12/18/09
to peter...@gmail.com, sgj...@chromium.org, v8-...@googlegroups.com
2009/12/18 <sgj...@chromium.org>

LGTM

I guess that the flakey tests give a TIMEOUT error. They can do that when run
locally depending on the machine used and on whether -j<something> is used.

That's right. I start them on my devbox. The first one take more than 1 minute for me (didn't measure the second one).
Does it mean I should try them on some server? Like uploading patch there and starting?

Peter

 

Reply all
Reply to author
Forward
0 new messages