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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 Handle<Object> break_point_object, | 406 Handle<Object> break_point_object, |
407 int* source_position); | 407 int* source_position); |
408 bool SetBreakPointForScript(Handle<Script> script, | 408 bool SetBreakPointForScript(Handle<Script> script, |
409 Handle<Object> break_point_object, | 409 Handle<Object> break_point_object, |
410 int* source_position, | 410 int* source_position, |
411 BreakPositionAlignment alignment); | 411 BreakPositionAlignment alignment); |
412 void ClearBreakPoint(Handle<Object> break_point_object); | 412 void ClearBreakPoint(Handle<Object> break_point_object); |
413 void ClearAllBreakPoints(); | 413 void ClearAllBreakPoints(); |
414 void FloodWithOneShot(Handle<JSFunction> function, | 414 void FloodWithOneShot(Handle<JSFunction> function, |
415 BreakLocatorType type = ALL_BREAK_LOCATIONS); | 415 BreakLocatorType type = ALL_BREAK_LOCATIONS); |
416 void FloodBoundFunctionWithOneShot(Handle<JSFunction> function); | |
417 void FloodDefaultConstructorWithOneShot(Handle<JSFunction> function); | |
418 void FloodWithOneShotGeneric(Handle<JSFunction> function, | |
419 Handle<Object> holder = Handle<Object>()); | |
420 void FloodHandlerWithOneShot(); | 416 void FloodHandlerWithOneShot(); |
421 void ChangeBreakOnException(ExceptionBreakType type, bool enable); | 417 void ChangeBreakOnException(ExceptionBreakType type, bool enable); |
422 bool IsBreakOnException(ExceptionBreakType type); | 418 bool IsBreakOnException(ExceptionBreakType type); |
423 | 419 |
424 // Stepping handling. | 420 // Stepping handling. |
425 void PrepareStep(StepAction step_action, | 421 void PrepareStep(StepAction step_action, |
426 int step_count, | 422 int step_count, |
427 StackFrame::Id frame_id); | 423 StackFrame::Id frame_id); |
| 424 void PrepareStepIn(Handle<JSFunction> function); |
428 void ClearStepping(); | 425 void ClearStepping(); |
429 void ClearStepOut(); | 426 void ClearStepOut(); |
| 427 void EnableStepIn(); |
430 bool IsStepping() { return thread_local_.step_count_ > 0; } | 428 bool IsStepping() { return thread_local_.step_count_ > 0; } |
431 bool StepNextContinue(BreakLocation* location, JavaScriptFrame* frame); | 429 bool StepNextContinue(BreakLocation* location, JavaScriptFrame* frame); |
432 bool StepInActive() { return thread_local_.step_into_fp_ != 0; } | |
433 void HandleStepIn(Handle<Object> function_obj); | |
434 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } | 430 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } |
435 | 431 |
436 void GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id, | 432 void GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id, |
437 List<int>* results_out); | 433 List<int>* results_out); |
438 | 434 |
439 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); | 435 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
440 | 436 |
441 // Returns whether the operation succeeded. Compilation can only be triggered | 437 // Returns whether the operation succeeded. Compilation can only be triggered |
442 // if a valid closure is passed as the second argument, otherwise the shared | 438 // if a valid closure is passed as the second argument, otherwise the shared |
443 // function needs to be compiled already. | 439 // function needs to be compiled already. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 510 |
515 Address after_break_target_address() { | 511 Address after_break_target_address() { |
516 return reinterpret_cast<Address>(&after_break_target_); | 512 return reinterpret_cast<Address>(&after_break_target_); |
517 } | 513 } |
518 | 514 |
519 Address restarter_frame_function_pointer_address() { | 515 Address restarter_frame_function_pointer_address() { |
520 Object*** address = &thread_local_.restarter_frame_function_pointer_; | 516 Object*** address = &thread_local_.restarter_frame_function_pointer_; |
521 return reinterpret_cast<Address>(address); | 517 return reinterpret_cast<Address>(address); |
522 } | 518 } |
523 | 519 |
524 Address last_step_action_addr() { | 520 Address step_in_enabled_address() { |
525 return reinterpret_cast<Address>(&thread_local_.last_step_action_); | 521 return reinterpret_cast<Address>(&thread_local_.step_in_enabled_); |
526 } | 522 } |
527 | 523 |
528 StepAction last_step_action() { return thread_local_.last_step_action_; } | 524 StepAction last_step_action() { return thread_local_.last_step_action_; } |
529 | 525 |
530 DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } | 526 DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } |
531 | 527 |
532 private: | 528 private: |
533 explicit Debug(Isolate* isolate); | 529 explicit Debug(Isolate* isolate); |
534 | 530 |
535 void UpdateState(); | 531 void UpdateState(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 void ProcessDebugEvent(v8::DebugEvent event, | 572 void ProcessDebugEvent(v8::DebugEvent event, |
577 Handle<JSObject> event_data, | 573 Handle<JSObject> event_data, |
578 bool auto_continue); | 574 bool auto_continue); |
579 void NotifyMessageHandler(v8::DebugEvent event, | 575 void NotifyMessageHandler(v8::DebugEvent event, |
580 Handle<JSObject> exec_state, | 576 Handle<JSObject> exec_state, |
581 Handle<JSObject> event_data, | 577 Handle<JSObject> event_data, |
582 bool auto_continue); | 578 bool auto_continue); |
583 void InvokeMessageHandler(MessageImpl message); | 579 void InvokeMessageHandler(MessageImpl message); |
584 | 580 |
585 void ClearOneShot(); | 581 void ClearOneShot(); |
586 void ActivateStepIn(StackFrame* frame); | |
587 void ClearStepIn(); | |
588 void ActivateStepOut(StackFrame* frame); | 582 void ActivateStepOut(StackFrame* frame); |
589 void ClearStepNext(); | |
590 void RemoveDebugInfoAndClearFromShared(Handle<DebugInfo> debug_info); | 583 void RemoveDebugInfoAndClearFromShared(Handle<DebugInfo> debug_info); |
591 Handle<Object> CheckBreakPoints(Handle<Object> break_point); | 584 Handle<Object> CheckBreakPoints(Handle<Object> break_point); |
592 bool CheckBreakPoint(Handle<Object> break_point_object); | 585 bool CheckBreakPoint(Handle<Object> break_point_object); |
593 MaybeHandle<Object> CallFunction(const char* name, int argc, | 586 MaybeHandle<Object> CallFunction(const char* name, int argc, |
594 Handle<Object> args[]); | 587 Handle<Object> args[]); |
595 | 588 |
596 inline void AssertDebugContext() { | 589 inline void AssertDebugContext() { |
597 DCHECK(isolate_->context() == *debug_context()); | 590 DCHECK(isolate_->context() == *debug_context()); |
598 DCHECK(in_debug_scope()); | 591 DCHECK(in_debug_scope()); |
599 } | 592 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 646 |
654 // Number of steps left to perform before debug event. | 647 // Number of steps left to perform before debug event. |
655 int step_count_; | 648 int step_count_; |
656 | 649 |
657 // Frame pointer from last step next or step frame action. | 650 // Frame pointer from last step next or step frame action. |
658 Address last_fp_; | 651 Address last_fp_; |
659 | 652 |
660 // Number of queued steps left to perform before debug event. | 653 // Number of queued steps left to perform before debug event. |
661 int queued_step_count_; | 654 int queued_step_count_; |
662 | 655 |
663 // Frame pointer for frame from which step in was performed. | |
664 Address step_into_fp_; | |
665 | |
666 // Frame pointer for the frame where debugger should be called when current | 656 // Frame pointer for the frame where debugger should be called when current |
667 // step out action is completed. | 657 // step out action is completed. |
668 Address step_out_fp_; | 658 Address step_out_fp_; |
669 | 659 |
| 660 // Whether functions are flooded on entry for step-in and step-frame. |
| 661 // If we stepped out to the embedder, disable flooding to spill stepping |
| 662 // to the next call that the embedder makes. |
| 663 bool step_in_enabled_; |
| 664 |
670 // Stores the way how LiveEdit has patched the stack. It is used when | 665 // Stores the way how LiveEdit has patched the stack. It is used when |
671 // debugger returns control back to user script. | 666 // debugger returns control back to user script. |
672 LiveEdit::FrameDropMode frame_drop_mode_; | 667 LiveEdit::FrameDropMode frame_drop_mode_; |
673 | 668 |
674 // When restarter frame is on stack, stores the address | 669 // When restarter frame is on stack, stores the address |
675 // of the pointer to function being restarted. Otherwise (most of the time) | 670 // of the pointer to function being restarted. Otherwise (most of the time) |
676 // stores NULL. This pointer is used with 'step in' implementation. | 671 // stores NULL. This pointer is used with 'step in' implementation. |
677 Object** restarter_frame_function_pointer_; | 672 Object** restarter_frame_function_pointer_; |
678 }; | 673 }; |
679 | 674 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 780 |
786 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); | 781 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); |
787 static void ClearDebugBreakSlot(Address pc); | 782 static void ClearDebugBreakSlot(Address pc); |
788 }; | 783 }; |
789 | 784 |
790 | 785 |
791 } // namespace internal | 786 } // namespace internal |
792 } // namespace v8 | 787 } // namespace v8 |
793 | 788 |
794 #endif // V8_DEBUG_DEBUG_H_ | 789 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |