OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_V8_DEBUG_H_ | 28 #ifndef V8_V8_DEBUG_H_ |
29 #define V8_V8_DEBUG_H_ | 29 #define V8_V8_DEBUG_H_ |
30 | 30 |
31 #include "../include/v8-debug.h" | 31 #include "../include/v8-debug.h" |
32 #include "assembler.h" | 32 #include "assembler.h" |
33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
| 34 #include "debug-agent.h" |
34 #include "execution.h" | 35 #include "execution.h" |
35 #include "factory.h" | 36 #include "factory.h" |
36 #include "platform.h" | 37 #include "platform.h" |
37 #include "string-stream.h" | 38 #include "string-stream.h" |
38 | 39 |
39 | 40 |
40 namespace v8 { namespace internal { | 41 namespace v8 { namespace internal { |
41 | 42 |
42 // Step actions. NOTE: These values are in macros.py as well. | 43 // Step actions. NOTE: These values are in macros.py as well. |
43 enum StepAction { | 44 enum StepAction { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 static void SetHostDispatchHandler(v8::DebugHostDispatchHandler handler, | 385 static void SetHostDispatchHandler(v8::DebugHostDispatchHandler handler, |
385 void* data); | 386 void* data); |
386 static void SendMessage(Vector<uint16_t> message); | 387 static void SendMessage(Vector<uint16_t> message); |
387 static void ProcessCommand(Vector<const uint16_t> command); | 388 static void ProcessCommand(Vector<const uint16_t> command); |
388 static void ProcessHostDispatch(void* dispatch); | 389 static void ProcessHostDispatch(void* dispatch); |
389 static void UpdateActiveDebugger(); | 390 static void UpdateActiveDebugger(); |
390 static Handle<Object> Call(Handle<JSFunction> fun, | 391 static Handle<Object> Call(Handle<JSFunction> fun, |
391 Handle<Object> data, | 392 Handle<Object> data, |
392 bool* pending_exception); | 393 bool* pending_exception); |
393 | 394 |
| 395 // Start the debugger agent listening on the provided port. |
| 396 static bool StartAgent(int port); |
| 397 |
394 inline static bool EventActive(v8::DebugEvent event) { | 398 inline static bool EventActive(v8::DebugEvent event) { |
395 // Currently argument event is not used. | 399 // Currently argument event is not used. |
396 return !Debugger::compiling_natives_ && Debugger::debugger_active_; | 400 return !Debugger::compiling_natives_ && Debugger::debugger_active_; |
397 } | 401 } |
398 | 402 |
399 static void set_debugger_active(bool debugger_active) { | 403 static void set_debugger_active(bool debugger_active) { |
400 Debugger::debugger_active_ = debugger_active; | 404 Debugger::debugger_active_ = debugger_active; |
401 } | 405 } |
402 static bool debugger_active() { return Debugger::debugger_active_; } | 406 static bool debugger_active() { return Debugger::debugger_active_; } |
403 static void set_compiling_natives(bool compiling_natives) { | 407 static void set_compiling_natives(bool compiling_natives) { |
404 Debugger::compiling_natives_ = compiling_natives; | 408 Debugger::compiling_natives_ = compiling_natives; |
405 } | 409 } |
406 static bool compiling_natives() { return Debugger::compiling_natives_; } | 410 static bool compiling_natives() { return Debugger::compiling_natives_; } |
407 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; } | 411 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; } |
408 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; } | 412 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; } |
409 | 413 |
410 private: | 414 private: |
411 static Handle<Object> event_listener_; // Global handle to listener | 415 static Handle<Object> event_listener_; // Global handle to listener |
412 static Handle<Object> event_listener_data_; | 416 static Handle<Object> event_listener_data_; |
413 static bool debugger_active_; // Are there any active debugger? | 417 static bool debugger_active_; // Are there any active debugger? |
414 static bool compiling_natives_; // Are we compiling natives? | 418 static bool compiling_natives_; // Are we compiling natives? |
415 static bool is_loading_debugger_; // Are we loading the debugger? | 419 static bool is_loading_debugger_; // Are we loading the debugger? |
416 static DebugMessageThread* message_thread_; | 420 static DebugMessageThread* message_thread_; |
417 static v8::DebugMessageHandler message_handler_; | 421 static v8::DebugMessageHandler message_handler_; |
418 static void* message_handler_data_; | 422 static void* message_handler_data_; |
419 static v8::DebugHostDispatchHandler host_dispatch_handler_; | 423 static v8::DebugHostDispatchHandler host_dispatch_handler_; |
420 static void* host_dispatch_handler_data_; | 424 static void* host_dispatch_handler_data_; |
421 | 425 |
| 426 static DebuggerAgent* agent_; |
| 427 |
422 friend class DebugMessageThread; | 428 friend class DebugMessageThread; |
423 }; | 429 }; |
424 | 430 |
425 | 431 |
426 // A Queue of Vector<uint16_t> objects. A thread-safe version is | 432 // A Queue of Vector<uint16_t> objects. A thread-safe version is |
427 // LockingMessageQueue, based on this class. | 433 // LockingMessageQueue, based on this class. |
428 class MessageQueue BASE_EMBEDDED { | 434 class MessageQueue BASE_EMBEDDED { |
429 public: | 435 public: |
430 explicit MessageQueue(int size); | 436 explicit MessageQueue(int size); |
431 ~MessageQueue(); | 437 ~MessageQueue(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 618 } |
613 private: | 619 private: |
614 Debug::AddressId id_; | 620 Debug::AddressId id_; |
615 int reg_; | 621 int reg_; |
616 }; | 622 }; |
617 | 623 |
618 | 624 |
619 } } // namespace v8::internal | 625 } } // namespace v8::internal |
620 | 626 |
621 #endif // V8_V8_DEBUG_H_ | 627 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |