| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_DEBUGGER_H_ | 5 #ifndef RUNTIME_VM_DEBUGGER_H_ |
| 6 #define RUNTIME_VM_DEBUGGER_H_ | 6 #define RUNTIME_VM_DEBUGGER_H_ |
| 7 | 7 |
| 8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
| 9 | 9 |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 RawObject* GetAsyncOperation(); | 329 RawObject* GetAsyncOperation(); |
| 330 | 330 |
| 331 RawObject* Evaluate(const String& expr); | 331 RawObject* Evaluate(const String& expr); |
| 332 | 332 |
| 333 // Print the activation frame into |jsobj|. if |full| is false, script | 333 // Print the activation frame into |jsobj|. if |full| is false, script |
| 334 // and local variable objects are only references. if |full| is true, | 334 // and local variable objects are only references. if |full| is true, |
| 335 // the complete script, function, and, local variable objects are included. | 335 // the complete script, function, and, local variable objects are included. |
| 336 void PrintToJSONObject(JSONObject* jsobj, bool full = false); | 336 void PrintToJSONObject(JSONObject* jsobj, bool full = false); |
| 337 | 337 |
| 338 RawObject* GetAsyncAwaiter(); | 338 RawObject* GetAsyncAwaiter(); |
| 339 RawObject* GetCausalStack(); |
| 339 | 340 |
| 340 bool HandlesException(const Instance& exc_obj); | 341 bool HandlesException(const Instance& exc_obj); |
| 341 | 342 |
| 342 private: | 343 private: |
| 343 void PrintToJSONObjectRegular(JSONObject* jsobj, bool full); | 344 void PrintToJSONObjectRegular(JSONObject* jsobj, bool full); |
| 344 void PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full); | 345 void PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full); |
| 345 void PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, bool full); | 346 void PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, bool full); |
| 346 | 347 void PrintToJSONObjectAsyncActivation(JSONObject* jsobj, bool full); |
| 347 void PrintContextMismatchError(intptr_t ctx_slot, | 348 void PrintContextMismatchError(intptr_t ctx_slot, |
| 348 intptr_t frame_ctx_level, | 349 intptr_t frame_ctx_level, |
| 349 intptr_t var_ctx_level); | 350 intptr_t var_ctx_level); |
| 350 | 351 |
| 351 intptr_t TryIndex(); | 352 intptr_t TryIndex(); |
| 352 void GetPcDescriptors(); | 353 void GetPcDescriptors(); |
| 353 void GetVarDescriptors(); | 354 void GetVarDescriptors(); |
| 354 void GetDescIndices(); | 355 void GetDescIndices(); |
| 355 | 356 |
| 356 RawObject* GetAsyncContextVariable(const String& name); | 357 RawObject* GetAsyncContextVariable(const String& name); |
| 357 RawObject* GetAsyncStreamControllerStreamAwaiter(const Object& stream); | 358 RawObject* GetAsyncStreamControllerStreamAwaiter(const Object& stream); |
| 358 RawObject* GetAsyncStreamControllerStream(); | 359 RawObject* GetAsyncStreamControllerStream(); |
| 359 RawObject* GetAsyncCompleterAwaiter(const Object& completer); | 360 RawObject* GetAsyncCompleterAwaiter(const Object& completer); |
| 360 RawObject* GetAsyncCompleter(); | 361 RawObject* GetAsyncCompleter(); |
| 361 void ExtractTokenPositionFromAsyncClosure(); | 362 void ExtractTokenPositionFromAsyncClosure(); |
| 362 | 363 |
| 363 static const char* KindToCString(Kind kind) { | 364 static const char* KindToCString(Kind kind) { |
| 364 switch (kind) { | 365 switch (kind) { |
| 365 case kRegular: | 366 case kRegular: |
| 366 return "Regular"; | 367 return "Regular"; |
| 367 case kAsyncCausal: | 368 case kAsyncCausal: |
| 368 return "AsyncCausal"; | 369 return "AsyncCausal"; |
| 369 case kAsyncSuspensionMarker: | 370 case kAsyncSuspensionMarker: |
| 370 return "AsyncSuspensionMarker"; | 371 return "AsyncSuspensionMarker"; |
| 372 case kAsyncActivation: |
| 373 return "AsyncActivation"; |
| 371 default: | 374 default: |
| 372 UNREACHABLE(); | 375 UNREACHABLE(); |
| 373 return ""; | 376 return ""; |
| 374 } | 377 } |
| 375 } | 378 } |
| 376 | 379 |
| 377 RawObject* GetStackVar(intptr_t slot_index); | 380 RawObject* GetStackVar(intptr_t slot_index); |
| 378 RawObject* GetContextVar(intptr_t ctxt_level, intptr_t slot_index); | 381 RawObject* GetContextVar(intptr_t ctxt_level, intptr_t slot_index); |
| 379 | 382 |
| 380 uword pc_; | 383 uword pc_; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // Returns a stack trace with frames corresponding to invisible functions | 537 // Returns a stack trace with frames corresponding to invisible functions |
| 535 // omitted. CurrentStackTrace always returns a new trace on the current stack. | 538 // omitted. CurrentStackTrace always returns a new trace on the current stack. |
| 536 // The trace returned by StackTrace may have been cached; it is suitable for | 539 // The trace returned by StackTrace may have been cached; it is suitable for |
| 537 // use when stepping, but otherwise may be out of sync with the current stack. | 540 // use when stepping, but otherwise may be out of sync with the current stack. |
| 538 DebuggerStackTrace* StackTrace(); | 541 DebuggerStackTrace* StackTrace(); |
| 539 DebuggerStackTrace* CurrentStackTrace(); | 542 DebuggerStackTrace* CurrentStackTrace(); |
| 540 | 543 |
| 541 DebuggerStackTrace* AsyncCausalStackTrace(); | 544 DebuggerStackTrace* AsyncCausalStackTrace(); |
| 542 DebuggerStackTrace* CurrentAsyncCausalStackTrace(); | 545 DebuggerStackTrace* CurrentAsyncCausalStackTrace(); |
| 543 | 546 |
| 547 DebuggerStackTrace* AwaiterStackTrace(); |
| 548 DebuggerStackTrace* CurrentAwaiterStackTrace(); |
| 549 |
| 544 // Returns a debugger stack trace corresponding to a dart.core.StackTrace. | 550 // Returns a debugger stack trace corresponding to a dart.core.StackTrace. |
| 545 // Frames corresponding to invisible functions are omitted. It is not valid | 551 // Frames corresponding to invisible functions are omitted. It is not valid |
| 546 // to query local variables in the returned stack. | 552 // to query local variables in the returned stack. |
| 547 DebuggerStackTrace* StackTraceFrom(const class StackTrace& dart_stacktrace); | 553 DebuggerStackTrace* StackTraceFrom(const class StackTrace& dart_stacktrace); |
| 548 | 554 |
| 549 RawArray* GetInstanceFields(const Instance& obj); | 555 RawArray* GetInstanceFields(const Instance& obj); |
| 550 RawArray* GetStaticFields(const Class& cls); | 556 RawArray* GetStaticFields(const Class& cls); |
| 551 RawArray* GetLibraryFields(const Library& lib); | 557 RawArray* GetLibraryFields(const Library& lib); |
| 552 RawArray* GetGlobalFields(const Library& lib); | 558 RawArray* GetGlobalFields(const Library& lib); |
| 553 | 559 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 bool include_private_fields); | 692 bool include_private_fields); |
| 687 | 693 |
| 688 // Handles any events which pause vm execution. Breakpoints, | 694 // Handles any events which pause vm execution. Breakpoints, |
| 689 // interrupts, etc. | 695 // interrupts, etc. |
| 690 void Pause(ServiceEvent* event); | 696 void Pause(ServiceEvent* event); |
| 691 | 697 |
| 692 void HandleSteppingRequest(DebuggerStackTrace* stack_trace, | 698 void HandleSteppingRequest(DebuggerStackTrace* stack_trace, |
| 693 bool skip_next_step = false); | 699 bool skip_next_step = false); |
| 694 | 700 |
| 695 void CacheStackTraces(DebuggerStackTrace* stack_trace, | 701 void CacheStackTraces(DebuggerStackTrace* stack_trace, |
| 696 DebuggerStackTrace* async_causal_stack_trace); | 702 DebuggerStackTrace* async_causal_stack_trace, |
| 703 DebuggerStackTrace* awaiter_stack_trace); |
| 697 void ClearCachedStackTraces(); | 704 void ClearCachedStackTraces(); |
| 698 | 705 |
| 699 | 706 |
| 700 // Can we rewind to the indicated frame? | 707 // Can we rewind to the indicated frame? |
| 701 bool CanRewindFrame(intptr_t frame_index, const char** error) const; | 708 bool CanRewindFrame(intptr_t frame_index, const char** error) const; |
| 702 | 709 |
| 703 void RewindToFrame(intptr_t frame_index); | 710 void RewindToFrame(intptr_t frame_index); |
| 704 void RewindToUnoptimizedFrame(StackFrame* frame, const Code& code); | 711 void RewindToUnoptimizedFrame(StackFrame* frame, const Code& code); |
| 705 void RewindToOptimizedFrame(StackFrame* frame, | 712 void RewindToOptimizedFrame(StackFrame* frame, |
| 706 const Code& code, | 713 const Code& code, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 732 // paused for breakpoints, isolate interruption, and (sometimes) | 739 // paused for breakpoints, isolate interruption, and (sometimes) |
| 733 // exceptions. | 740 // exceptions. |
| 734 ServiceEvent* pause_event_; | 741 ServiceEvent* pause_event_; |
| 735 | 742 |
| 736 // An id -> object map. Valid only while IsPaused(). | 743 // An id -> object map. Valid only while IsPaused(). |
| 737 RemoteObjectCache* obj_cache_; | 744 RemoteObjectCache* obj_cache_; |
| 738 | 745 |
| 739 // Current stack trace. Valid only while IsPaused(). | 746 // Current stack trace. Valid only while IsPaused(). |
| 740 DebuggerStackTrace* stack_trace_; | 747 DebuggerStackTrace* stack_trace_; |
| 741 DebuggerStackTrace* async_causal_stack_trace_; | 748 DebuggerStackTrace* async_causal_stack_trace_; |
| 749 DebuggerStackTrace* awaiter_stack_trace_; |
| 742 | 750 |
| 743 // When stepping through code, only pause the program if the top | 751 // When stepping through code, only pause the program if the top |
| 744 // frame corresponds to this fp value, or if the top frame is | 752 // frame corresponds to this fp value, or if the top frame is |
| 745 // lower on the stack. | 753 // lower on the stack. |
| 746 uword stepping_fp_; | 754 uword stepping_fp_; |
| 747 | 755 |
| 748 // If we step while at a breakpoint, we would hit the same pc twice. | 756 // If we step while at a breakpoint, we would hit the same pc twice. |
| 749 // We use this field to let us skip the next single-step after a | 757 // We use this field to let us skip the next single-step after a |
| 750 // breakpoint. | 758 // breakpoint. |
| 751 bool skip_next_step_; | 759 bool skip_next_step_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 763 | 771 |
| 764 friend class Isolate; | 772 friend class Isolate; |
| 765 friend class BreakpointLocation; | 773 friend class BreakpointLocation; |
| 766 DISALLOW_COPY_AND_ASSIGN(Debugger); | 774 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 767 }; | 775 }; |
| 768 | 776 |
| 769 | 777 |
| 770 } // namespace dart | 778 } // namespace dart |
| 771 | 779 |
| 772 #endif // RUNTIME_VM_DEBUGGER_H_ | 780 #endif // RUNTIME_VM_DEBUGGER_H_ |
| OLD | NEW |