| 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_tools_api.h" | 8 #include "include/dart_tools_api.h" |
| 9 | 9 |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 intptr_t* token_pos, | 254 intptr_t* token_pos, |
| 255 intptr_t* end_pos, | 255 intptr_t* end_pos, |
| 256 Object* value); | 256 Object* value); |
| 257 | 257 |
| 258 RawArray* GetLocalVariables(); | 258 RawArray* GetLocalVariables(); |
| 259 RawObject* GetParameter(intptr_t index); | 259 RawObject* GetParameter(intptr_t index); |
| 260 RawObject* GetClosure(); | 260 RawObject* GetClosure(); |
| 261 RawObject* GetReceiver(); | 261 RawObject* GetReceiver(); |
| 262 | 262 |
| 263 const Context& GetSavedCurrentContext(); | 263 const Context& GetSavedCurrentContext(); |
| 264 RawObject* GetAsyncOperation(); |
| 264 | 265 |
| 265 RawObject* Evaluate(const String& expr); | 266 RawObject* Evaluate(const String& expr); |
| 266 | 267 |
| 267 // Print the activation frame into |jsobj|. if |full| is false, script | 268 // Print the activation frame into |jsobj|. if |full| is false, script |
| 268 // and local variable objects are only references. if |full| is true, | 269 // and local variable objects are only references. if |full| is true, |
| 269 // the complete script, function, and, local variable objects are included. | 270 // the complete script, function, and, local variable objects are included. |
| 270 void PrintToJSONObject(JSONObject* jsobj, bool full = false); | 271 void PrintToJSONObject(JSONObject* jsobj, bool full = false); |
| 271 | 272 |
| 272 private: | 273 private: |
| 273 void PrintContextMismatchError(const String& var_name, | 274 void PrintContextMismatchError(intptr_t ctx_slot, |
| 274 intptr_t ctx_slot, | |
| 275 intptr_t frame_ctx_level, | 275 intptr_t frame_ctx_level, |
| 276 intptr_t var_ctx_level); | 276 intptr_t var_ctx_level); |
| 277 | 277 |
| 278 intptr_t TryIndex(); | 278 intptr_t TryIndex(); |
| 279 void GetPcDescriptors(); | 279 void GetPcDescriptors(); |
| 280 void GetVarDescriptors(); | 280 void GetVarDescriptors(); |
| 281 void GetDescIndices(); | 281 void GetDescIndices(); |
| 282 | 282 |
| 283 RawObject* GetLocalVar(intptr_t slot_index); | 283 RawObject* GetStackVar(intptr_t slot_index); |
| 284 RawInstance* GetLocalInstanceVar(intptr_t slot_index); | 284 RawObject* GetContextVar(intptr_t ctxt_level, intptr_t slot_index); |
| 285 | 285 |
| 286 uword pc_; | 286 uword pc_; |
| 287 uword fp_; | 287 uword fp_; |
| 288 uword sp_; | 288 uword sp_; |
| 289 | 289 |
| 290 // The anchor of the context chain for this function. | 290 // The anchor of the context chain for this function. |
| 291 Context& ctx_; | 291 Context& ctx_; |
| 292 const Code& code_; | 292 const Code& code_; |
| 293 const Function& function_; | 293 const Function& function_; |
| 294 bool token_pos_initialized_; | 294 bool token_pos_initialized_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 kIsolateCreated = 4, | 346 kIsolateCreated = 4, |
| 347 kIsolateShutdown = 5, | 347 kIsolateShutdown = 5, |
| 348 kIsolateInterrupted = 6, | 348 kIsolateInterrupted = 6, |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 explicit DebuggerEvent(Isolate* isolate, EventType event_type) | 351 explicit DebuggerEvent(Isolate* isolate, EventType event_type) |
| 352 : isolate_(isolate), | 352 : isolate_(isolate), |
| 353 type_(event_type), | 353 type_(event_type), |
| 354 top_frame_(NULL), | 354 top_frame_(NULL), |
| 355 breakpoint_(NULL), | 355 breakpoint_(NULL), |
| 356 exception_(NULL) {} | 356 exception_(NULL), |
| 357 async_continuation_(NULL) {} |
| 357 | 358 |
| 358 Isolate* isolate() const { return isolate_; } | 359 Isolate* isolate() const { return isolate_; } |
| 359 | 360 |
| 360 EventType type() const { return type_; } | 361 EventType type() const { return type_; } |
| 361 | 362 |
| 362 bool IsPauseEvent() const { | 363 bool IsPauseEvent() const { |
| 363 return (type_ == kBreakpointReached || | 364 return (type_ == kBreakpointReached || |
| 364 type_ == kIsolateInterrupted || | 365 type_ == kIsolateInterrupted || |
| 365 type_ == kExceptionThrown); | 366 type_ == kExceptionThrown); |
| 366 } | 367 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 385 | 386 |
| 386 const Object* exception() const { | 387 const Object* exception() const { |
| 387 ASSERT(type_ == kExceptionThrown); | 388 ASSERT(type_ == kExceptionThrown); |
| 388 return exception_; | 389 return exception_; |
| 389 } | 390 } |
| 390 void set_exception(const Object* exception) { | 391 void set_exception(const Object* exception) { |
| 391 ASSERT(type_ == kExceptionThrown); | 392 ASSERT(type_ == kExceptionThrown); |
| 392 exception_ = exception; | 393 exception_ = exception; |
| 393 } | 394 } |
| 394 | 395 |
| 396 const Object* async_continuation() const { |
| 397 ASSERT(type_ == kBreakpointReached); |
| 398 return async_continuation_; |
| 399 } |
| 400 void set_async_continuation(const Object* closure) { |
| 401 ASSERT(type_ == kBreakpointReached); |
| 402 async_continuation_ = closure; |
| 403 } |
| 404 |
| 395 Dart_Port isolate_id() const { | 405 Dart_Port isolate_id() const { |
| 396 return isolate_->main_port(); | 406 return isolate_->main_port(); |
| 397 } | 407 } |
| 398 | 408 |
| 399 private: | 409 private: |
| 400 Isolate* isolate_; | 410 Isolate* isolate_; |
| 401 EventType type_; | 411 EventType type_; |
| 402 ActivationFrame* top_frame_; | 412 ActivationFrame* top_frame_; |
| 403 Breakpoint* breakpoint_; | 413 Breakpoint* breakpoint_; |
| 404 const Object* exception_; | 414 const Object* exception_; |
| 415 const Object* async_continuation_; |
| 405 }; | 416 }; |
| 406 | 417 |
| 407 | 418 |
| 408 class Debugger { | 419 class Debugger { |
| 409 public: | 420 public: |
| 410 typedef void EventHandler(DebuggerEvent* event); | 421 typedef void EventHandler(DebuggerEvent* event); |
| 411 | 422 |
| 412 Debugger(); | 423 Debugger(); |
| 413 ~Debugger(); | 424 ~Debugger(); |
| 414 | 425 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 644 |
| 634 friend class Isolate; | 645 friend class Isolate; |
| 635 friend class BreakpointLocation; | 646 friend class BreakpointLocation; |
| 636 DISALLOW_COPY_AND_ASSIGN(Debugger); | 647 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 637 }; | 648 }; |
| 638 | 649 |
| 639 | 650 |
| 640 } // namespace dart | 651 } // namespace dart |
| 641 | 652 |
| 642 #endif // VM_DEBUGGER_H_ | 653 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |