| 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(JavaScriptFrame* frame); | 430 void Break(Arguments args, JavaScriptFrame*); |
| 431 void SetAfterBreakTarget(JavaScriptFrame* frame); | 431 Object* 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 | |
| 532 // Support for embedding into generated code. | 527 // Support for embedding into generated code. |
| 533 Address is_active_address() { | 528 Address is_active_address() { |
| 534 return reinterpret_cast<Address>(&is_active_); | 529 return reinterpret_cast<Address>(&is_active_); |
| 535 } | 530 } |
| 536 | 531 |
| 537 Address after_break_target_address() { | 532 Address after_break_target_address() { |
| 538 return reinterpret_cast<Address>(&after_break_target_); | 533 return reinterpret_cast<Address>(&after_break_target_); |
| 539 } | 534 } |
| 540 | 535 |
| 541 Address step_in_enabled_address() { | 536 Address step_in_enabled_address() { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 Address target_fp_; | 671 Address target_fp_; |
| 677 | 672 |
| 678 // Whether functions are flooded on entry for step-in and step-frame. | 673 // Whether functions are flooded on entry for step-in and step-frame. |
| 679 // If we stepped out to the embedder, disable flooding to spill stepping | 674 // If we stepped out to the embedder, disable flooding to spill stepping |
| 680 // to the next call that the embedder makes. | 675 // to the next call that the embedder makes. |
| 681 bool step_in_enabled_; | 676 bool step_in_enabled_; |
| 682 | 677 |
| 683 // Stores the way how LiveEdit has patched the stack. It is used when | 678 // Stores the way how LiveEdit has patched the stack. It is used when |
| 684 // debugger returns control back to user script. | 679 // debugger returns control back to user script. |
| 685 LiveEdit::FrameDropMode frame_drop_mode_; | 680 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_; | |
| 690 }; | 681 }; |
| 691 | 682 |
| 692 // Storage location for registers when handling debug break calls | 683 // Storage location for registers when handling debug break calls |
| 693 ThreadLocal thread_local_; | 684 ThreadLocal thread_local_; |
| 694 | 685 |
| 695 Isolate* isolate_; | 686 Isolate* isolate_; |
| 696 | 687 |
| 697 friend class Isolate; | 688 friend class Isolate; |
| 698 friend class DebugScope; | 689 friend class DebugScope; |
| 699 friend class DisableBreak; | 690 friend class DisableBreak; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 721 // Get the active context from before entering the debugger. | 712 // Get the active context from before entering the debugger. |
| 722 inline Handle<Context> GetContext() { return save_.context(); } | 713 inline Handle<Context> GetContext() { return save_.context(); } |
| 723 | 714 |
| 724 private: | 715 private: |
| 725 Isolate* isolate() { return debug_->isolate_; } | 716 Isolate* isolate() { return debug_->isolate_; } |
| 726 | 717 |
| 727 Debug* debug_; | 718 Debug* debug_; |
| 728 DebugScope* prev_; // Previous scope if entered recursively. | 719 DebugScope* prev_; // Previous scope if entered recursively. |
| 729 StackFrame::Id break_frame_id_; // Previous break frame id. | 720 StackFrame::Id break_frame_id_; // Previous break frame id. |
| 730 int break_id_; // Previous break id. | 721 int break_id_; // Previous break id. |
| 731 Handle<Object> return_value_; // Previous result. | |
| 732 bool failed_; // Did the debug context fail to load? | 722 bool failed_; // Did the debug context fail to load? |
| 733 SaveContext save_; // Saves previous context. | 723 SaveContext save_; // Saves previous context. |
| 734 PostponeInterruptsScope no_termination_exceptons_; | 724 PostponeInterruptsScope no_termination_exceptons_; |
| 735 }; | 725 }; |
| 736 | 726 |
| 737 | 727 |
| 738 // Stack allocated class for disabling break. | 728 // Stack allocated class for disabling break. |
| 739 class DisableBreak BASE_EMBEDDED { | 729 class DisableBreak BASE_EMBEDDED { |
| 740 public: | 730 public: |
| 741 explicit DisableBreak(Debug* debug, bool disable_break) | 731 explicit DisableBreak(Debug* debug, bool disable_break) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 Handle<Code> code); | 787 Handle<Code> code); |
| 798 static bool DebugBreakSlotIsPatched(Address pc); | 788 static bool DebugBreakSlotIsPatched(Address pc); |
| 799 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 789 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
| 800 }; | 790 }; |
| 801 | 791 |
| 802 | 792 |
| 803 } // namespace internal | 793 } // namespace internal |
| 804 } // namespace v8 | 794 } // namespace v8 |
| 805 | 795 |
| 806 #endif // V8_DEBUG_DEBUG_H_ | 796 #endif // V8_DEBUG_DEBUG_H_ |
| OLD | NEW |