| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 friend class Debugger; | 67 friend class Debugger; |
| 68 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); | 68 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 | 71 |
| 72 // CodeBreakpoint represents a location in compiled code. There may be | 72 // CodeBreakpoint represents a location in compiled code. There may be |
| 73 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a | 73 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a |
| 74 // function gets compiled as a regular function and as a closure. | 74 // function gets compiled as a regular function and as a closure. |
| 75 class CodeBreakpoint { | 75 class CodeBreakpoint { |
| 76 public: | 76 public: |
| 77 CodeBreakpoint(const Function& func, intptr_t pc_desc_index); | 77 CodeBreakpoint(const Code& code, intptr_t pc_desc_index); |
| 78 ~CodeBreakpoint(); | 78 ~CodeBreakpoint(); |
| 79 | 79 |
| 80 RawFunction* function() const { return function_; } | 80 RawFunction* function() const; |
| 81 uword pc() const { return pc_; } | 81 uword pc() const { return pc_; } |
| 82 intptr_t token_pos() const { return token_pos_; } | 82 intptr_t token_pos() const { return token_pos_; } |
| 83 bool IsInternal() const { return src_bpt_ == NULL; } | 83 bool IsInternal() const { return src_bpt_ == NULL; } |
| 84 | 84 |
| 85 RawScript* SourceCode(); | 85 RawScript* SourceCode(); |
| 86 RawString* SourceUrl(); | 86 RawString* SourceUrl(); |
| 87 intptr_t LineNumber(); | 87 intptr_t LineNumber(); |
| 88 | 88 |
| 89 void Enable(); | 89 void Enable(); |
| 90 void Disable(); | 90 void Disable(); |
| 91 bool IsEnabled() const { return is_enabled_; } | 91 bool IsEnabled() const { return is_enabled_; } |
| 92 | 92 |
| 93 uword OrigStubAddress() const; | 93 uword OrigStubAddress() const; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 96 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 97 | 97 |
| 98 SourceBreakpoint* src_bpt() const { return src_bpt_; } | 98 SourceBreakpoint* src_bpt() const { return src_bpt_; } |
| 99 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } | 99 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } |
| 100 | 100 |
| 101 void set_next(CodeBreakpoint* value) { next_ = value; } | 101 void set_next(CodeBreakpoint* value) { next_ = value; } |
| 102 CodeBreakpoint* next() const { return this->next_; } | 102 CodeBreakpoint* next() const { return this->next_; } |
| 103 intptr_t pc_desc_index() const { return pc_desc_index_; } | 103 intptr_t pc_desc_index() const { return pc_desc_index_; } |
| 104 | 104 |
| 105 void PatchCode(); | 105 void PatchCode(); |
| 106 void RestoreCode(); | 106 void RestoreCode(); |
| 107 | 107 |
| 108 RawFunction* function_; | 108 RawCode* code_; |
| 109 intptr_t pc_desc_index_; | 109 intptr_t pc_desc_index_; |
| 110 intptr_t token_pos_; | 110 intptr_t token_pos_; |
| 111 uword pc_; | 111 uword pc_; |
| 112 intptr_t line_number_; | 112 intptr_t line_number_; |
| 113 bool is_enabled_; | 113 bool is_enabled_; |
| 114 | 114 |
| 115 SourceBreakpoint* src_bpt_; | 115 SourceBreakpoint* src_bpt_; |
| 116 CodeBreakpoint* next_; | 116 CodeBreakpoint* next_; |
| 117 | 117 |
| 118 PcDescriptors::Kind breakpoint_kind_; | 118 PcDescriptors::Kind breakpoint_kind_; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 const DebuggerEvent* PauseEvent() const { return pause_event_; } | 311 const DebuggerEvent* PauseEvent() const { return pause_event_; } |
| 312 | 312 |
| 313 void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info); | 313 void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info); |
| 314 Dart_ExceptionPauseInfo GetExceptionPauseInfo(); | 314 Dart_ExceptionPauseInfo GetExceptionPauseInfo(); |
| 315 | 315 |
| 316 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 316 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 317 | 317 |
| 318 // Called from Runtime when a breakpoint in Dart code is reached. | 318 // Called from Runtime when a breakpoint in Dart code is reached. |
| 319 void BreakpointCallback(); | 319 void BreakpointCallback(); |
| 320 | 320 |
| 321 // Returns true if there is at least one breakpoint set in func. | 321 // Returns true if there is at least one breakpoint set in func or code. |
| 322 // Checks for both user-defined and internal temporary breakpoints. | 322 // Checks for both user-defined and internal temporary breakpoints. |
| 323 bool HasBreakpoint(const Function& func); | 323 bool HasBreakpoint(const Function& func); |
| 324 bool HasBreakpoint(const Code& code); |
| 324 | 325 |
| 325 // Returns true if the call at address pc is patched to point to | 326 // Returns true if the call at address pc is patched to point to |
| 326 // a debugger stub. | 327 // a debugger stub. |
| 327 bool HasActiveBreakpoint(uword pc); | 328 bool HasActiveBreakpoint(uword pc); |
| 328 | 329 |
| 329 // Returns a stack trace with frames corresponding to invisible functions | 330 // Returns a stack trace with frames corresponding to invisible functions |
| 330 // omitted. CurrentStackTrace always returns a new trace on the current stack. | 331 // omitted. CurrentStackTrace always returns a new trace on the current stack. |
| 331 // The trace returned by StackTrace may have been cached; it is suitable for | 332 // The trace returned by StackTrace may have been cached; it is suitable for |
| 332 // use when stepping, but otherwise may be out of sync with the current stack. | 333 // use when stepping, but otherwise may be out of sync with the current stack. |
| 333 DebuggerStackTrace* StackTrace(); | 334 DebuggerStackTrace* StackTrace(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 477 |
| 477 friend class Isolate; | 478 friend class Isolate; |
| 478 friend class SourceBreakpoint; | 479 friend class SourceBreakpoint; |
| 479 DISALLOW_COPY_AND_ASSIGN(Debugger); | 480 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 480 }; | 481 }; |
| 481 | 482 |
| 482 | 483 |
| 483 } // namespace dart | 484 } // namespace dart |
| 484 | 485 |
| 485 #endif // VM_DEBUGGER_H_ | 486 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |