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_H_ | 5 #ifndef V8_DEBUG_H_ |
6 #define V8_DEBUG_H_ | 6 #define V8_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 14 matching lines...) Expand all Loading... |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 | 27 |
28 // Forward declarations. | 28 // Forward declarations. |
29 class DebugScope; | 29 class DebugScope; |
30 | 30 |
31 | 31 |
32 // Step actions. NOTE: These values are in macros.py as well. | 32 // Step actions. NOTE: These values are in macros.py as well. |
33 enum StepAction { | 33 enum StepAction { |
34 StepNone = -1, // Stepping not prepared. | 34 StepNone = -1, // Stepping not prepared. |
35 StepOut = 0, // Step out of the current function. | 35 StepOut = 0, // Step out of the current function. |
36 StepNext = 1, // Step to the next statement in the current function. | 36 StepNext = 1, // Step to the next statement in the current function. |
37 StepIn = 2, // Step into new functions invoked or the next statement | 37 StepIn = 2, // Step into new functions invoked or the next statement |
38 // in the current function. | 38 // in the current function. |
39 StepMin = 3, // Perform a minimum step in the current function. | 39 StepMin = 3, // Perform a minimum step in the current function. |
40 StepInMin = 4 // Step into new functions invoked or perform a minimum step | 40 StepInMin = 4, // Step into new functions invoked or perform a minimum step |
41 // in the current function. | 41 // in the current function. |
| 42 StepFrame = 5 // Step into a new frame or return to previous frame. |
42 }; | 43 }; |
43 | 44 |
44 | 45 |
45 // Type of exception break. NOTE: These values are in macros.py as well. | 46 // Type of exception break. NOTE: These values are in macros.py as well. |
46 enum ExceptionBreakType { | 47 enum ExceptionBreakType { |
47 BreakException = 0, | 48 BreakException = 0, |
48 BreakUncaughtException = 1 | 49 BreakUncaughtException = 1 |
49 }; | 50 }; |
50 | 51 |
51 | 52 |
52 // Type of exception break. NOTE: These values are in macros.py as well. | 53 // Type of exception break. |
53 enum BreakLocatorType { | 54 enum BreakLocatorType { |
54 ALL_BREAK_LOCATIONS = 0, | 55 ALL_BREAK_LOCATIONS = 0, |
55 SOURCE_BREAK_LOCATIONS = 1 | 56 SOURCE_BREAK_LOCATIONS = 1, |
| 57 CALLS_AND_RETURNS = 2, |
56 }; | 58 }; |
57 | 59 |
58 | 60 |
59 // The different types of breakpoint position alignments. | 61 // The different types of breakpoint position alignments. |
60 // Must match Debug.BreakPositionAlignment in debug-debugger.js | 62 // Must match Debug.BreakPositionAlignment in debug-debugger.js |
61 enum BreakPositionAlignment { | 63 enum BreakPositionAlignment { |
62 STATEMENT_ALIGNED = 0, | 64 STATEMENT_ALIGNED = 0, |
63 BREAK_POSITION_ALIGNED = 1 | 65 BREAK_POSITION_ALIGNED = 1 |
64 }; | 66 }; |
65 | 67 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // Break point handling. | 380 // Break point handling. |
379 bool SetBreakPoint(Handle<JSFunction> function, | 381 bool SetBreakPoint(Handle<JSFunction> function, |
380 Handle<Object> break_point_object, | 382 Handle<Object> break_point_object, |
381 int* source_position); | 383 int* source_position); |
382 bool SetBreakPointForScript(Handle<Script> script, | 384 bool SetBreakPointForScript(Handle<Script> script, |
383 Handle<Object> break_point_object, | 385 Handle<Object> break_point_object, |
384 int* source_position, | 386 int* source_position, |
385 BreakPositionAlignment alignment); | 387 BreakPositionAlignment alignment); |
386 void ClearBreakPoint(Handle<Object> break_point_object); | 388 void ClearBreakPoint(Handle<Object> break_point_object); |
387 void ClearAllBreakPoints(); | 389 void ClearAllBreakPoints(); |
388 void FloodWithOneShot(Handle<JSFunction> function); | 390 void FloodWithOneShot(Handle<JSFunction> function, |
| 391 BreakLocatorType type = ALL_BREAK_LOCATIONS); |
389 void FloodBoundFunctionWithOneShot(Handle<JSFunction> function); | 392 void FloodBoundFunctionWithOneShot(Handle<JSFunction> function); |
390 void FloodHandlerWithOneShot(); | 393 void FloodHandlerWithOneShot(); |
391 void ChangeBreakOnException(ExceptionBreakType type, bool enable); | 394 void ChangeBreakOnException(ExceptionBreakType type, bool enable); |
392 bool IsBreakOnException(ExceptionBreakType type); | 395 bool IsBreakOnException(ExceptionBreakType type); |
393 | 396 |
394 // Stepping handling. | 397 // Stepping handling. |
395 void PrepareStep(StepAction step_action, | 398 void PrepareStep(StepAction step_action, |
396 int step_count, | 399 int step_count, |
397 StackFrame::Id frame_id); | 400 StackFrame::Id frame_id); |
398 void ClearStepping(); | 401 void ClearStepping(); |
399 void ClearStepOut(); | 402 void ClearStepOut(); |
400 bool IsStepping() { return thread_local_.step_count_ > 0; } | 403 bool IsStepping() { return thread_local_.step_count_ > 0; } |
401 bool StepNextContinue(BreakLocationIterator* break_location_iterator, | 404 bool StepNextContinue(BreakLocationIterator* break_location_iterator, |
402 JavaScriptFrame* frame); | 405 JavaScriptFrame* frame); |
403 bool StepInActive() { return thread_local_.step_into_fp_ != 0; } | 406 bool StepInActive() { return thread_local_.step_into_fp_ != 0; } |
404 void HandleStepIn(Handle<JSFunction> function, | 407 void HandleStepIn(Handle<Object> function_obj, Handle<Object> holder, |
405 Handle<Object> holder, | 408 Address fp, bool is_constructor); |
406 Address fp, | |
407 bool is_constructor); | |
408 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } | 409 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } |
409 | 410 |
410 // Purge all code objects that have no debug break slots. | 411 // Purge all code objects that have no debug break slots. |
411 void PrepareForBreakPoints(); | 412 void PrepareForBreakPoints(); |
412 | 413 |
413 // Returns whether the operation succeeded. Compilation can only be triggered | 414 // Returns whether the operation succeeded. Compilation can only be triggered |
414 // if a valid closure is passed as the second argument, otherwise the shared | 415 // if a valid closure is passed as the second argument, otherwise the shared |
415 // function needs to be compiled already. | 416 // function needs to be compiled already. |
416 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 417 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
417 Handle<JSFunction> function); | 418 Handle<JSFunction> function); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 617 |
617 // Step action for last step performed. | 618 // Step action for last step performed. |
618 StepAction last_step_action_; | 619 StepAction last_step_action_; |
619 | 620 |
620 // Source statement position from last step next action. | 621 // Source statement position from last step next action. |
621 int last_statement_position_; | 622 int last_statement_position_; |
622 | 623 |
623 // Number of steps left to perform before debug event. | 624 // Number of steps left to perform before debug event. |
624 int step_count_; | 625 int step_count_; |
625 | 626 |
626 // Frame pointer from last step next action. | 627 // Frame pointer from last step next or step frame action. |
627 Address last_fp_; | 628 Address last_fp_; |
628 | 629 |
629 // Number of queued steps left to perform before debug event. | 630 // Number of queued steps left to perform before debug event. |
630 int queued_step_count_; | 631 int queued_step_count_; |
631 | 632 |
632 // Frame pointer for frame from which step in was performed. | 633 // Frame pointer for frame from which step in was performed. |
633 Address step_into_fp_; | 634 Address step_into_fp_; |
634 | 635 |
635 // Frame pointer for the frame where debugger should be called when current | 636 // Frame pointer for the frame where debugger should be called when current |
636 // step out action is completed. | 637 // step out action is completed. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // several frames above. | 747 // several frames above. |
747 // There is no calling conventions here, because it never actually gets | 748 // There is no calling conventions here, because it never actually gets |
748 // called, it only gets returned to. | 749 // called, it only gets returned to. |
749 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); | 750 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); |
750 }; | 751 }; |
751 | 752 |
752 | 753 |
753 } } // namespace v8::internal | 754 } } // namespace v8::internal |
754 | 755 |
755 #endif // V8_DEBUG_H_ | 756 #endif // V8_DEBUG_H_ |
OLD | NEW |