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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 void ClearBreakPoint(Handle<Object> break_point_object); | 449 void ClearBreakPoint(Handle<Object> break_point_object); |
450 void ClearAllBreakPoints(); | 450 void ClearAllBreakPoints(); |
451 void FloodWithOneShot(Handle<JSFunction> function, | 451 void FloodWithOneShot(Handle<JSFunction> function, |
452 BreakLocatorType type = ALL_BREAK_LOCATIONS); | 452 BreakLocatorType type = ALL_BREAK_LOCATIONS); |
453 void ChangeBreakOnException(ExceptionBreakType type, bool enable); | 453 void ChangeBreakOnException(ExceptionBreakType type, bool enable); |
454 bool IsBreakOnException(ExceptionBreakType type); | 454 bool IsBreakOnException(ExceptionBreakType type); |
455 | 455 |
456 // Stepping handling. | 456 // Stepping handling. |
457 void PrepareStep(StepAction step_action); | 457 void PrepareStep(StepAction step_action); |
458 void PrepareStepIn(Handle<JSFunction> function); | 458 void PrepareStepIn(Handle<JSFunction> function); |
| 459 void PrepareStepInSuspendedGenerator(); |
459 void PrepareStepOnThrow(); | 460 void PrepareStepOnThrow(); |
460 void ClearStepping(); | 461 void ClearStepping(); |
461 void ClearStepOut(); | 462 void ClearStepOut(); |
462 void EnableStepIn(); | 463 void EnableStepIn(); |
463 | 464 |
464 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); | 465 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
465 | 466 |
| 467 void RecordAsyncFunction(Handle<JSGeneratorObject> generator_object); |
| 468 |
466 // Returns whether the operation succeeded. Compilation can only be triggered | 469 // Returns whether the operation succeeded. Compilation can only be triggered |
467 // if a valid closure is passed as the second argument, otherwise the shared | 470 // if a valid closure is passed as the second argument, otherwise the shared |
468 // function needs to be compiled already. | 471 // function needs to be compiled already. |
469 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 472 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
470 Handle<JSFunction> function); | 473 Handle<JSFunction> function); |
471 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); | 474 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); |
472 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); | 475 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
473 | 476 |
474 template <typename C> | 477 template <typename C> |
475 bool CompileToRevealInnerFunctions(C* compilable); | 478 bool CompileToRevealInnerFunctions(C* compilable); |
(...skipping 14 matching lines...) Expand all Loading... |
490 | 493 |
491 // Support for LiveEdit | 494 // Support for LiveEdit |
492 void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, | 495 void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
493 LiveEdit::FrameDropMode mode); | 496 LiveEdit::FrameDropMode mode); |
494 | 497 |
495 // Threading support. | 498 // Threading support. |
496 char* ArchiveDebug(char* to); | 499 char* ArchiveDebug(char* to); |
497 char* RestoreDebug(char* from); | 500 char* RestoreDebug(char* from); |
498 static int ArchiveSpacePerThread(); | 501 static int ArchiveSpacePerThread(); |
499 void FreeThreadResources() { } | 502 void FreeThreadResources() { } |
| 503 void Iterate(ObjectVisitor* v); |
500 | 504 |
501 bool CheckExecutionState(int id) { | 505 bool CheckExecutionState(int id) { |
502 return is_active() && !debug_context().is_null() && break_id() != 0 && | 506 return is_active() && !debug_context().is_null() && break_id() != 0 && |
503 break_id() == id; | 507 break_id() == id; |
504 } | 508 } |
505 | 509 |
506 // Flags and states. | 510 // Flags and states. |
507 DebugScope* debugger_entry() { | 511 DebugScope* debugger_entry() { |
508 return reinterpret_cast<DebugScope*>( | 512 return reinterpret_cast<DebugScope*>( |
509 base::NoBarrier_Load(&thread_local_.current_debug_scope_)); | 513 base::NoBarrier_Load(&thread_local_.current_debug_scope_)); |
(...skipping 27 matching lines...) Expand all Loading... |
537 } | 541 } |
538 | 542 |
539 Address after_break_target_address() { | 543 Address after_break_target_address() { |
540 return reinterpret_cast<Address>(&after_break_target_); | 544 return reinterpret_cast<Address>(&after_break_target_); |
541 } | 545 } |
542 | 546 |
543 Address step_in_enabled_address() { | 547 Address step_in_enabled_address() { |
544 return reinterpret_cast<Address>(&thread_local_.step_in_enabled_); | 548 return reinterpret_cast<Address>(&thread_local_.step_in_enabled_); |
545 } | 549 } |
546 | 550 |
| 551 Address suspended_generator_address() { |
| 552 return reinterpret_cast<Address>(&thread_local_.suspended_generator_); |
| 553 } |
| 554 |
547 StepAction last_step_action() { return thread_local_.last_step_action_; } | 555 StepAction last_step_action() { return thread_local_.last_step_action_; } |
548 | 556 |
549 DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } | 557 DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } |
550 | 558 |
551 private: | 559 private: |
552 explicit Debug(Isolate* isolate); | 560 explicit Debug(Isolate* isolate); |
553 | 561 |
554 void UpdateState(); | 562 void UpdateState(); |
555 void Unload(); | 563 void Unload(); |
556 void SetNextBreakId() { | 564 void SetNextBreakId() { |
557 thread_local_.break_id_ = ++thread_local_.break_count_; | 565 thread_local_.break_id_ = ++thread_local_.break_count_; |
558 } | 566 } |
559 | 567 |
560 // Check whether there are commands in the command queue. | 568 // Check whether there are commands in the command queue. |
561 inline bool has_commands() const { return !command_queue_.IsEmpty(); } | 569 inline bool has_commands() const { return !command_queue_.IsEmpty(); } |
562 inline bool ignore_events() const { return is_suppressed_ || !is_active_; } | 570 inline bool ignore_events() const { return is_suppressed_ || !is_active_; } |
563 inline bool break_disabled() const { | 571 inline bool break_disabled() const { |
564 return break_disabled_ || in_debug_event_listener_; | 572 return break_disabled_ || in_debug_event_listener_; |
565 } | 573 } |
566 | 574 |
| 575 void clear_suspended_generator() { |
| 576 thread_local_.suspended_generator_ = Smi::FromInt(0); |
| 577 } |
| 578 |
| 579 bool has_suspended_generator() const { |
| 580 return thread_local_.suspended_generator_ != Smi::FromInt(0); |
| 581 } |
| 582 |
567 void OnException(Handle<Object> exception, Handle<Object> promise); | 583 void OnException(Handle<Object> exception, Handle<Object> promise); |
568 | 584 |
569 // Constructors for debug event objects. | 585 // Constructors for debug event objects. |
570 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); | 586 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); |
571 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( | 587 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( |
572 Handle<Object> break_points_hit); | 588 Handle<Object> break_points_hit); |
573 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( | 589 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( |
574 Handle<Object> exception, | 590 Handle<Object> exception, |
575 bool uncaught, | 591 bool uncaught, |
576 Handle<Object> promise); | 592 Handle<Object> promise); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 // to the next call that the embedder makes. | 696 // to the next call that the embedder makes. |
681 bool step_in_enabled_; | 697 bool step_in_enabled_; |
682 | 698 |
683 // Stores the way how LiveEdit has patched the stack. It is used when | 699 // Stores the way how LiveEdit has patched the stack. It is used when |
684 // debugger returns control back to user script. | 700 // debugger returns control back to user script. |
685 LiveEdit::FrameDropMode frame_drop_mode_; | 701 LiveEdit::FrameDropMode frame_drop_mode_; |
686 | 702 |
687 // Value of accumulator in interpreter frames. In non-interpreter frames | 703 // Value of accumulator in interpreter frames. In non-interpreter frames |
688 // this value will be the hole. | 704 // this value will be the hole. |
689 Handle<Object> return_value_; | 705 Handle<Object> return_value_; |
| 706 |
| 707 Object* suspended_generator_; |
690 }; | 708 }; |
691 | 709 |
692 // Storage location for registers when handling debug break calls | 710 // Storage location for registers when handling debug break calls |
693 ThreadLocal thread_local_; | 711 ThreadLocal thread_local_; |
694 | 712 |
695 Isolate* isolate_; | 713 Isolate* isolate_; |
696 | 714 |
697 friend class Isolate; | 715 friend class Isolate; |
698 friend class DebugScope; | 716 friend class DebugScope; |
699 friend class DisableBreak; | 717 friend class DisableBreak; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 Handle<Code> code); | 815 Handle<Code> code); |
798 static bool DebugBreakSlotIsPatched(Address pc); | 816 static bool DebugBreakSlotIsPatched(Address pc); |
799 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 817 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
800 }; | 818 }; |
801 | 819 |
802 | 820 |
803 } // namespace internal | 821 } // namespace internal |
804 } // namespace v8 | 822 } // namespace v8 |
805 | 823 |
806 #endif // V8_DEBUG_DEBUG_H_ | 824 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |