OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3426 // Suspend V8 if it is already running or set V8 to suspend whenever | 3426 // Suspend V8 if it is already running or set V8 to suspend whenever |
3427 // it starts. | 3427 // it starts. |
3428 // Provide stub message handler; V8 auto-continues each suspend | 3428 // Provide stub message handler; V8 auto-continues each suspend |
3429 // when there is no message handler; we doesn't need it. | 3429 // when there is no message handler; we doesn't need it. |
3430 // Once become suspended, V8 will stay so indefinitely long, until remote | 3430 // Once become suspended, V8 will stay so indefinitely long, until remote |
3431 // debugger connects and issues "continue" command. | 3431 // debugger connects and issues "continue" command. |
3432 Debugger::message_handler_ = StubMessageHandler2; | 3432 Debugger::message_handler_ = StubMessageHandler2; |
3433 v8::Debug::DebugBreak(); | 3433 v8::Debug::DebugBreak(); |
3434 } | 3434 } |
3435 | 3435 |
3436 if (Socket::SetUp()) { | 3436 if (agent_ == NULL) { |
3437 if (agent_ == NULL) { | 3437 agent_ = new DebuggerAgent(isolate_, name, port); |
3438 agent_ = new DebuggerAgent(isolate_, name, port); | 3438 agent_->Start(); |
3439 agent_->Start(); | |
3440 } | |
3441 return true; | |
3442 } | 3439 } |
3443 | 3440 return true; |
3444 return false; | |
3445 } | 3441 } |
3446 | 3442 |
3447 | 3443 |
3448 void Debugger::StopAgent() { | 3444 void Debugger::StopAgent() { |
3449 ASSERT(Isolate::Current() == isolate_); | 3445 ASSERT(Isolate::Current() == isolate_); |
3450 if (agent_ != NULL) { | 3446 if (agent_ != NULL) { |
3451 agent_->Shutdown(); | 3447 agent_->Shutdown(); |
3452 agent_->Join(); | 3448 agent_->Join(); |
3453 delete agent_; | 3449 delete agent_; |
3454 agent_ = NULL; | 3450 agent_ = NULL; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3846 { | 3842 { |
3847 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3843 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3848 isolate_->debugger()->CallMessageDispatchHandler(); | 3844 isolate_->debugger()->CallMessageDispatchHandler(); |
3849 } | 3845 } |
3850 } | 3846 } |
3851 } | 3847 } |
3852 | 3848 |
3853 #endif // ENABLE_DEBUGGER_SUPPORT | 3849 #endif // ENABLE_DEBUGGER_SUPPORT |
3854 | 3850 |
3855 } } // namespace v8::internal | 3851 } } // namespace v8::internal |
OLD | NEW |