| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 | 254 |
| 255 // ActivationFrame represents one dart function activation frame | 255 // ActivationFrame represents one dart function activation frame |
| 256 // on the call stack. | 256 // on the call stack. |
| 257 class ActivationFrame : public ZoneAllocated { | 257 class ActivationFrame : public ZoneAllocated { |
| 258 public: | 258 public: |
| 259 enum Kind { | 259 enum Kind { |
| 260 kRegular, | 260 kRegular, |
| 261 kAsyncSuspensionMarker, | 261 kAsyncSuspensionMarker, |
| 262 kAsyncCausal, | 262 kAsyncCausal, |
| 263 kAsyncActivation, | |
| 264 }; | 263 }; |
| 265 | 264 |
| 266 ActivationFrame(uword pc, | 265 ActivationFrame(uword pc, |
| 267 uword fp, | 266 uword fp, |
| 268 uword sp, | 267 uword sp, |
| 269 const Code& code, | 268 const Code& code, |
| 270 const Array& deopt_frame, | 269 const Array& deopt_frame, |
| 271 intptr_t deopt_frame_offset, | 270 intptr_t deopt_frame_offset, |
| 272 Kind kind = kRegular); | 271 Kind kind = kRegular); |
| 273 | 272 |
| 274 ActivationFrame(uword pc, const Code& code); | 273 ActivationFrame(uword pc, const Code& code); |
| 275 | 274 |
| 276 explicit ActivationFrame(Kind kind); | 275 explicit ActivationFrame(Kind kind); |
| 277 | 276 |
| 278 explicit ActivationFrame(const Closure& async_activation); | |
| 279 | |
| 280 uword pc() const { return pc_; } | 277 uword pc() const { return pc_; } |
| 281 uword fp() const { return fp_; } | 278 uword fp() const { return fp_; } |
| 282 uword sp() const { return sp_; } | 279 uword sp() const { return sp_; } |
| 283 const Function& function() const { | 280 const Function& function() const { |
| 284 ASSERT(!function_.IsNull()); | 281 ASSERT(!function_.IsNull()); |
| 285 return function_; | 282 return function_; |
| 286 } | 283 } |
| 287 const Code& code() const { | 284 const Code& code() const { |
| 288 ASSERT(!code_.IsNull()); | 285 ASSERT(!code_.IsNull()); |
| 289 return code_; | 286 return code_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 const Context& GetSavedCurrentContext(); | 325 const Context& GetSavedCurrentContext(); |
| 329 RawObject* GetAsyncOperation(); | 326 RawObject* GetAsyncOperation(); |
| 330 | 327 |
| 331 RawObject* Evaluate(const String& expr); | 328 RawObject* Evaluate(const String& expr); |
| 332 | 329 |
| 333 // Print the activation frame into |jsobj|. if |full| is false, script | 330 // Print the activation frame into |jsobj|. if |full| is false, script |
| 334 // and local variable objects are only references. if |full| is true, | 331 // and local variable objects are only references. if |full| is true, |
| 335 // the complete script, function, and, local variable objects are included. | 332 // the complete script, function, and, local variable objects are included. |
| 336 void PrintToJSONObject(JSONObject* jsobj, bool full = false); | 333 void PrintToJSONObject(JSONObject* jsobj, bool full = false); |
| 337 | 334 |
| 338 RawObject* GetAsyncAwaiter(); | |
| 339 | |
| 340 bool HandlesException(const Instance& exc_obj); | |
| 341 | |
| 342 private: | 335 private: |
| 343 void PrintToJSONObjectRegular(JSONObject* jsobj, bool full); | 336 void PrintToJSONObjectRegular(JSONObject* jsobj, bool full); |
| 344 void PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full); | 337 void PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full); |
| 345 void PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, bool full); | 338 void PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj, bool full); |
| 346 | 339 |
| 347 void PrintContextMismatchError(intptr_t ctx_slot, | 340 void PrintContextMismatchError(intptr_t ctx_slot, |
| 348 intptr_t frame_ctx_level, | 341 intptr_t frame_ctx_level, |
| 349 intptr_t var_ctx_level); | 342 intptr_t var_ctx_level); |
| 350 | 343 |
| 351 intptr_t TryIndex(); | 344 intptr_t TryIndex(); |
| 352 void GetPcDescriptors(); | 345 void GetPcDescriptors(); |
| 353 void GetVarDescriptors(); | 346 void GetVarDescriptors(); |
| 354 void GetDescIndices(); | 347 void GetDescIndices(); |
| 355 | 348 |
| 356 RawObject* GetAsyncStreamControllerStreamAwaiter(const Object& stream); | |
| 357 RawObject* GetAsyncStreamControllerStream(); | |
| 358 RawObject* GetAsyncCompleterAwaiter(const Object& completer); | |
| 359 RawObject* GetAsyncCompleter(); | |
| 360 void ExtractTokenPositionFromAsyncClosure(); | |
| 361 | |
| 362 static const char* KindToCString(Kind kind) { | 349 static const char* KindToCString(Kind kind) { |
| 363 switch (kind) { | 350 switch (kind) { |
| 364 case kRegular: | 351 case kRegular: |
| 365 return "Regular"; | 352 return "Regular"; |
| 366 case kAsyncCausal: | 353 case kAsyncCausal: |
| 367 return "AsyncCausal"; | 354 return "AsyncCausal"; |
| 368 case kAsyncSuspensionMarker: | 355 case kAsyncSuspensionMarker: |
| 369 return "AsyncSuspensionMarker"; | 356 return "AsyncSuspensionMarker"; |
| 370 default: | 357 default: |
| 371 UNREACHABLE(); | 358 UNREACHABLE(); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 BreakpointLocation* GetBreakpointLocation(const Script& script, | 620 BreakpointLocation* GetBreakpointLocation(const Script& script, |
| 634 TokenPosition token_pos, | 621 TokenPosition token_pos, |
| 635 intptr_t requested_column); | 622 intptr_t requested_column); |
| 636 void MakeCodeBreakpointAt(const Function& func, BreakpointLocation* bpt); | 623 void MakeCodeBreakpointAt(const Function& func, BreakpointLocation* bpt); |
| 637 // Returns NULL if no breakpoint exists for the given address. | 624 // Returns NULL if no breakpoint exists for the given address. |
| 638 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 625 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
| 639 | 626 |
| 640 void SyncBreakpointLocation(BreakpointLocation* loc); | 627 void SyncBreakpointLocation(BreakpointLocation* loc); |
| 641 | 628 |
| 642 ActivationFrame* TopDartFrame() const; | 629 ActivationFrame* TopDartFrame() const; |
| 643 static ActivationFrame* CollectDartFrame( | 630 static ActivationFrame* CollectDartFrame(Isolate* isolate, |
| 644 Isolate* isolate, | 631 uword pc, |
| 645 uword pc, | 632 StackFrame* frame, |
| 646 StackFrame* frame, | 633 const Code& code, |
| 647 const Code& code, | 634 const Array& deopt_frame, |
| 648 const Array& deopt_frame, | 635 intptr_t deopt_frame_offset); |
| 649 intptr_t deopt_frame_offset, | |
| 650 ActivationFrame::Kind kind = ActivationFrame::kRegular); | |
| 651 static RawArray* DeoptimizeToArray(Thread* thread, | 636 static RawArray* DeoptimizeToArray(Thread* thread, |
| 652 StackFrame* frame, | 637 StackFrame* frame, |
| 653 const Code& code); | 638 const Code& code); |
| 654 // Appends at least one stack frame. Multiple frames will be appended | 639 // Appends at least one stack frame. Multiple frames will be appended |
| 655 // if |code| at the frame's pc contains inlined functions. | 640 // if |code| at the frame's pc contains inlined functions. |
| 656 static void AppendCodeFrames(Thread* thread, | 641 static void AppendCodeFrames(Thread* thread, |
| 657 Isolate* isolate, | 642 Isolate* isolate, |
| 658 Zone* zone, | 643 Zone* zone, |
| 659 DebuggerStackTrace* stack_trace, | 644 DebuggerStackTrace* stack_trace, |
| 660 StackFrame* frame, | 645 StackFrame* frame, |
| 661 Code* code, | 646 Code* code, |
| 662 Code* inlined_code, | 647 Code* inlined_code, |
| 663 Array* deopt_frame); | 648 Array* deopt_frame); |
| 664 static DebuggerStackTrace* CollectStackTrace(); | 649 static DebuggerStackTrace* CollectStackTrace(); |
| 665 static DebuggerStackTrace* CollectAsyncCausalStackTrace(); | 650 static DebuggerStackTrace* CollectAsyncCausalStackTrace(); |
| 666 static DebuggerStackTrace* CollectAwaiterReturnStackTrace(); | |
| 667 void SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt); | 651 void SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt); |
| 668 | 652 |
| 669 intptr_t nextId() { return next_id_++; } | 653 intptr_t nextId() { return next_id_++; } |
| 670 | 654 |
| 671 bool ShouldPauseOnAsyncException(DebuggerStackTrace* stack_trace, | |
| 672 const Instance& exc); | |
| 673 | |
| 674 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 655 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
| 675 const Instance& exc); | 656 const Instance& exc); |
| 676 | 657 |
| 677 void CollectLibraryFields(const GrowableObjectArray& field_list, | 658 void CollectLibraryFields(const GrowableObjectArray& field_list, |
| 678 const Library& lib, | 659 const Library& lib, |
| 679 const String& prefix, | 660 const String& prefix, |
| 680 bool include_private_fields); | 661 bool include_private_fields); |
| 681 | 662 |
| 682 // Handles any events which pause vm execution. Breakpoints, | 663 // Handles any events which pause vm execution. Breakpoints, |
| 683 // interrupts, etc. | 664 // interrupts, etc. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 738 |
| 758 friend class Isolate; | 739 friend class Isolate; |
| 759 friend class BreakpointLocation; | 740 friend class BreakpointLocation; |
| 760 DISALLOW_COPY_AND_ASSIGN(Debugger); | 741 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 761 }; | 742 }; |
| 762 | 743 |
| 763 | 744 |
| 764 } // namespace dart | 745 } // namespace dart |
| 765 | 746 |
| 766 #endif // RUNTIME_VM_DEBUGGER_H_ | 747 #endif // RUNTIME_VM_DEBUGGER_H_ |
| OLD | NEW |