| OLD | NEW |
| 1 // Copyright (c) 2011, 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 "vm/object.h" | 8 #include "vm/object.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 LocalVarDescriptors* var_descriptors_; | 154 LocalVarDescriptors* var_descriptors_; |
| 155 ZoneGrowableArray<intptr_t> desc_indices_; | 155 ZoneGrowableArray<intptr_t> desc_indices_; |
| 156 | 156 |
| 157 friend class Debugger; | 157 friend class Debugger; |
| 158 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); | 158 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 | 161 |
| 162 // Array of function activations on the call stack. | 162 // Array of function activations on the call stack. |
| 163 class StackTrace : public ZoneAllocated { | 163 class DebuggerStackTrace : public ZoneAllocated { |
| 164 public: | 164 public: |
| 165 explicit StackTrace(int capacity) : trace_(capacity) { } | 165 explicit DebuggerStackTrace(int capacity) : trace_(capacity) { } |
| 166 | 166 |
| 167 intptr_t Length() const { return trace_.length(); } | 167 intptr_t Length() const { return trace_.length(); } |
| 168 | 168 |
| 169 ActivationFrame* ActivationFrameAt(int i) const { | 169 ActivationFrame* ActivationFrameAt(int i) const { |
| 170 ASSERT(i < trace_.length()); | 170 ASSERT(i < trace_.length()); |
| 171 return trace_[i]; | 171 return trace_[i]; |
| 172 } | 172 } |
| 173 private: | 173 private: |
| 174 void AddActivation(ActivationFrame* frame); | 174 void AddActivation(ActivationFrame* frame); |
| 175 ZoneGrowableArray<ActivationFrame*> trace_; | 175 ZoneGrowableArray<ActivationFrame*> trace_; |
| 176 | 176 |
| 177 friend class Debugger; | 177 friend class Debugger; |
| 178 DISALLOW_COPY_AND_ASSIGN(StackTrace); | 178 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 | 181 |
| 182 typedef void BreakpointHandler(SourceBreakpoint* bpt, StackTrace* stack); | 182 typedef void BreakpointHandler(SourceBreakpoint* bpt, |
| 183 DebuggerStackTrace* stack); |
| 183 | 184 |
| 184 | 185 |
| 185 class Debugger { | 186 class Debugger { |
| 186 public: | 187 public: |
| 187 Debugger(); | 188 Debugger(); |
| 188 ~Debugger(); | 189 ~Debugger(); |
| 189 | 190 |
| 190 void Initialize(Isolate* isolate); | 191 void Initialize(Isolate* isolate); |
| 191 void Shutdown(); | 192 void Shutdown(); |
| 192 bool IsActive(); | 193 bool IsActive(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 238 |
| 238 void InstrumentForStepping(const Function &target_function); | 239 void InstrumentForStepping(const Function &target_function); |
| 239 SourceBreakpoint* SetBreakpoint(const Function& target_function, | 240 SourceBreakpoint* SetBreakpoint(const Function& target_function, |
| 240 intptr_t token_index); | 241 intptr_t token_index); |
| 241 void RemoveInternalBreakpoints(); | 242 void RemoveInternalBreakpoints(); |
| 242 void RemoveCodeBreakpoints(SourceBreakpoint* src_bpt); | 243 void RemoveCodeBreakpoints(SourceBreakpoint* src_bpt); |
| 243 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); | 244 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); |
| 244 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); | 245 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); |
| 245 SourceBreakpoint* GetSourceBreakpoint(const Function& func, | 246 SourceBreakpoint* GetSourceBreakpoint(const Function& func, |
| 246 intptr_t token_index); | 247 intptr_t token_index); |
| 247 CodeBreakpoint* MakeCodeBreakpoint(SourceBreakpoint* src_bpt); | 248 CodeBreakpoint* MakeCodeBreakpoint(const Function& func, |
| 249 intptr_t token_index); |
| 248 | 250 |
| 249 // Returns NULL if no breakpoint exists for the given address. | 251 // Returns NULL if no breakpoint exists for the given address. |
| 250 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 252 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
| 251 | 253 |
| 252 void SyncBreakpoint(SourceBreakpoint* bpt); | 254 void SyncBreakpoint(SourceBreakpoint* bpt); |
| 253 | 255 |
| 254 Isolate* isolate_; | 256 Isolate* isolate_; |
| 255 bool initialized_; | 257 bool initialized_; |
| 256 BreakpointHandler* bp_handler_; | 258 BreakpointHandler* bp_handler_; |
| 257 SourceBreakpoint* src_breakpoints_; | 259 SourceBreakpoint* src_breakpoints_; |
| 258 CodeBreakpoint* code_breakpoints_; | 260 CodeBreakpoint* code_breakpoints_; |
| 259 | 261 |
| 260 // Tells debugger what to do when resuming execution after a breakpoint. | 262 // Tells debugger what to do when resuming execution after a breakpoint. |
| 261 ResumeAction resume_action_; | 263 ResumeAction resume_action_; |
| 262 | 264 |
| 263 friend class SourceBreakpoint; | 265 friend class SourceBreakpoint; |
| 264 DISALLOW_COPY_AND_ASSIGN(Debugger); | 266 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 265 }; | 267 }; |
| 266 | 268 |
| 267 | 269 |
| 268 } // namespace dart | 270 } // namespace dart |
| 269 | 271 |
| 270 #endif // VM_DEBUGGER_H_ | 272 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |