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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 String* name, | 147 String* name, |
148 intptr_t* token_pos, | 148 intptr_t* token_pos, |
149 intptr_t* end_pos, | 149 intptr_t* end_pos, |
150 Instance* value); | 150 Instance* value); |
151 | 151 |
152 RawArray* GetLocalVariables(); | 152 RawArray* GetLocalVariables(); |
153 RawContext* CallerContext(); | 153 RawContext* CallerContext(); |
154 | 154 |
155 private: | 155 private: |
156 intptr_t PcDescIndex(); | 156 intptr_t PcDescIndex(); |
| 157 intptr_t TryIndex(); |
157 void GetPcDescriptors(); | 158 void GetPcDescriptors(); |
158 void GetVarDescriptors(); | 159 void GetVarDescriptors(); |
159 void GetDescIndices(); | 160 void GetDescIndices(); |
160 RawInstance* GetLocalVarValue(intptr_t slot_index); | 161 RawInstance* GetLocalVarValue(intptr_t slot_index); |
161 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); | 162 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); |
162 | 163 |
163 uword pc_; | 164 uword pc_; |
164 uword fp_; | 165 uword fp_; |
165 uword sp_; | 166 uword sp_; |
166 | 167 |
167 // The anchor of the context chain for this function. | 168 // The anchor of the context chain for this function. |
168 const Context& ctx_; | 169 const Context& ctx_; |
169 | 170 |
170 Function& function_; | 171 Function& function_; |
171 Code& code_; | 172 Code& code_; |
172 intptr_t token_pos_; | 173 intptr_t token_pos_; |
173 intptr_t pc_desc_index_; | 174 intptr_t pc_desc_index_; |
174 intptr_t line_number_; | 175 intptr_t line_number_; |
175 intptr_t context_level_; | 176 intptr_t context_level_; |
176 | 177 |
177 bool vars_initialized_; | 178 bool vars_initialized_; |
178 LocalVarDescriptors& var_descriptors_; | 179 LocalVarDescriptors& var_descriptors_; |
179 ZoneGrowableArray<intptr_t> desc_indices_; | 180 ZoneGrowableArray<intptr_t> desc_indices_; |
180 PcDescriptors& pc_desc_; | 181 PcDescriptors& pc_desc_; |
181 | 182 |
182 friend class Debugger; | 183 friend class Debugger; |
| 184 friend class DebuggerStackTrace; |
183 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); | 185 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
184 }; | 186 }; |
185 | 187 |
186 | 188 |
187 // Array of function activations on the call stack. | 189 // Array of function activations on the call stack. |
188 class DebuggerStackTrace : public ZoneAllocated { | 190 class DebuggerStackTrace : public ZoneAllocated { |
189 public: | 191 public: |
190 explicit DebuggerStackTrace(int capacity) | 192 explicit DebuggerStackTrace(int capacity) |
191 : trace_(capacity) { } | 193 : trace_(capacity) { } |
192 | 194 |
193 intptr_t Length() const { return trace_.length(); } | 195 intptr_t Length() const { return trace_.length(); } |
194 | 196 |
195 ActivationFrame* ActivationFrameAt(int i) const { | 197 ActivationFrame* ActivationFrameAt(int i) const { |
196 ASSERT(i < trace_.length()); | 198 ASSERT(i < trace_.length()); |
197 return trace_[i]; | 199 return trace_[i]; |
198 } | 200 } |
| 201 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const; |
199 private: | 202 private: |
200 void AddActivation(ActivationFrame* frame); | 203 void AddActivation(ActivationFrame* frame); |
201 ZoneGrowableArray<ActivationFrame*> trace_; | 204 ZoneGrowableArray<ActivationFrame*> trace_; |
202 | 205 |
203 friend class Debugger; | 206 friend class Debugger; |
204 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); | 207 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); |
205 }; | 208 }; |
206 | 209 |
207 | 210 |
208 typedef void BreakpointHandler(Dart_Port isolate_id, | 211 typedef void BreakpointHandler(Dart_Port isolate_id, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // Utility functions. | 289 // Utility functions. |
287 static const char* QualifiedFunctionName(const Function& func); | 290 static const char* QualifiedFunctionName(const Function& func); |
288 | 291 |
289 RawObject* GetInstanceField(const Class& cls, | 292 RawObject* GetInstanceField(const Class& cls, |
290 const String& field_name, | 293 const String& field_name, |
291 const Instance& object); | 294 const Instance& object); |
292 RawObject* GetStaticField(const Class& cls, | 295 RawObject* GetStaticField(const Class& cls, |
293 const String& field_name); | 296 const String& field_name); |
294 | 297 |
295 void SignalBpReached(); | 298 void SignalBpReached(); |
296 void SignalExceptionThrown(const Object& exc); | 299 void SignalExceptionThrown(const Instance& exc); |
297 static void SignalIsolateEvent(EventType type); | 300 static void SignalIsolateEvent(EventType type); |
298 | 301 |
299 private: | 302 private: |
300 enum ResumeAction { | 303 enum ResumeAction { |
301 kContinue, | 304 kContinue, |
302 kStepOver, | 305 kStepOver, |
303 kStepInto, | 306 kStepInto, |
304 kStepOut | 307 kStepOut |
305 }; | 308 }; |
306 | 309 |
(...skipping 18 matching lines...) Expand all Loading... |
325 void SyncBreakpoint(SourceBreakpoint* bpt); | 328 void SyncBreakpoint(SourceBreakpoint* bpt); |
326 | 329 |
327 DebuggerStackTrace* CollectStackTrace(); | 330 DebuggerStackTrace* CollectStackTrace(); |
328 void SignalBpResolved(SourceBreakpoint *bpt); | 331 void SignalBpResolved(SourceBreakpoint *bpt); |
329 | 332 |
330 bool IsDebuggable(const Function& func); | 333 bool IsDebuggable(const Function& func); |
331 | 334 |
332 intptr_t nextId() { return next_id_++; } | 335 intptr_t nextId() { return next_id_++; } |
333 | 336 |
334 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 337 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
335 const Object& exc); | 338 const Instance& exc); |
336 | 339 |
337 void CollectLibraryFields(const GrowableObjectArray& field_list, | 340 void CollectLibraryFields(const GrowableObjectArray& field_list, |
338 const Library& lib, | 341 const Library& lib, |
339 const String& prefix, | 342 const String& prefix, |
340 bool include_private_fields); | 343 bool include_private_fields); |
341 | 344 |
342 Isolate* isolate_; | 345 Isolate* isolate_; |
343 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. | 346 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. |
344 bool initialized_; | 347 bool initialized_; |
345 | 348 |
(...skipping 26 matching lines...) Expand all Loading... |
372 static EventHandler* event_handler_; | 375 static EventHandler* event_handler_; |
373 | 376 |
374 friend class SourceBreakpoint; | 377 friend class SourceBreakpoint; |
375 DISALLOW_COPY_AND_ASSIGN(Debugger); | 378 DISALLOW_COPY_AND_ASSIGN(Debugger); |
376 }; | 379 }; |
377 | 380 |
378 | 381 |
379 } // namespace dart | 382 } // namespace dart |
380 | 383 |
381 #endif // VM_DEBUGGER_H_ | 384 #endif // VM_DEBUGGER_H_ |
OLD | NEW |