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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // Code object for debug break return entry code. | 394 // Code object for debug break return entry code. |
395 static Code* debug_break_return_entry_; | 395 static Code* debug_break_return_entry_; |
396 | 396 |
397 // Code to call for handling debug break on return. | 397 // Code to call for handling debug break on return. |
398 static Code* debug_break_return_; | 398 static Code* debug_break_return_; |
399 | 399 |
400 DISALLOW_COPY_AND_ASSIGN(Debug); | 400 DISALLOW_COPY_AND_ASSIGN(Debug); |
401 }; | 401 }; |
402 | 402 |
403 | 403 |
| 404 // Message delivered to the message handler callback. This is either a debugger |
| 405 // event or the response to a command. |
| 406 class MessageImpl: public v8::Debug::Message { |
| 407 public: |
| 408 // Create a message object for a debug event. |
| 409 static MessageImpl NewEvent(DebugEvent event, |
| 410 bool running, |
| 411 Handle<JSObject> exec_state, |
| 412 Handle<JSObject> event_data); |
| 413 |
| 414 // Create a message object for the response to a debug command. |
| 415 static MessageImpl NewResponse(DebugEvent event, |
| 416 bool running, |
| 417 Handle<JSObject> exec_state, |
| 418 Handle<JSObject> event_data, |
| 419 Handle<String> response_json, |
| 420 v8::Debug::ClientData* client_data); |
| 421 |
| 422 // Implementation of interface v8::Debug::Message. |
| 423 virtual bool IsEvent() const; |
| 424 virtual bool IsResponse() const; |
| 425 virtual DebugEvent GetEvent() const; |
| 426 virtual bool WillStartRunning() const; |
| 427 virtual v8::Handle<v8::Object> GetExecutionState() const; |
| 428 virtual v8::Handle<v8::Object> GetEventData() const; |
| 429 virtual v8::Handle<v8::String> GetJSON() const; |
| 430 virtual v8::Handle<v8::Context> GetEventContext() const; |
| 431 virtual v8::Debug::ClientData* GetClientData() const; |
| 432 |
| 433 private: |
| 434 MessageImpl(bool is_event, |
| 435 DebugEvent event, |
| 436 bool running, |
| 437 Handle<JSObject> exec_state, |
| 438 Handle<JSObject> event_data, |
| 439 Handle<String> response_json, |
| 440 v8::Debug::ClientData* client_data); |
| 441 |
| 442 bool is_event_; // Does this message represent a debug event? |
| 443 DebugEvent event_; // Debug event causing the break. |
| 444 bool running_; // Will the VM start running after this event? |
| 445 Handle<JSObject> exec_state_; // Current execution state. |
| 446 Handle<JSObject> event_data_; // Data associated with the event. |
| 447 Handle<String> response_json_; // Response JSON if message holds a response. |
| 448 v8::Debug::ClientData* client_data_; // Client data passed with the request. |
| 449 }; |
| 450 |
| 451 |
404 // Message send by user to v8 debugger or debugger output message. | 452 // Message send by user to v8 debugger or debugger output message. |
405 // In addition to command text it may contain a pointer to some user data | 453 // In addition to command text it may contain a pointer to some user data |
406 // which are expected to be passed along with the command reponse to message | 454 // which are expected to be passed along with the command reponse to message |
407 // handler. | 455 // handler. |
408 class CommandMessage { | 456 class CommandMessage { |
409 public: | 457 public: |
410 static CommandMessage New(const Vector<uint16_t>& command, | 458 static CommandMessage New(const Vector<uint16_t>& command, |
411 v8::Debug::ClientData* data); | 459 v8::Debug::ClientData* data); |
412 CommandMessage(); | 460 CommandMessage(); |
413 ~CommandMessage(); | 461 ~CommandMessage(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 static Handle<Object> MakeCompileEvent(Handle<Script> script, | 532 static Handle<Object> MakeCompileEvent(Handle<Script> script, |
485 bool before, | 533 bool before, |
486 bool* caught_exception); | 534 bool* caught_exception); |
487 static void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); | 535 static void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); |
488 static void OnException(Handle<Object> exception, bool uncaught); | 536 static void OnException(Handle<Object> exception, bool uncaught); |
489 static void OnBeforeCompile(Handle<Script> script); | 537 static void OnBeforeCompile(Handle<Script> script); |
490 static void OnAfterCompile(Handle<Script> script, | 538 static void OnAfterCompile(Handle<Script> script, |
491 Handle<JSFunction> fun); | 539 Handle<JSFunction> fun); |
492 static void OnNewFunction(Handle<JSFunction> fun); | 540 static void OnNewFunction(Handle<JSFunction> fun); |
493 static void ProcessDebugEvent(v8::DebugEvent event, | 541 static void ProcessDebugEvent(v8::DebugEvent event, |
494 Handle<Object> event_data, | 542 Handle<JSObject> event_data, |
495 bool auto_continue); | 543 bool auto_continue); |
496 static void NotifyMessageHandler(v8::DebugEvent event, | 544 static void NotifyMessageHandler(v8::DebugEvent event, |
497 Handle<Object> exec_state, | 545 Handle<JSObject> exec_state, |
498 Handle<Object> event_data, | 546 Handle<JSObject> event_data, |
499 bool auto_continue); | 547 bool auto_continue); |
500 static void SetEventListener(Handle<Object> callback, Handle<Object> data); | 548 static void SetEventListener(Handle<Object> callback, Handle<Object> data); |
501 static void SetMessageHandler(v8::Debug::MessageHandler handler); | 549 static void SetMessageHandler(v8::Debug::MessageHandler handler); |
502 static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, | 550 static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, |
503 int period); | 551 int period); |
504 | 552 |
505 // Invoke the message handler function. | 553 // Invoke the message handler function. |
506 static void InvokeMessageHandler(v8::Handle<v8::String> output, | 554 static void InvokeMessageHandler(MessageImpl message); |
507 v8::Debug::ClientData* data); | |
508 | |
509 // Send the JSON message for a debug event. | |
510 static bool InvokeMessageHandlerWithEvent(Handle<Object> event_data); | |
511 | 555 |
512 // Add a debugger command to the command queue. | 556 // Add a debugger command to the command queue. |
513 static void ProcessCommand(Vector<const uint16_t> command, | 557 static void ProcessCommand(Vector<const uint16_t> command, |
514 v8::Debug::ClientData* client_data = NULL); | 558 v8::Debug::ClientData* client_data = NULL); |
515 | 559 |
516 // Check whether there are commands in the command queue. | 560 // Check whether there are commands in the command queue. |
517 static bool HasCommands(); | 561 static bool HasCommands(); |
518 | 562 |
519 static Handle<Object> Call(Handle<JSFunction> fun, | 563 static Handle<Object> Call(Handle<JSFunction> fun, |
520 Handle<Object> data, | 564 Handle<Object> data, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 Debug::AddressId id_; | 756 Debug::AddressId id_; |
713 int reg_; | 757 int reg_; |
714 }; | 758 }; |
715 | 759 |
716 | 760 |
717 } } // namespace v8::internal | 761 } } // namespace v8::internal |
718 | 762 |
719 #endif // ENABLE_DEBUGGER_SUPPORT | 763 #endif // ENABLE_DEBUGGER_SUPPORT |
720 | 764 |
721 #endif // V8_V8_DEBUG_H_ | 765 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |