| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 RawString* QualifiedFunctionName(); | 139 RawString* QualifiedFunctionName(); |
| 140 RawString* SourceUrl(); | 140 RawString* SourceUrl(); |
| 141 RawScript* SourceScript(); | 141 RawScript* SourceScript(); |
| 142 RawLibrary* Library(); | 142 RawLibrary* Library(); |
| 143 intptr_t TokenPos(); | 143 intptr_t TokenPos(); |
| 144 intptr_t LineNumber(); | 144 intptr_t LineNumber(); |
| 145 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); } | 145 void SetContext(const Context& ctx) { ctx_ = ctx.raw(); } |
| 146 | 146 |
| 147 // Returns true if this frame is for a function that is visible |
| 148 // to the user and can be debugged. |
| 149 bool IsDebuggable() const; |
| 150 |
| 147 // The context level of a frame is the context level at the | 151 // The context level of a frame is the context level at the |
| 148 // PC/token index of the frame. It determines the depth of the context | 152 // PC/token index of the frame. It determines the depth of the context |
| 149 // chain that belongs to the function of this activation frame. | 153 // chain that belongs to the function of this activation frame. |
| 150 intptr_t ContextLevel(); | 154 intptr_t ContextLevel(); |
| 151 | 155 |
| 152 const char* ToCString(); | 156 const char* ToCString(); |
| 153 | 157 |
| 154 intptr_t NumLocalVariables(); | 158 intptr_t NumLocalVariables(); |
| 155 | 159 |
| 156 void VariableAt(intptr_t i, | 160 void VariableAt(intptr_t i, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 friend class Debugger; | 198 friend class Debugger; |
| 195 friend class DebuggerStackTrace; | 199 friend class DebuggerStackTrace; |
| 196 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); | 200 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
| 197 }; | 201 }; |
| 198 | 202 |
| 199 | 203 |
| 200 // Array of function activations on the call stack. | 204 // Array of function activations on the call stack. |
| 201 class DebuggerStackTrace : public ZoneAllocated { | 205 class DebuggerStackTrace : public ZoneAllocated { |
| 202 public: | 206 public: |
| 203 explicit DebuggerStackTrace(int capacity) | 207 explicit DebuggerStackTrace(int capacity) |
| 204 : trace_(capacity) { } | 208 : trace_(capacity), |
| 209 user_trace_(capacity) { } |
| 205 | 210 |
| 206 intptr_t Length() const { return trace_.length(); } | 211 intptr_t Length() const { return user_trace_.length(); } |
| 207 | 212 |
| 208 ActivationFrame* ActivationFrameAt(int i) const { | 213 ActivationFrame* FrameAt(int i) const { |
| 209 ASSERT(i < trace_.length()); | 214 return user_trace_[i]; |
| 215 } |
| 216 |
| 217 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const; |
| 218 |
| 219 private: |
| 220 intptr_t UnfilteredLength() const { return trace_.length(); } |
| 221 |
| 222 ActivationFrame* UnfilteredFrameAt(int i) const { |
| 210 return trace_[i]; | 223 return trace_[i]; |
| 211 } | 224 } |
| 212 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const; | 225 |
| 213 private: | |
| 214 void AddActivation(ActivationFrame* frame); | 226 void AddActivation(ActivationFrame* frame); |
| 215 ZoneGrowableArray<ActivationFrame*> trace_; | 227 ZoneGrowableArray<ActivationFrame*> trace_; |
| 228 ZoneGrowableArray<ActivationFrame*> user_trace_; |
| 216 | 229 |
| 217 friend class Debugger; | 230 friend class Debugger; |
| 218 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); | 231 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); |
| 219 }; | 232 }; |
| 220 | 233 |
| 221 | 234 |
| 222 typedef void BreakpointHandler(Dart_Port isolate_id, | 235 typedef void BreakpointHandler(Dart_Port isolate_id, |
| 223 SourceBreakpoint* bpt, | 236 SourceBreakpoint* bpt, |
| 224 DebuggerStackTrace* stack); | 237 DebuggerStackTrace* stack); |
| 225 | 238 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 const String& field_name); | 321 const String& field_name); |
| 309 | 322 |
| 310 void SignalBpReached(); | 323 void SignalBpReached(); |
| 311 void SingleStepCallback(); | 324 void SingleStepCallback(); |
| 312 | 325 |
| 313 void SignalExceptionThrown(const Instance& exc); | 326 void SignalExceptionThrown(const Instance& exc); |
| 314 static void SignalIsolateEvent(EventType type); | 327 static void SignalIsolateEvent(EventType type); |
| 315 | 328 |
| 316 uword GetPatchedStubAddress(uword breakpoint_address); | 329 uword GetPatchedStubAddress(uword breakpoint_address); |
| 317 | 330 |
| 331 static bool IsDebuggable(const Function& func); |
| 332 |
| 318 private: | 333 private: |
| 319 enum ResumeAction { | 334 enum ResumeAction { |
| 320 kContinue, | 335 kContinue, |
| 321 kStepOver, | 336 kStepOver, |
| 322 kStepOut, | 337 kStepOut, |
| 323 kSingleStep | 338 kSingleStep |
| 324 }; | 339 }; |
| 325 | 340 |
| 326 intptr_t ResolveBreakpointPos(const Function& func, | 341 intptr_t ResolveBreakpointPos(const Function& func, |
| 327 intptr_t first_token_pos, | 342 intptr_t first_token_pos, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 343 // Returns NULL if no breakpoint exists for the given address. | 358 // Returns NULL if no breakpoint exists for the given address. |
| 344 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 359 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
| 345 | 360 |
| 346 void SyncBreakpoint(SourceBreakpoint* bpt); | 361 void SyncBreakpoint(SourceBreakpoint* bpt); |
| 347 | 362 |
| 348 ActivationFrame* TopDartFrame() const; | 363 ActivationFrame* TopDartFrame() const; |
| 349 static DebuggerStackTrace* CollectStackTrace(); | 364 static DebuggerStackTrace* CollectStackTrace(); |
| 350 void SignalBpResolved(SourceBreakpoint *bpt); | 365 void SignalBpResolved(SourceBreakpoint *bpt); |
| 351 void SignalPausedEvent(ActivationFrame* top_frame); | 366 void SignalPausedEvent(ActivationFrame* top_frame); |
| 352 | 367 |
| 353 static bool IsDebuggable(const Function& func); | |
| 354 | |
| 355 intptr_t nextId() { return next_id_++; } | 368 intptr_t nextId() { return next_id_++; } |
| 356 | 369 |
| 357 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 370 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
| 358 const Instance& exc); | 371 const Instance& exc); |
| 359 | 372 |
| 360 void CollectLibraryFields(const GrowableObjectArray& field_list, | 373 void CollectLibraryFields(const GrowableObjectArray& field_list, |
| 361 const Library& lib, | 374 const Library& lib, |
| 362 const String& prefix, | 375 const String& prefix, |
| 363 bool include_private_fields); | 376 bool include_private_fields); |
| 364 | 377 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 395 | 408 |
| 396 friend class Isolate; | 409 friend class Isolate; |
| 397 friend class SourceBreakpoint; | 410 friend class SourceBreakpoint; |
| 398 DISALLOW_COPY_AND_ASSIGN(Debugger); | 411 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 399 }; | 412 }; |
| 400 | 413 |
| 401 | 414 |
| 402 } // namespace dart | 415 } // namespace dart |
| 403 | 416 |
| 404 #endif // VM_DEBUGGER_H_ | 417 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |