Chromium Code Reviews| 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" |
| 11 #include "vm/port.h" | 11 #include "vm/port.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 class CodeBreakpoint; | 15 class CodeBreakpoint; |
| 16 class Isolate; | 16 class Isolate; |
| 17 class JSONArray; | 17 class JSONArray; |
| 18 class JSONStream; | 18 class JSONStream; |
| 19 class ObjectPointerVisitor; | 19 class ObjectPointerVisitor; |
| 20 class RemoteObjectCache; | 20 class RemoteObjectCache; |
| 21 class SourceBreakpoint; | 21 class BreakpointLocation; |
| 22 class StackFrame; | 22 class StackFrame; |
| 23 | 23 |
| 24 // SourceBreakpoint represents a user-specified breakpoint location in | 24 // A user-defined breakpoint, which either fires once, for a particular closure, |
| 25 // Dart source. There may be more than one CodeBreakpoint object per | 25 // or always. The API's notion of a breakpoint corresponds to this object. |
| 26 // SourceBreakpoint. | 26 class Breakpoint { |
| 27 public: | |
| 28 Breakpoint(intptr_t id, BreakpointLocation* bpt_location) | |
| 29 : id_(id), | |
| 30 kind_(Breakpoint::kNone), | |
| 31 next_(NULL), | |
| 32 closure_(Instance::null()), | |
| 33 bpt_location_(bpt_location) {} | |
| 34 | |
| 35 intptr_t id() const { return id_; } | |
| 36 Breakpoint* next() const { return next_; } | |
| 37 void set_next(Breakpoint* n) { next_ = n; } | |
| 38 | |
| 39 BreakpointLocation* bpt_location() const { return bpt_location_; } | |
| 40 void set_bpt_location(BreakpointLocation* new_bpt_location); | |
| 41 | |
| 42 bool IsRepeated() const { return kind_ == kRepeated; } | |
| 43 bool IsSingleShot() const { return kind_ == kSingleShot; } | |
| 44 bool IsPerClosure() const { return kind_ == kPerClosure; } | |
| 45 RawInstance* closure() const { return closure_; } | |
| 46 | |
| 47 void SetIsRepeated() { | |
| 48 ASSERT(kind_ == kNone); | |
| 49 kind_ = kRepeated; | |
| 50 } | |
| 51 | |
| 52 void SetIsSingleShot() { | |
| 53 ASSERT(kind_ == kNone); | |
| 54 kind_ = kSingleShot; | |
| 55 } | |
| 56 | |
| 57 void SetIsPerClosure(const Instance& closure) { | |
| 58 ASSERT(kind_ == kNone); | |
| 59 kind_ = kPerClosure; | |
| 60 closure_ = closure.raw(); | |
| 61 } | |
| 62 | |
| 63 void PrintJSON(JSONStream* stream); | |
| 64 | |
| 65 private: | |
| 66 void VisitObjectPointers(ObjectPointerVisitor* visitor); | |
| 67 | |
| 68 enum ConditionKind { | |
| 69 kNone, | |
| 70 kRepeated, | |
| 71 kSingleShot, | |
| 72 kPerClosure, | |
| 73 }; | |
| 74 | |
| 75 intptr_t id_; | |
| 76 ConditionKind kind_; | |
| 77 Breakpoint* next_; | |
| 78 RawInstance* closure_; | |
| 79 BreakpointLocation* bpt_location_; | |
| 80 | |
| 81 friend class BreakpointLocation; | |
| 82 DISALLOW_COPY_AND_ASSIGN(Breakpoint); | |
| 83 }; | |
| 84 | |
| 85 | |
| 86 // BreakpointLocation represents a collection of breakpoint conditions at the | |
| 87 // same token position in Dart source. There may be more than one CodeBreakpoint | |
| 88 // object per BreakpointLocation. | |
| 27 // An unresolved breakpoint is one where the underlying code has not | 89 // An unresolved breakpoint is one where the underlying code has not |
| 28 // been compiled yet. Since the code has not been compiled, we don't know | 90 // been compiled yet. Since the code has not been compiled, we don't know |
| 29 // the definitive source location yet. The requested source location may | 91 // the definitive source location yet. The requested source location may |
| 30 // change when the underlying code gets compiled. | 92 // change when the underlying code gets compiled. |
| 31 // A latent breakpoint represents a breakpoint location in Dart source | 93 // A latent breakpoint represents a breakpoint location in Dart source |
| 32 // that is not loaded in the VM when the breakpoint is requested. | 94 // that is not loaded in the VM when the breakpoint is requested. |
| 33 // When a script with matching url is loaded, a latent breakpoint | 95 // When a script with matching url is loaded, a latent breakpoint |
| 34 // becomes an unresolved breakpoint. | 96 // becomes an unresolved breakpoint. |
| 35 class SourceBreakpoint { | 97 class BreakpointLocation { |
| 36 public: | 98 public: |
| 37 // Create a new unresolved breakpoint. | 99 // Create a new unresolved breakpoint. |
| 38 SourceBreakpoint(intptr_t id, | 100 BreakpointLocation(const Script& script, |
| 39 const Script& script, | |
| 40 intptr_t token_pos, | 101 intptr_t token_pos, |
|
hausner
2015/05/21 22:46:23
Indentation. (Also at other locations where the su
| |
| 41 intptr_t end_token_pos); | 102 intptr_t end_token_pos); |
| 42 // Create a new latent breakpoint. | 103 // Create a new latent breakpoint. |
| 43 SourceBreakpoint(intptr_t id, | 104 BreakpointLocation(const String& url, |
| 44 const String& url, | |
| 45 intptr_t line_number); | 105 intptr_t line_number); |
| 46 | 106 |
| 107 ~BreakpointLocation(); | |
| 108 | |
| 47 RawFunction* function() const { return function_; } | 109 RawFunction* function() const { return function_; } |
| 48 intptr_t token_pos() const { return token_pos_; } | 110 intptr_t token_pos() const { return token_pos_; } |
| 49 intptr_t end_token_pos() const { return end_token_pos_; } | 111 intptr_t end_token_pos() const { return end_token_pos_; } |
| 50 intptr_t id() const { return id_; } | |
| 51 | 112 |
| 52 RawScript* script() const { return script_; } | 113 RawScript* script() const { return script_; } |
| 53 RawString* url() const { return url_; } | 114 RawString* url() const { return url_; } |
| 54 intptr_t LineNumber(); | 115 intptr_t LineNumber(); |
| 55 | 116 |
| 56 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); | 117 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); |
| 57 | 118 |
| 58 void Enable(); | 119 Breakpoint* AddRepeated(Debugger* dbg); |
| 59 void Disable(); | 120 Breakpoint* AddSingleShot(Debugger* dbg); |
| 60 bool IsEnabled() const { return is_enabled_; } | 121 Breakpoint* AddPerClosure(Debugger* dbg, const Instance& closure); |
| 122 | |
| 123 bool AnyEnabled() const; | |
| 61 bool IsResolved() const { return is_resolved_; } | 124 bool IsResolved() const { return is_resolved_; } |
| 62 bool IsLatent() const { return token_pos_ < 0; } | 125 bool IsLatent() const { return token_pos_ < 0; } |
| 63 | 126 |
| 64 bool IsOneShot() const { return is_one_shot_; } | |
| 65 void SetIsOneShot() { is_one_shot_ = true; } | |
| 66 | |
| 67 void PrintJSON(JSONStream* stream); | |
| 68 | |
| 69 private: | 127 private: |
| 70 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 128 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 71 | 129 |
| 72 void SetResolved(const Function& func, intptr_t token_pos); | 130 void SetResolved(const Function& func, intptr_t token_pos); |
| 73 void set_next(SourceBreakpoint* value) { next_ = value; } | |
| 74 SourceBreakpoint* next() const { return this->next_; } | |
| 75 | 131 |
| 76 const intptr_t id_; | 132 BreakpointLocation* next() const { return this->next_; } |
| 133 void set_next(BreakpointLocation* value) { next_ = value; } | |
| 134 | |
| 135 Breakpoint* breakpoints() const { return this->conditions_; } | |
| 136 void set_breakpoints(Breakpoint* head) { this->conditions_ = head; } | |
| 137 | |
| 77 RawScript* script_; | 138 RawScript* script_; |
| 78 RawString* url_; | 139 RawString* url_; |
| 79 intptr_t token_pos_; | 140 intptr_t token_pos_; |
| 80 intptr_t end_token_pos_; | 141 intptr_t end_token_pos_; |
| 81 bool is_resolved_; | 142 bool is_resolved_; |
| 82 bool is_enabled_; | 143 BreakpointLocation* next_; |
| 83 bool is_one_shot_; | 144 Breakpoint* conditions_; |
| 84 SourceBreakpoint* next_; | |
| 85 | 145 |
| 86 // Valid for resolved breakpoints: | 146 // Valid for resolved breakpoints: |
| 87 RawFunction* function_; | 147 RawFunction* function_; |
| 88 intptr_t line_number_; | 148 intptr_t line_number_; |
| 89 | 149 |
| 90 friend class Debugger; | 150 friend class Debugger; |
| 91 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); | 151 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation); |
| 92 }; | 152 }; |
| 93 | 153 |
| 94 | 154 |
| 95 // CodeBreakpoint represents a location in compiled code. There may be | 155 // CodeBreakpoint represents a location in compiled code. There may be |
| 96 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a | 156 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a |
| 97 // function gets compiled as a regular function and as a closure. | 157 // function gets compiled as a regular function and as a closure. |
| 98 class CodeBreakpoint { | 158 class CodeBreakpoint { |
| 99 public: | 159 public: |
| 100 CodeBreakpoint(const Code& code, | 160 CodeBreakpoint(const Code& code, |
| 101 intptr_t token_pos, | 161 intptr_t token_pos, |
| 102 uword pc, | 162 uword pc, |
| 103 RawPcDescriptors::Kind kind); | 163 RawPcDescriptors::Kind kind); |
| 104 ~CodeBreakpoint(); | 164 ~CodeBreakpoint(); |
| 105 | 165 |
| 106 RawFunction* function() const; | 166 RawFunction* function() const; |
| 107 uword pc() const { return pc_; } | 167 uword pc() const { return pc_; } |
| 108 intptr_t token_pos() const { return token_pos_; } | 168 intptr_t token_pos() const { return token_pos_; } |
| 109 bool IsInternal() const { return src_bpt_ == NULL; } | 169 bool IsInternal() const { return bpt_location_ == NULL; } |
| 110 | 170 |
| 111 RawScript* SourceCode(); | 171 RawScript* SourceCode(); |
| 112 RawString* SourceUrl(); | 172 RawString* SourceUrl(); |
| 113 intptr_t LineNumber(); | 173 intptr_t LineNumber(); |
| 114 | 174 |
| 115 void Enable(); | 175 void Enable(); |
| 116 void Disable(); | 176 void Disable(); |
| 117 bool IsEnabled() const { return is_enabled_; } | 177 bool IsEnabled() const { return is_enabled_; } |
| 118 | 178 |
| 119 uword OrigStubAddress() const; | 179 uword OrigStubAddress() const; |
| 120 | 180 |
| 121 private: | 181 private: |
| 122 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 182 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 123 | 183 |
| 124 SourceBreakpoint* src_bpt() const { return src_bpt_; } | 184 BreakpointLocation* bpt_location() const { return bpt_location_; } |
| 125 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } | 185 void set_bpt_location(BreakpointLocation* value) { bpt_location_ = value; } |
| 126 | 186 |
| 127 void set_next(CodeBreakpoint* value) { next_ = value; } | 187 void set_next(CodeBreakpoint* value) { next_ = value; } |
| 128 CodeBreakpoint* next() const { return this->next_; } | 188 CodeBreakpoint* next() const { return this->next_; } |
| 129 | 189 |
| 130 void PatchCode(); | 190 void PatchCode(); |
| 131 void RestoreCode(); | 191 void RestoreCode(); |
| 132 | 192 |
| 133 RawCode* code_; | 193 RawCode* code_; |
| 134 intptr_t token_pos_; | 194 intptr_t token_pos_; |
| 135 uword pc_; | 195 uword pc_; |
| 136 intptr_t line_number_; | 196 intptr_t line_number_; |
| 137 bool is_enabled_; | 197 bool is_enabled_; |
| 138 | 198 |
| 139 SourceBreakpoint* src_bpt_; | 199 BreakpointLocation* bpt_location_; |
| 140 CodeBreakpoint* next_; | 200 CodeBreakpoint* next_; |
| 141 | 201 |
| 142 RawPcDescriptors::Kind breakpoint_kind_; | 202 RawPcDescriptors::Kind breakpoint_kind_; |
| 143 uword saved_value_; | 203 uword saved_value_; |
| 144 | 204 |
| 145 friend class Debugger; | 205 friend class Debugger; |
| 146 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); | 206 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); |
| 147 }; | 207 }; |
| 148 | 208 |
| 149 | 209 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 | 247 |
| 188 intptr_t NumLocalVariables(); | 248 intptr_t NumLocalVariables(); |
| 189 | 249 |
| 190 void VariableAt(intptr_t i, | 250 void VariableAt(intptr_t i, |
| 191 String* name, | 251 String* name, |
| 192 intptr_t* token_pos, | 252 intptr_t* token_pos, |
| 193 intptr_t* end_pos, | 253 intptr_t* end_pos, |
| 194 Object* value); | 254 Object* value); |
| 195 | 255 |
| 196 RawArray* GetLocalVariables(); | 256 RawArray* GetLocalVariables(); |
| 257 RawObject* GetParameter(intptr_t index); | |
| 258 RawObject* GetClosure(); | |
| 197 RawObject* GetReceiver(); | 259 RawObject* GetReceiver(); |
| 198 | 260 |
| 199 const Context& GetSavedCurrentContext(); | 261 const Context& GetSavedCurrentContext(); |
| 200 | 262 |
| 201 RawObject* Evaluate(const String& expr); | 263 RawObject* Evaluate(const String& expr); |
| 202 | 264 |
| 203 // Print the activation frame into |jsobj|. if |full| is false, script | 265 // Print the activation frame into |jsobj|. if |full| is false, script |
| 204 // and local variable objects are only references. if |full| is true, | 266 // and local variable objects are only references. if |full| is true, |
| 205 // the complete script, function, and, local variable objects are included. | 267 // the complete script, function, and, local variable objects are included. |
| 206 void PrintToJSONObject(JSONObject* jsobj, bool full = false); | 268 void PrintToJSONObject(JSONObject* jsobj, bool full = false); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 | 328 |
| 267 private: | 329 private: |
| 268 void AddActivation(ActivationFrame* frame); | 330 void AddActivation(ActivationFrame* frame); |
| 269 ZoneGrowableArray<ActivationFrame*> trace_; | 331 ZoneGrowableArray<ActivationFrame*> trace_; |
| 270 | 332 |
| 271 friend class Debugger; | 333 friend class Debugger; |
| 272 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); | 334 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); |
| 273 }; | 335 }; |
| 274 | 336 |
| 275 | 337 |
| 276 typedef void BreakpointHandler(Dart_Port isolate_id, | 338 typedef void BreakpointHandler(Dart_Port isolate_id, |
|
hausner
2015/05/21 22:46:23
This typedef seems to be obsolete. I don't see thi
rmacnak
2015/05/21 23:51:56
Removed
| |
| 277 SourceBreakpoint* bpt, | 339 BreakpointLocation* bpt, |
| 278 DebuggerStackTrace* stack); | 340 DebuggerStackTrace* stack); |
| 279 | 341 |
| 280 | 342 |
| 281 class DebuggerEvent { | 343 class DebuggerEvent { |
| 282 public: | 344 public: |
| 283 enum EventType { | 345 enum EventType { |
| 284 kBreakpointReached = 1, | 346 kBreakpointReached = 1, |
| 285 kBreakpointResolved = 2, | 347 kBreakpointResolved = 2, |
| 286 kExceptionThrown = 3, | 348 kExceptionThrown = 3, |
| 287 kIsolateCreated = 4, | 349 kIsolateCreated = 4, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 308 | 370 |
| 309 ActivationFrame* top_frame() const { | 371 ActivationFrame* top_frame() const { |
| 310 ASSERT(IsPauseEvent()); | 372 ASSERT(IsPauseEvent()); |
| 311 return top_frame_; | 373 return top_frame_; |
| 312 } | 374 } |
| 313 void set_top_frame(ActivationFrame* frame) { | 375 void set_top_frame(ActivationFrame* frame) { |
| 314 ASSERT(IsPauseEvent()); | 376 ASSERT(IsPauseEvent()); |
| 315 top_frame_ = frame; | 377 top_frame_ = frame; |
| 316 } | 378 } |
| 317 | 379 |
| 318 SourceBreakpoint* breakpoint() const { | 380 Breakpoint* breakpoint() const { |
| 319 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); | 381 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); |
| 320 return breakpoint_; | 382 return breakpoint_; |
| 321 } | 383 } |
| 322 void set_breakpoint(SourceBreakpoint* bpt) { | 384 void set_breakpoint(Breakpoint* bpt) { |
| 323 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); | 385 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); |
| 324 breakpoint_ = bpt; | 386 breakpoint_ = bpt; |
| 325 } | 387 } |
| 326 | 388 |
| 327 const Object* exception() const { | 389 const Object* exception() const { |
| 328 ASSERT(type_ == kExceptionThrown); | 390 ASSERT(type_ == kExceptionThrown); |
| 329 return exception_; | 391 return exception_; |
| 330 } | 392 } |
| 331 void set_exception(const Object* exception) { | 393 void set_exception(const Object* exception) { |
| 332 ASSERT(type_ == kExceptionThrown); | 394 ASSERT(type_ == kExceptionThrown); |
| 333 exception_ = exception; | 395 exception_ = exception; |
| 334 } | 396 } |
| 335 | 397 |
| 336 Dart_Port isolate_id() const { | 398 Dart_Port isolate_id() const { |
| 337 return isolate_->main_port(); | 399 return isolate_->main_port(); |
| 338 } | 400 } |
| 339 | 401 |
| 340 private: | 402 private: |
| 341 Isolate* isolate_; | 403 Isolate* isolate_; |
| 342 EventType type_; | 404 EventType type_; |
| 343 ActivationFrame* top_frame_; | 405 ActivationFrame* top_frame_; |
| 344 SourceBreakpoint* breakpoint_; | 406 Breakpoint* breakpoint_; |
| 345 const Object* exception_; | 407 const Object* exception_; |
| 346 }; | 408 }; |
| 347 | 409 |
| 348 | 410 |
| 349 class Debugger { | 411 class Debugger { |
| 350 public: | 412 public: |
| 351 typedef void EventHandler(DebuggerEvent* event); | 413 typedef void EventHandler(DebuggerEvent* event); |
| 352 | 414 |
| 353 Debugger(); | 415 Debugger(); |
| 354 ~Debugger(); | 416 ~Debugger(); |
| 355 | 417 |
| 356 void Initialize(Isolate* isolate); | 418 void Initialize(Isolate* isolate); |
| 357 void NotifyIsolateCreated(); | 419 void NotifyIsolateCreated(); |
| 358 void Shutdown(); | 420 void Shutdown(); |
| 359 | 421 |
| 360 void NotifyCompilation(const Function& func); | 422 void NotifyCompilation(const Function& func); |
| 361 void NotifyDoneLoading(); | 423 void NotifyDoneLoading(); |
| 362 | 424 |
| 363 RawFunction* ResolveFunction(const Library& library, | 425 RawFunction* ResolveFunction(const Library& library, |
| 364 const String& class_name, | 426 const String& class_name, |
| 365 const String& function_name); | 427 const String& function_name); |
| 366 | 428 |
| 367 // Set breakpoint at closest location to function entry. | 429 // Set breakpoint at closest location to function entry. |
| 368 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function); | 430 Breakpoint* SetBreakpointAtEntry(const Function& target_function, |
| 431 bool single_shot); | |
| 432 Breakpoint* SetBreakpointAtActivation(const Instance& closure); | |
| 369 | 433 |
| 370 // TODO(turnidge): script_url may no longer be specific enough. | 434 // TODO(turnidge): script_url may no longer be specific enough. |
| 371 SourceBreakpoint* SetBreakpointAtLine(const String& script_url, | 435 Breakpoint* SetBreakpointAtLine(const String& script_url, |
| 372 intptr_t line_number); | 436 intptr_t line_number); |
| 373 RawError* OneTimeBreakAtEntry(const Function& target_function); | 437 RawError* OneTimeBreakAtEntry(const Function& target_function); |
| 374 | 438 |
| 439 BreakpointLocation* BreakpointLocationAtLine(const String& script_url, | |
| 440 intptr_t line_number); | |
| 441 | |
| 442 | |
| 375 void RemoveBreakpoint(intptr_t bp_id); | 443 void RemoveBreakpoint(intptr_t bp_id); |
| 376 SourceBreakpoint* GetBreakpointById(intptr_t id); | 444 Breakpoint* GetBreakpointById(intptr_t id); |
| 377 | 445 |
| 378 void SetStepOver(); | 446 void SetStepOver(); |
| 379 void SetSingleStep(); | 447 void SetSingleStep(); |
| 380 void SetStepOut(); | 448 void SetStepOut(); |
| 381 bool IsStepping() const { return resume_action_ != kContinue; } | 449 bool IsStepping() const { return resume_action_ != kContinue; } |
| 382 | 450 |
| 383 bool IsPaused() const { return pause_event_ != NULL; } | 451 bool IsPaused() const { return pause_event_ != NULL; } |
| 384 | 452 |
| 385 // Indicates why the debugger is currently paused. If the debugger | 453 // Indicates why the debugger is currently paused. If the debugger |
| 386 // is not paused, this returns NULL. Note that the debugger can be | 454 // is not paused, this returns NULL. Note that the debugger can be |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 intptr_t start_pos, | 537 intptr_t start_pos, |
| 470 intptr_t end_pos, | 538 intptr_t end_pos, |
| 471 GrowableObjectArray* function_list); | 539 GrowableObjectArray* function_list); |
| 472 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); | 540 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); |
| 473 RawFunction* FindInnermostClosure(const Function& function, | 541 RawFunction* FindInnermostClosure(const Function& function, |
| 474 intptr_t token_pos); | 542 intptr_t token_pos); |
| 475 intptr_t ResolveBreakpointPos(const Function& func, | 543 intptr_t ResolveBreakpointPos(const Function& func, |
| 476 intptr_t requested_token_pos, | 544 intptr_t requested_token_pos, |
| 477 intptr_t last_token_pos); | 545 intptr_t last_token_pos); |
| 478 void DeoptimizeWorld(); | 546 void DeoptimizeWorld(); |
| 479 SourceBreakpoint* SetBreakpoint(const Script& script, | 547 BreakpointLocation* SetBreakpoint(const Script& script, |
| 480 intptr_t token_pos, | 548 intptr_t token_pos, |
| 481 intptr_t last_token_pos); | 549 intptr_t last_token_pos); |
| 482 void RemoveInternalBreakpoints(); | 550 void RemoveInternalBreakpoints(); |
| 483 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); | 551 void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location); |
| 484 SourceBreakpoint* GetLatentBreakpoint(const String& url, intptr_t line); | 552 BreakpointLocation* GetLatentBreakpoint(const String& url, intptr_t line); |
| 485 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); | 553 void RegisterBreakpointLocation(BreakpointLocation* bpt); |
| 486 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); | 554 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); |
| 487 SourceBreakpoint* GetSourceBreakpoint(const Script& script, | 555 BreakpointLocation* GetBreakpointLocation(const Script& script, |
| 488 intptr_t token_pos); | 556 intptr_t token_pos); |
| 489 void MakeCodeBreakpointAt(const Function& func, | 557 void MakeCodeBreakpointAt(const Function& func, |
| 490 SourceBreakpoint* bpt); | 558 BreakpointLocation* bpt); |
| 491 // Returns NULL if no breakpoint exists for the given address. | 559 // Returns NULL if no breakpoint exists for the given address. |
| 492 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 560 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
| 493 | 561 |
| 494 void SyncBreakpoint(SourceBreakpoint* bpt); | 562 void SyncBreakpointLocation(BreakpointLocation* loc); |
| 495 | 563 |
| 496 ActivationFrame* TopDartFrame() const; | 564 ActivationFrame* TopDartFrame() const; |
| 497 static ActivationFrame* CollectDartFrame(Isolate* isolate, | 565 static ActivationFrame* CollectDartFrame(Isolate* isolate, |
| 498 uword pc, | 566 uword pc, |
| 499 StackFrame* frame, | 567 StackFrame* frame, |
| 500 const Code& code, | 568 const Code& code, |
| 501 const Array& deopt_frame, | 569 const Array& deopt_frame, |
| 502 intptr_t deopt_frame_offset); | 570 intptr_t deopt_frame_offset); |
| 503 static RawArray* DeoptimizeToArray(Isolate* isolate, | 571 static RawArray* DeoptimizeToArray(Isolate* isolate, |
| 504 StackFrame* frame, | 572 StackFrame* frame, |
| 505 const Code& code); | 573 const Code& code); |
| 506 static DebuggerStackTrace* CollectStackTrace(); | 574 static DebuggerStackTrace* CollectStackTrace(); |
| 507 void SignalBpResolved(SourceBreakpoint *bpt); | 575 void SignalBpResolved(Breakpoint *bpt); |
| 508 void SignalPausedEvent(ActivationFrame* top_frame, | 576 void SignalPausedEvent(ActivationFrame* top_frame, |
| 509 SourceBreakpoint* bpt); | 577 Breakpoint* bpt); |
| 510 | 578 |
| 511 intptr_t nextId() { return next_id_++; } | 579 intptr_t nextId() { return next_id_++; } |
| 512 | 580 |
| 513 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 581 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
| 514 const Instance& exc); | 582 const Instance& exc); |
| 515 | 583 |
| 516 void CollectLibraryFields(const GrowableObjectArray& field_list, | 584 void CollectLibraryFields(const GrowableObjectArray& field_list, |
| 517 const Library& lib, | 585 const Library& lib, |
| 518 const String& prefix, | 586 const String& prefix, |
| 519 bool include_private_fields); | 587 bool include_private_fields); |
| 520 | 588 |
| 521 // Handles any events which pause vm execution. Breakpoints, | 589 // Handles any events which pause vm execution. Breakpoints, |
| 522 // interrupts, etc. | 590 // interrupts, etc. |
| 523 void Pause(DebuggerEvent* event); | 591 void Pause(DebuggerEvent* event); |
| 524 | 592 |
| 525 void HandleSteppingRequest(DebuggerStackTrace* stack_trace); | 593 void HandleSteppingRequest(DebuggerStackTrace* stack_trace); |
| 526 | 594 |
| 527 Isolate* isolate_; | 595 Isolate* isolate_; |
| 528 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. | 596 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. |
| 529 bool initialized_; | 597 bool initialized_; |
| 530 | 598 |
| 531 // ID number generator. | 599 // ID number generator. |
| 532 intptr_t next_id_; | 600 intptr_t next_id_; |
| 533 | 601 |
| 534 SourceBreakpoint* latent_breakpoints_; | 602 BreakpointLocation* latent_locations_; |
| 535 SourceBreakpoint* src_breakpoints_; | 603 BreakpointLocation* breakpoint_locations_; |
| 536 CodeBreakpoint* code_breakpoints_; | 604 CodeBreakpoint* code_breakpoints_; |
| 537 | 605 |
| 538 // Tells debugger what to do when resuming execution after a breakpoint. | 606 // Tells debugger what to do when resuming execution after a breakpoint. |
| 539 ResumeAction resume_action_; | 607 ResumeAction resume_action_; |
| 540 | 608 |
| 541 // Do not call back to breakpoint handler if this flag is set. | 609 // Do not call back to breakpoint handler if this flag is set. |
| 542 // Effectively this means ignoring breakpoints. Set when Dart code may | 610 // Effectively this means ignoring breakpoints. Set when Dart code may |
| 543 // be run as a side effect of getting values of fields. | 611 // be run as a side effect of getting values of fields. |
| 544 bool ignore_breakpoints_; | 612 bool ignore_breakpoints_; |
| 545 | 613 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 558 // When stepping through code, only pause the program if the top | 626 // When stepping through code, only pause the program if the top |
| 559 // frame corresponds to this fp value, or if the top frame is | 627 // frame corresponds to this fp value, or if the top frame is |
| 560 // lower on the stack. | 628 // lower on the stack. |
| 561 uword stepping_fp_; | 629 uword stepping_fp_; |
| 562 | 630 |
| 563 Dart_ExceptionPauseInfo exc_pause_info_; | 631 Dart_ExceptionPauseInfo exc_pause_info_; |
| 564 | 632 |
| 565 static EventHandler* event_handler_; | 633 static EventHandler* event_handler_; |
| 566 | 634 |
| 567 friend class Isolate; | 635 friend class Isolate; |
| 568 friend class SourceBreakpoint; | 636 friend class BreakpointLocation; |
| 569 DISALLOW_COPY_AND_ASSIGN(Debugger); | 637 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 570 }; | 638 }; |
| 571 | 639 |
| 572 | 640 |
| 573 } // namespace dart | 641 } // namespace dart |
| 574 | 642 |
| 575 #endif // VM_DEBUGGER_H_ | 643 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |