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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 enum DebugBreakType { | 65 enum DebugBreakType { |
66 NOT_DEBUG_BREAK, | 66 NOT_DEBUG_BREAK, |
67 DEBUGGER_STATEMENT, | 67 DEBUGGER_STATEMENT, |
68 DEBUG_BREAK_SLOT, | 68 DEBUG_BREAK_SLOT, |
69 DEBUG_BREAK_SLOT_AT_CALL, | 69 DEBUG_BREAK_SLOT_AT_CALL, |
70 DEBUG_BREAK_SLOT_AT_RETURN, | 70 DEBUG_BREAK_SLOT_AT_RETURN, |
71 DEBUG_BREAK_SLOT_AT_TAIL_CALL, | 71 DEBUG_BREAK_SLOT_AT_TAIL_CALL, |
72 }; | 72 }; |
73 | 73 |
| 74 const int kDebugPromiseNoID = 0; |
| 75 const int kDebugPromiseFirstID = 1; |
| 76 |
| 77 enum PromiseDebugActionName { |
| 78 kDebugNotActive, |
| 79 kDebugAsyncFunction, |
| 80 kDebugPromiseResolve, |
| 81 kDebugPromiseReject, |
| 82 kDebugPromiseResolveThenableJob, |
| 83 }; |
| 84 |
| 85 enum PromiseDebugActionType { |
| 86 kDebugEnqueue, |
| 87 kDebugEnqueueRecurring, |
| 88 kDebugCancel, |
| 89 kDebugWillHandle, |
| 90 kDebugDidHandle, |
| 91 }; |
| 92 |
74 class BreakLocation { | 93 class BreakLocation { |
75 public: | 94 public: |
76 static BreakLocation FromFrame(Handle<DebugInfo> debug_info, | 95 static BreakLocation FromFrame(Handle<DebugInfo> debug_info, |
77 JavaScriptFrame* frame); | 96 JavaScriptFrame* frame); |
78 | 97 |
79 static void AllAtCurrentStatement(Handle<DebugInfo> debug_info, | 98 static void AllAtCurrentStatement(Handle<DebugInfo> debug_info, |
80 JavaScriptFrame* frame, | 99 JavaScriptFrame* frame, |
81 List<BreakLocation>* result_out); | 100 List<BreakLocation>* result_out); |
82 | 101 |
83 inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } | 102 inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // DebugInfo. | 419 // DebugInfo. |
401 class Debug { | 420 class Debug { |
402 public: | 421 public: |
403 // Debug event triggers. | 422 // Debug event triggers. |
404 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); | 423 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); |
405 | 424 |
406 void OnThrow(Handle<Object> exception); | 425 void OnThrow(Handle<Object> exception); |
407 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); | 426 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); |
408 void OnCompileError(Handle<Script> script); | 427 void OnCompileError(Handle<Script> script); |
409 void OnAfterCompile(Handle<Script> script); | 428 void OnAfterCompile(Handle<Script> script); |
410 void OnAsyncTaskEvent(Handle<String> type, Handle<Object> id, | 429 void OnAsyncTaskEvent(PromiseDebugActionType type, int id, |
411 Handle<String> name); | 430 PromiseDebugActionName name); |
412 | 431 |
413 // API facing. | 432 // API facing. |
414 void SetEventListener(Handle<Object> callback, Handle<Object> data); | 433 void SetEventListener(Handle<Object> callback, Handle<Object> data); |
415 void SetMessageHandler(v8::Debug::MessageHandler handler); | 434 void SetMessageHandler(v8::Debug::MessageHandler handler); |
416 void EnqueueCommandMessage(Vector<const uint16_t> command, | 435 void EnqueueCommandMessage(Vector<const uint16_t> command, |
417 v8::Debug::ClientData* client_data = NULL); | 436 v8::Debug::ClientData* client_data = NULL); |
418 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, | 437 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, |
419 Handle<Object> data); | 438 Handle<Object> data); |
420 Handle<Context> GetDebugContext(); | 439 Handle<Context> GetDebugContext(); |
421 void HandleDebugBreak(); | 440 void HandleDebugBreak(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 // Constructors for debug event objects. | 596 // Constructors for debug event objects. |
578 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); | 597 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); |
579 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( | 598 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( |
580 Handle<Object> break_points_hit); | 599 Handle<Object> break_points_hit); |
581 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( | 600 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( |
582 Handle<Object> exception, | 601 Handle<Object> exception, |
583 bool uncaught, | 602 bool uncaught, |
584 Handle<Object> promise); | 603 Handle<Object> promise); |
585 MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent( | 604 MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent( |
586 Handle<Script> script, v8::DebugEvent type); | 605 Handle<Script> script, v8::DebugEvent type); |
587 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(Handle<String> type, | 606 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(Handle<Smi> type, |
588 Handle<Object> id, | 607 Handle<Smi> id, |
589 Handle<String> name); | 608 Handle<Smi> name); |
590 | 609 |
591 // Mirror cache handling. | 610 // Mirror cache handling. |
592 void ClearMirrorCache(); | 611 void ClearMirrorCache(); |
593 | 612 |
594 void CallEventCallback(v8::DebugEvent event, | 613 void CallEventCallback(v8::DebugEvent event, |
595 Handle<Object> exec_state, | 614 Handle<Object> exec_state, |
596 Handle<Object> event_data, | 615 Handle<Object> event_data, |
597 v8::Debug::ClientData* client_data); | 616 v8::Debug::ClientData* client_data); |
598 void ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script); | 617 void ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script); |
599 void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data, | 618 void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 Handle<Code> code); | 831 Handle<Code> code); |
813 static bool DebugBreakSlotIsPatched(Address pc); | 832 static bool DebugBreakSlotIsPatched(Address pc); |
814 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 833 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
815 }; | 834 }; |
816 | 835 |
817 | 836 |
818 } // namespace internal | 837 } // namespace internal |
819 } // namespace v8 | 838 } // namespace v8 |
820 | 839 |
821 #endif // V8_DEBUG_DEBUG_H_ | 840 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |