| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); | 113 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 | 116 |
| 117 | 117 |
| 118 | 118 |
| 119 // ActivationFrame represents one dart function activation frame | 119 // ActivationFrame represents one dart function activation frame |
| 120 // on the call stack. | 120 // on the call stack. |
| 121 class ActivationFrame : public ZoneAllocated { | 121 class ActivationFrame : public ZoneAllocated { |
| 122 public: | 122 public: |
| 123 explicit ActivationFrame(uword pc, uword fp, uword sp); | 123 explicit ActivationFrame(uword pc, uword fp, uword sp, const Context& ctx); |
| 124 | 124 |
| 125 uword pc() const { return pc_; } | 125 uword pc() const { return pc_; } |
| 126 uword fp() const { return fp_; } | 126 uword fp() const { return fp_; } |
| 127 uword sp() const { return sp_; } | 127 uword sp() const { return sp_; } |
| 128 | 128 |
| 129 const Function& DartFunction(); | 129 const Function& DartFunction(); |
| 130 RawString* QualifiedFunctionName(); | 130 RawString* QualifiedFunctionName(); |
| 131 RawString* SourceUrl(); | 131 RawString* SourceUrl(); |
| 132 RawScript* SourceScript(); | 132 RawScript* SourceScript(); |
| 133 intptr_t TokenIndex(); | 133 intptr_t TokenIndex(); |
| 134 intptr_t LineNumber(); | 134 intptr_t LineNumber(); |
| 135 |
| 136 // The context level of a frame is the context level at the |
| 137 // PC/token index of the frame. It determines the depth of the context |
| 138 // chain that belongs to the function of this activation frame. |
| 139 intptr_t ContextLevel(); |
| 140 |
| 135 const char* ToCString(); | 141 const char* ToCString(); |
| 136 | 142 |
| 137 intptr_t NumLocalVariables(); | 143 intptr_t NumLocalVariables(); |
| 138 | 144 |
| 139 void VariableAt(intptr_t i, | 145 void VariableAt(intptr_t i, |
| 140 String* name, | 146 String* name, |
| 141 intptr_t* token_pos, | 147 intptr_t* token_pos, |
| 142 intptr_t* end_pos, | 148 intptr_t* end_pos, |
| 143 Instance* value); | 149 Instance* value); |
| 144 | 150 |
| 145 RawArray* GetLocalVariables(); | 151 RawArray* GetLocalVariables(); |
| 152 RawContext* CallerContext(); |
| 146 | 153 |
| 147 private: | 154 private: |
| 155 intptr_t PcDescIndex(); |
| 156 void GetPcDescriptors(); |
| 157 void GetVarDescriptors(); |
| 148 void GetDescIndices(); | 158 void GetDescIndices(); |
| 149 RawInstance* GetLocalVarValue(intptr_t slot_index); | 159 RawInstance* GetLocalVarValue(intptr_t slot_index); |
| 150 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); | 160 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); |
| 151 | 161 |
| 152 uword pc_; | 162 uword pc_; |
| 153 uword fp_; | 163 uword fp_; |
| 154 uword sp_; | 164 uword sp_; |
| 165 |
| 166 // The anchor of the context chain for this function. |
| 167 const Context& ctx_; |
| 168 |
| 155 Function& function_; | 169 Function& function_; |
| 156 intptr_t token_index_; | 170 intptr_t token_index_; |
| 171 intptr_t pc_desc_index_; |
| 157 intptr_t line_number_; | 172 intptr_t line_number_; |
| 173 intptr_t context_level_; |
| 158 | 174 |
| 175 bool vars_initialized_; |
| 159 LocalVarDescriptors& var_descriptors_; | 176 LocalVarDescriptors& var_descriptors_; |
| 160 ZoneGrowableArray<intptr_t> desc_indices_; | 177 ZoneGrowableArray<intptr_t> desc_indices_; |
| 178 PcDescriptors& pc_desc_; |
| 161 | 179 |
| 162 friend class Debugger; | 180 friend class Debugger; |
| 163 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); | 181 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); |
| 164 }; | 182 }; |
| 165 | 183 |
| 166 | 184 |
| 167 // Array of function activations on the call stack. | 185 // Array of function activations on the call stack. |
| 168 class DebuggerStackTrace : public ZoneAllocated { | 186 class DebuggerStackTrace : public ZoneAllocated { |
| 169 public: | 187 public: |
| 170 explicit DebuggerStackTrace(int capacity) | 188 explicit DebuggerStackTrace(int capacity) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 intptr_t exc_pause_info_; | 348 intptr_t exc_pause_info_; |
| 331 | 349 |
| 332 friend class SourceBreakpoint; | 350 friend class SourceBreakpoint; |
| 333 DISALLOW_COPY_AND_ASSIGN(Debugger); | 351 DISALLOW_COPY_AND_ASSIGN(Debugger); |
| 334 }; | 352 }; |
| 335 | 353 |
| 336 | 354 |
| 337 } // namespace dart | 355 } // namespace dart |
| 338 | 356 |
| 339 #endif // VM_DEBUGGER_H_ | 357 #endif // VM_DEBUGGER_H_ |
| OLD | NEW |