| 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/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 inline bool is_loaded() const { return !debug_context_.is_null(); } | 386 inline bool is_loaded() const { return !debug_context_.is_null(); } |
| 387 inline bool in_debug_scope() const { | 387 inline bool in_debug_scope() const { |
| 388 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); | 388 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); |
| 389 } | 389 } |
| 390 void set_break_points_active(bool v) { break_points_active_ = v; } | 390 void set_break_points_active(bool v) { break_points_active_ = v; } |
| 391 bool break_points_active() const { return break_points_active_; } | 391 bool break_points_active() const { return break_points_active_; } |
| 392 | 392 |
| 393 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } | 393 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } |
| 394 int break_id() { return thread_local_.break_id_; } | 394 int break_id() { return thread_local_.break_id_; } |
| 395 | 395 |
| 396 Handle<Object> return_value_handle() { |
| 397 return handle(thread_local_.return_value_, isolate_); |
| 398 } |
| 396 Object* return_value() { return thread_local_.return_value_; } | 399 Object* return_value() { return thread_local_.return_value_; } |
| 397 void set_return_value(Object* value) { thread_local_.return_value_ = value; } | 400 void set_return_value(Object* value) { thread_local_.return_value_ = value; } |
| 398 | 401 |
| 399 // Support for embedding into generated code. | 402 // Support for embedding into generated code. |
| 400 Address is_active_address() { | 403 Address is_active_address() { |
| 401 return reinterpret_cast<Address>(&is_active_); | 404 return reinterpret_cast<Address>(&is_active_); |
| 402 } | 405 } |
| 403 | 406 |
| 404 Address hook_on_function_call_address() { | 407 Address hook_on_function_call_address() { |
| 405 return reinterpret_cast<Address>(&hook_on_function_call_); | 408 return reinterpret_cast<Address>(&hook_on_function_call_); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // Get the active context from before entering the debugger. | 688 // Get the active context from before entering the debugger. |
| 686 inline Handle<Context> GetContext() { return save_.context(); } | 689 inline Handle<Context> GetContext() { return save_.context(); } |
| 687 | 690 |
| 688 private: | 691 private: |
| 689 Isolate* isolate() { return debug_->isolate_; } | 692 Isolate* isolate() { return debug_->isolate_; } |
| 690 | 693 |
| 691 Debug* debug_; | 694 Debug* debug_; |
| 692 DebugScope* prev_; // Previous scope if entered recursively. | 695 DebugScope* prev_; // Previous scope if entered recursively. |
| 693 StackFrame::Id break_frame_id_; // Previous break frame id. | 696 StackFrame::Id break_frame_id_; // Previous break frame id. |
| 694 int break_id_; // Previous break id. | 697 int break_id_; // Previous break id. |
| 695 Handle<Object> return_value_; // Previous result. | |
| 696 bool failed_; // Did the debug context fail to load? | 698 bool failed_; // Did the debug context fail to load? |
| 697 SaveContext save_; // Saves previous context. | 699 SaveContext save_; // Saves previous context. |
| 698 PostponeInterruptsScope no_termination_exceptons_; | 700 PostponeInterruptsScope no_termination_exceptons_; |
| 699 }; | 701 }; |
| 700 | 702 |
| 703 // This scope is used to handle return values in nested debug break points. |
| 704 // When there are nested debug breaks, we use this to restore the return |
| 705 // value to the previous state. This is not merged with DebugScope because |
| 706 // return_value_ will not be cleared when we use DebugScope. |
| 707 class ReturnValueScope { |
| 708 public: |
| 709 explicit ReturnValueScope(Debug* debug); |
| 710 ~ReturnValueScope(); |
| 711 |
| 712 private: |
| 713 Debug* debug_; |
| 714 Handle<Object> return_value_; // Previous result. |
| 715 }; |
| 701 | 716 |
| 702 // Stack allocated class for disabling break. | 717 // Stack allocated class for disabling break. |
| 703 class DisableBreak BASE_EMBEDDED { | 718 class DisableBreak BASE_EMBEDDED { |
| 704 public: | 719 public: |
| 705 explicit DisableBreak(Debug* debug) | 720 explicit DisableBreak(Debug* debug) |
| 706 : debug_(debug), previous_break_disabled_(debug->break_disabled_) { | 721 : debug_(debug), previous_break_disabled_(debug->break_disabled_) { |
| 707 debug_->break_disabled_ = true; | 722 debug_->break_disabled_ = true; |
| 708 } | 723 } |
| 709 ~DisableBreak() { | 724 ~DisableBreak() { |
| 710 debug_->break_disabled_ = previous_break_disabled_; | 725 debug_->break_disabled_ = previous_break_disabled_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 Handle<Code> code); | 788 Handle<Code> code); |
| 774 static bool DebugBreakSlotIsPatched(Address pc); | 789 static bool DebugBreakSlotIsPatched(Address pc); |
| 775 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 790 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
| 776 }; | 791 }; |
| 777 | 792 |
| 778 | 793 |
| 779 } // namespace internal | 794 } // namespace internal |
| 780 } // namespace v8 | 795 } // namespace v8 |
| 781 | 796 |
| 782 #endif // V8_DEBUG_DEBUG_H_ | 797 #endif // V8_DEBUG_DEBUG_H_ |
| OLD | NEW |