| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // SourceBreakpoint represents a user-specified breakpoint location in | 22 // SourceBreakpoint represents a user-specified breakpoint location in |
| 23 // Dart source. There may be more than one CodeBreakpoint object per | 23 // Dart source. There may be more than one CodeBreakpoint object per |
| 24 // SourceBreakpoint. | 24 // SourceBreakpoint. |
| 25 class SourceBreakpoint { | 25 class SourceBreakpoint { |
| 26 public: | 26 public: |
| 27 SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos); | 27 SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos); |
| 28 | 28 |
| 29 RawFunction* function() const { return function_; } | 29 RawFunction* function() const { return function_; } |
| 30 intptr_t token_pos() const { return token_pos_; } | 30 intptr_t token_pos() const { return token_pos_; } |
| 31 void set_token_pos(intptr_t value) { token_pos_ = value; } |
| 31 intptr_t id() const { return id_; } | 32 intptr_t id() const { return id_; } |
| 32 | 33 |
| 33 RawScript* SourceCode(); | 34 RawScript* SourceCode(); |
| 34 RawString* SourceUrl(); | 35 RawString* SourceUrl(); |
| 35 intptr_t LineNumber(); | 36 intptr_t LineNumber(); |
| 36 | 37 |
| 37 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); | 38 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); |
| 38 | 39 |
| 39 void Enable(); | 40 void Enable(); |
| 40 void Disable(); | 41 void Disable(); |
| 41 bool IsEnabled() const { return is_enabled_; } | 42 bool IsEnabled() const { return is_enabled_; } |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 45 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 45 | 46 |
| 46 void set_function(const Function& func); | 47 void set_function(const Function& func); |
| 47 void set_next(SourceBreakpoint* value) { next_ = value; } | 48 void set_next(SourceBreakpoint* value) { next_ = value; } |
| 48 SourceBreakpoint* next() const { return this->next_; } | 49 SourceBreakpoint* next() const { return this->next_; } |
| 49 | 50 |
| 50 const intptr_t id_; | 51 const intptr_t id_; |
| 51 RawFunction* function_; | 52 RawFunction* function_; |
| 52 const intptr_t token_pos_; | 53 intptr_t token_pos_; |
| 53 intptr_t line_number_; | 54 intptr_t line_number_; |
| 54 bool is_enabled_; | 55 bool is_enabled_; |
| 55 | 56 |
| 56 SourceBreakpoint* next_; | 57 SourceBreakpoint* next_; |
| 57 | 58 |
| 58 friend class Debugger; | 59 friend class Debugger; |
| 59 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); | 60 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 | 63 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 static void SignalIsolateEvent(EventType type); | 311 static void SignalIsolateEvent(EventType type); |
| 311 | 312 |
| 312 private: | 313 private: |
| 313 enum ResumeAction { | 314 enum ResumeAction { |
| 314 kContinue, | 315 kContinue, |
| 315 kStepOver, | 316 kStepOver, |
| 316 kStepInto, | 317 kStepInto, |
| 317 kStepOut | 318 kStepOut |
| 318 }; | 319 }; |
| 319 | 320 |
| 321 intptr_t ResolveBreakpointPos(const Function& func, |
| 322 intptr_t first_token_pos, |
| 323 intptr_t last_token_pos); |
| 320 void DeoptimizeWorld(); | 324 void DeoptimizeWorld(); |
| 321 void InstrumentForStepping(const Function& target_function); | 325 void InstrumentForStepping(const Function& target_function); |
| 322 SourceBreakpoint* SetBreakpoint(const Function& target_function, | 326 SourceBreakpoint* SetBreakpoint(const Function& target_function, |
| 323 intptr_t first_token_pos, | 327 intptr_t first_token_pos, |
| 324 intptr_t last_token_pos); | 328 intptr_t last_token_pos); |
| 325 void RemoveInternalBreakpoints(); | 329 void RemoveInternalBreakpoints(); |
| 326 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); | 330 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); |
| 327 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); | 331 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); |
| 328 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); | 332 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); |
| 329 SourceBreakpoint* GetSourceBreakpoint(const Function& func, | 333 SourceBreakpoint* GetSourceBreakpoint(const Function& func, |
| 330 intptr_t token_pos); | 334 intptr_t token_pos); |
| 331 CodeBreakpoint* MakeCodeBreakpoint(const Function& func, | 335 void MakeCodeBreakpointsAt(const Function& func, |
| 332 intptr_t first_token_pos, | 336 intptr_t token_pos, |
| 333 intptr_t last_token_pos); | 337 SourceBreakpoint* bpt); |
| 334 | |
| 335 // Returns NULL if no breakpoint exists for the given address. | 338 // Returns NULL if no breakpoint exists for the given address. |
| 336 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 339 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
| 337 | 340 |
| 338 void SyncBreakpoint(SourceBreakpoint* bpt); | 341 void SyncBreakpoint(SourceBreakpoint* bpt); |
| 339 | 342 |
| 340 static DebuggerStackTrace* CollectStackTrace(); | 343 static DebuggerStackTrace* CollectStackTrace(); |
| 341 void SignalBpResolved(SourceBreakpoint *bpt); | 344 void SignalBpResolved(SourceBreakpoint *bpt); |
| 342 | 345 |
| 343 bool IsDebuggable(const Function& func); | 346 bool IsDebuggable(const Function& func); |
| 344 | 347 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 389 |
| 387 friend class Isolate; | 390 friend class Isolate; |
| 388 friend class SourceBreakpoint; | 391 friend class SourceBreakpoint; |
| 389 DISALLOW_COPY_AND_ASSIGN(Debugger); | 392 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 390 }; | 393 }; |
| 391 | 394 |
| 392 | 395 |
| 393 } // namespace dart | 396 } // namespace dart |
| 394 | 397 |
| 395 #endif // VM_DEBUGGER_H_ | 398 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |