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 VM_DEBUGGER_H_ | 5 #ifndef VM_DEBUGGER_H_ |
6 #define VM_DEBUGGER_H_ | 6 #define VM_DEBUGGER_H_ |
7 | 7 |
8 #include "include/dart_debugger_api.h" | 8 #include "include/dart_debugger_api.h" |
9 | 9 |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 friend class Debugger; | 117 friend class Debugger; |
118 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); | 118 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); |
119 }; | 119 }; |
120 | 120 |
121 | 121 |
122 // ActivationFrame represents one dart function activation frame | 122 // ActivationFrame represents one dart function activation frame |
123 // on the call stack. | 123 // on the call stack. |
124 class ActivationFrame : public ZoneAllocated { | 124 class ActivationFrame : public ZoneAllocated { |
125 public: | 125 public: |
126 ActivationFrame(uword pc, uword fp, uword sp, const Code& code); | 126 ActivationFrame(uword pc, uword fp, uword sp, const Code& code, |
| 127 const Array& deopt_frame, intptr_t deopt_frame_offset); |
127 | 128 |
128 uword pc() const { return pc_; } | 129 uword pc() const { return pc_; } |
129 uword fp() const { return fp_; } | 130 uword fp() const { return fp_; } |
130 uword sp() const { return sp_; } | 131 uword sp() const { return sp_; } |
131 const Function& function() const { | 132 const Function& function() const { |
132 ASSERT(!function_.IsNull()); | 133 ASSERT(!function_.IsNull()); |
133 return function_; | 134 return function_; |
134 } | 135 } |
135 const Code& code() const { | 136 const Code& code() const { |
136 ASSERT(!code_.IsNull()); | 137 ASSERT(!code_.IsNull()); |
137 return code_; | 138 return code_; |
138 } | 139 } |
139 | 140 |
140 RawString* QualifiedFunctionName(); | 141 RawString* QualifiedFunctionName(); |
141 RawString* SourceUrl(); | 142 RawString* SourceUrl(); |
142 RawScript* SourceScript(); | 143 RawScript* SourceScript(); |
143 RawLibrary* Library(); | 144 RawLibrary* Library(); |
144 intptr_t TokenPos(); | 145 intptr_t TokenPos(); |
145 intptr_t LineNumber(); | 146 intptr_t LineNumber(); |
146 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); } | 147 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); } |
147 void SetDeoptFrame(const Array& deopt_frame, intptr_t deopt_frame_offset) { | |
148 deopt_frame_ = deopt_frame.raw(); | |
149 deopt_frame_offset_ = deopt_frame_offset; | |
150 } | |
151 | 148 |
152 // Returns true if this frame is for a function that is visible | 149 // Returns true if this frame is for a function that is visible |
153 // to the user and can be debugged. | 150 // to the user and can be debugged. |
154 bool IsDebuggable() const; | 151 bool IsDebuggable() const; |
155 | 152 |
156 // The context level of a frame is the context level at the | 153 // The context level of a frame is the context level at the |
157 // PC/token index of the frame. It determines the depth of the context | 154 // PC/token index of the frame. It determines the depth of the context |
158 // chain that belongs to the function of this activation frame. | 155 // chain that belongs to the function of this activation frame. |
159 intptr_t ContextLevel(); | 156 intptr_t ContextLevel(); |
160 | 157 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // The anchor of the context chain for this function. | 192 // The anchor of the context chain for this function. |
196 Context& ctx_; | 193 Context& ctx_; |
197 const Code& code_; | 194 const Code& code_; |
198 const Function& function_; | 195 const Function& function_; |
199 intptr_t token_pos_; | 196 intptr_t token_pos_; |
200 intptr_t pc_desc_index_; | 197 intptr_t pc_desc_index_; |
201 intptr_t line_number_; | 198 intptr_t line_number_; |
202 intptr_t context_level_; | 199 intptr_t context_level_; |
203 | 200 |
204 // Some frames are deoptimized into a side array in order to inspect them. | 201 // Some frames are deoptimized into a side array in order to inspect them. |
205 Array& deopt_frame_; | 202 const Array& deopt_frame_; |
206 intptr_t deopt_frame_offset_; | 203 const intptr_t deopt_frame_offset_; |
207 | 204 |
208 bool vars_initialized_; | 205 bool vars_initialized_; |
209 LocalVarDescriptors& var_descriptors_; | 206 LocalVarDescriptors& var_descriptors_; |
210 ZoneGrowableArray<intptr_t> desc_indices_; | 207 ZoneGrowableArray<intptr_t> desc_indices_; |
211 PcDescriptors& pc_desc_; | 208 PcDescriptors& pc_desc_; |
212 | 209 |
213 friend class Debugger; | 210 friend class Debugger; |
214 friend class DebuggerStackTrace; | 211 friend class DebuggerStackTrace; |
215 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); | 212 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
216 }; | 213 }; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 371 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
375 | 372 |
376 void SyncBreakpoint(SourceBreakpoint* bpt); | 373 void SyncBreakpoint(SourceBreakpoint* bpt); |
377 | 374 |
378 ActivationFrame* TopDartFrame() const; | 375 ActivationFrame* TopDartFrame() const; |
379 static DebuggerStackTrace* CollectStackTrace(); | 376 static DebuggerStackTrace* CollectStackTrace(); |
380 static ActivationFrame* CollectDartFrame(Isolate* isolate, | 377 static ActivationFrame* CollectDartFrame(Isolate* isolate, |
381 uword pc, | 378 uword pc, |
382 StackFrame* frame, | 379 StackFrame* frame, |
383 const Code& code, | 380 const Code& code, |
384 bool optimized, | 381 const Array& deopt_frame, |
| 382 intptr_t deopt_frame_offset, |
385 ActivationFrame* callee_activation, | 383 ActivationFrame* callee_activation, |
386 const Context& entry_ctx); | 384 const Context& entry_ctx); |
387 static RawArray* DeoptimizeToArray(Isolate* isolate, | 385 static RawArray* DeoptimizeToArray(Isolate* isolate, |
388 StackFrame* frame, | 386 StackFrame* frame, |
389 const Code& code); | 387 const Code& code); |
390 static DebuggerStackTrace* CollectStackTraceNew(); | 388 static DebuggerStackTrace* CollectStackTraceNew(); |
391 void SignalBpResolved(SourceBreakpoint *bpt); | 389 void SignalBpResolved(SourceBreakpoint *bpt); |
392 void SignalPausedEvent(ActivationFrame* top_frame); | 390 void SignalPausedEvent(ActivationFrame* top_frame); |
393 | 391 |
394 intptr_t nextId() { return next_id_++; } | 392 intptr_t nextId() { return next_id_++; } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 432 |
435 friend class Isolate; | 433 friend class Isolate; |
436 friend class SourceBreakpoint; | 434 friend class SourceBreakpoint; |
437 DISALLOW_COPY_AND_ASSIGN(Debugger); | 435 DISALLOW_COPY_AND_ASSIGN(Debugger); |
438 }; | 436 }; |
439 | 437 |
440 | 438 |
441 } // namespace dart | 439 } // namespace dart |
442 | 440 |
443 #endif // VM_DEBUGGER_H_ | 441 #endif // VM_DEBUGGER_H_ |
OLD | NEW |