OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEBUG_DEBUG_H_ | 5 #ifndef V8_DEBUG_DEBUG_H_ |
6 #define V8_DEBUG_DEBUG_H_ | 6 #define V8_DEBUG_DEBUG_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void EnqueueCommandMessage(Vector<const uint16_t> command, | 420 void EnqueueCommandMessage(Vector<const uint16_t> command, |
421 v8::Debug::ClientData* client_data = NULL); | 421 v8::Debug::ClientData* client_data = NULL); |
422 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, | 422 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, |
423 Handle<Object> data); | 423 Handle<Object> data); |
424 Handle<Context> GetDebugContext(); | 424 Handle<Context> GetDebugContext(); |
425 void HandleDebugBreak(); | 425 void HandleDebugBreak(); |
426 void ProcessDebugMessages(bool debug_command_only); | 426 void ProcessDebugMessages(bool debug_command_only); |
427 | 427 |
428 // Internal logic | 428 // Internal logic |
429 bool Load(); | 429 bool Load(); |
430 void Break(Arguments args, JavaScriptFrame*); | 430 void Break(JavaScriptFrame* frame); |
431 Object* SetAfterBreakTarget(JavaScriptFrame* frame); | 431 void SetAfterBreakTarget(JavaScriptFrame* frame); |
432 | 432 |
433 // Scripts handling. | 433 // Scripts handling. |
434 Handle<FixedArray> GetLoadedScripts(); | 434 Handle<FixedArray> GetLoadedScripts(); |
435 | 435 |
436 // Break point handling. | 436 // Break point handling. |
437 bool SetBreakPoint(Handle<JSFunction> function, | 437 bool SetBreakPoint(Handle<JSFunction> function, |
438 Handle<Object> break_point_object, | 438 Handle<Object> break_point_object, |
439 int* source_position); | 439 int* source_position); |
440 bool SetBreakPointForScript(Handle<Script> script, | 440 bool SetBreakPointForScript(Handle<Script> script, |
441 Handle<Object> break_point_object, | 441 Handle<Object> break_point_object, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 inline bool is_loaded() const { return !debug_context_.is_null(); } | 517 inline bool is_loaded() const { return !debug_context_.is_null(); } |
518 inline bool in_debug_scope() const { | 518 inline bool in_debug_scope() const { |
519 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); | 519 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); |
520 } | 520 } |
521 void set_break_points_active(bool v) { break_points_active_ = v; } | 521 void set_break_points_active(bool v) { break_points_active_ = v; } |
522 bool break_points_active() const { return break_points_active_; } | 522 bool break_points_active() const { return break_points_active_; } |
523 | 523 |
524 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } | 524 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } |
525 int break_id() { return thread_local_.break_id_; } | 525 int break_id() { return thread_local_.break_id_; } |
526 | 526 |
| 527 Handle<Object> return_value() { return thread_local_.return_value_; } |
| 528 void set_return_value(Handle<Object> value) { |
| 529 thread_local_.return_value_ = value; |
| 530 } |
| 531 |
527 // Support for embedding into generated code. | 532 // Support for embedding into generated code. |
528 Address is_active_address() { | 533 Address is_active_address() { |
529 return reinterpret_cast<Address>(&is_active_); | 534 return reinterpret_cast<Address>(&is_active_); |
530 } | 535 } |
531 | 536 |
532 Address after_break_target_address() { | 537 Address after_break_target_address() { |
533 return reinterpret_cast<Address>(&after_break_target_); | 538 return reinterpret_cast<Address>(&after_break_target_); |
534 } | 539 } |
535 | 540 |
536 Address step_in_enabled_address() { | 541 Address step_in_enabled_address() { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 Address target_fp_; | 676 Address target_fp_; |
672 | 677 |
673 // Whether functions are flooded on entry for step-in and step-frame. | 678 // Whether functions are flooded on entry for step-in and step-frame. |
674 // If we stepped out to the embedder, disable flooding to spill stepping | 679 // If we stepped out to the embedder, disable flooding to spill stepping |
675 // to the next call that the embedder makes. | 680 // to the next call that the embedder makes. |
676 bool step_in_enabled_; | 681 bool step_in_enabled_; |
677 | 682 |
678 // Stores the way how LiveEdit has patched the stack. It is used when | 683 // Stores the way how LiveEdit has patched the stack. It is used when |
679 // debugger returns control back to user script. | 684 // debugger returns control back to user script. |
680 LiveEdit::FrameDropMode frame_drop_mode_; | 685 LiveEdit::FrameDropMode frame_drop_mode_; |
| 686 |
| 687 // Value of accumulator in interpreter frames. In non-interpreter frames |
| 688 // this value will be the hole. |
| 689 Handle<Object> return_value_; |
681 }; | 690 }; |
682 | 691 |
683 // Storage location for registers when handling debug break calls | 692 // Storage location for registers when handling debug break calls |
684 ThreadLocal thread_local_; | 693 ThreadLocal thread_local_; |
685 | 694 |
686 Isolate* isolate_; | 695 Isolate* isolate_; |
687 | 696 |
688 friend class Isolate; | 697 friend class Isolate; |
689 friend class DebugScope; | 698 friend class DebugScope; |
690 friend class DisableBreak; | 699 friend class DisableBreak; |
(...skipping 21 matching lines...) Expand all Loading... |
712 // Get the active context from before entering the debugger. | 721 // Get the active context from before entering the debugger. |
713 inline Handle<Context> GetContext() { return save_.context(); } | 722 inline Handle<Context> GetContext() { return save_.context(); } |
714 | 723 |
715 private: | 724 private: |
716 Isolate* isolate() { return debug_->isolate_; } | 725 Isolate* isolate() { return debug_->isolate_; } |
717 | 726 |
718 Debug* debug_; | 727 Debug* debug_; |
719 DebugScope* prev_; // Previous scope if entered recursively. | 728 DebugScope* prev_; // Previous scope if entered recursively. |
720 StackFrame::Id break_frame_id_; // Previous break frame id. | 729 StackFrame::Id break_frame_id_; // Previous break frame id. |
721 int break_id_; // Previous break id. | 730 int break_id_; // Previous break id. |
| 731 Handle<Object> return_value_; // Previous result. |
722 bool failed_; // Did the debug context fail to load? | 732 bool failed_; // Did the debug context fail to load? |
723 SaveContext save_; // Saves previous context. | 733 SaveContext save_; // Saves previous context. |
724 PostponeInterruptsScope no_termination_exceptons_; | 734 PostponeInterruptsScope no_termination_exceptons_; |
725 }; | 735 }; |
726 | 736 |
727 | 737 |
728 // Stack allocated class for disabling break. | 738 // Stack allocated class for disabling break. |
729 class DisableBreak BASE_EMBEDDED { | 739 class DisableBreak BASE_EMBEDDED { |
730 public: | 740 public: |
731 explicit DisableBreak(Debug* debug, bool disable_break) | 741 explicit DisableBreak(Debug* debug, bool disable_break) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 Handle<Code> code); | 797 Handle<Code> code); |
788 static bool DebugBreakSlotIsPatched(Address pc); | 798 static bool DebugBreakSlotIsPatched(Address pc); |
789 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 799 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
790 }; | 800 }; |
791 | 801 |
792 | 802 |
793 } // namespace internal | 803 } // namespace internal |
794 } // namespace v8 | 804 } // namespace v8 |
795 | 805 |
796 #endif // V8_DEBUG_DEBUG_H_ | 806 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |