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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 friend class Debugger; | 72 friend class Debugger; |
73 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); | 73 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); |
74 }; | 74 }; |
75 | 75 |
76 | 76 |
77 // CodeBreakpoint represents a location in compiled code. There may be | 77 // CodeBreakpoint represents a location in compiled code. There may be |
78 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a | 78 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a |
79 // function gets compiled as a regular function and as a closure. | 79 // function gets compiled as a regular function and as a closure. |
80 class CodeBreakpoint { | 80 class CodeBreakpoint { |
81 public: | 81 public: |
82 CodeBreakpoint(const Code& code, intptr_t pc_desc_index); | 82 CodeBreakpoint(const Code& code, |
| 83 const RawPcDescriptors::PcDescriptorRec& rec); |
83 ~CodeBreakpoint(); | 84 ~CodeBreakpoint(); |
84 | 85 |
85 RawFunction* function() const; | 86 RawFunction* function() const; |
86 uword pc() const { return pc_; } | 87 uword pc() const { return pc_; } |
87 intptr_t token_pos() const { return token_pos_; } | 88 intptr_t token_pos() const { return token_pos_; } |
88 bool IsInternal() const { return src_bpt_ == NULL; } | 89 bool IsInternal() const { return src_bpt_ == NULL; } |
89 | 90 |
90 RawScript* SourceCode(); | 91 RawScript* SourceCode(); |
91 RawString* SourceUrl(); | 92 RawString* SourceUrl(); |
92 intptr_t LineNumber(); | 93 intptr_t LineNumber(); |
93 | 94 |
94 void Enable(); | 95 void Enable(); |
95 void Disable(); | 96 void Disable(); |
96 bool IsEnabled() const { return is_enabled_; } | 97 bool IsEnabled() const { return is_enabled_; } |
97 | 98 |
98 uword OrigStubAddress() const; | 99 uword OrigStubAddress() const; |
99 | 100 |
100 private: | 101 private: |
101 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 102 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
102 | 103 |
103 SourceBreakpoint* src_bpt() const { return src_bpt_; } | 104 SourceBreakpoint* src_bpt() const { return src_bpt_; } |
104 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } | 105 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } |
105 | 106 |
106 void set_next(CodeBreakpoint* value) { next_ = value; } | 107 void set_next(CodeBreakpoint* value) { next_ = value; } |
107 CodeBreakpoint* next() const { return this->next_; } | 108 CodeBreakpoint* next() const { return this->next_; } |
108 intptr_t pc_desc_index() const { return pc_desc_index_; } | |
109 | 109 |
110 void PatchCode(); | 110 void PatchCode(); |
111 void RestoreCode(); | 111 void RestoreCode(); |
112 | 112 |
113 RawCode* code_; | 113 RawCode* code_; |
114 intptr_t pc_desc_index_; | |
115 intptr_t token_pos_; | 114 intptr_t token_pos_; |
116 uword pc_; | 115 uword pc_; |
117 intptr_t line_number_; | 116 intptr_t line_number_; |
118 bool is_enabled_; | 117 bool is_enabled_; |
119 | 118 |
120 SourceBreakpoint* src_bpt_; | 119 SourceBreakpoint* src_bpt_; |
121 CodeBreakpoint* next_; | 120 CodeBreakpoint* next_; |
122 | 121 |
123 PcDescriptors::Kind breakpoint_kind_; | 122 RawPcDescriptors::Kind breakpoint_kind_; |
124 uword saved_value_; | 123 uword saved_value_; |
125 | 124 |
126 friend class Debugger; | 125 friend class Debugger; |
127 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); | 126 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); |
128 }; | 127 }; |
129 | 128 |
130 | 129 |
131 // ActivationFrame represents one dart function activation frame | 130 // ActivationFrame represents one dart function activation frame |
132 // on the call stack. | 131 // on the call stack. |
133 class ActivationFrame : public ZoneAllocated { | 132 class ActivationFrame : public ZoneAllocated { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 RawObject* Evaluate(const String& expr); | 183 RawObject* Evaluate(const String& expr); |
185 | 184 |
186 void PrintToJSONObject(JSONObject* jsobj); | 185 void PrintToJSONObject(JSONObject* jsobj); |
187 | 186 |
188 private: | 187 private: |
189 void PrintContextMismatchError(const String& var_name, | 188 void PrintContextMismatchError(const String& var_name, |
190 intptr_t ctx_slot, | 189 intptr_t ctx_slot, |
191 intptr_t frame_ctx_level, | 190 intptr_t frame_ctx_level, |
192 intptr_t var_ctx_level); | 191 intptr_t var_ctx_level); |
193 | 192 |
194 intptr_t PcDescIndex(); | |
195 intptr_t TryIndex(); | 193 intptr_t TryIndex(); |
196 void GetPcDescriptors(); | 194 void GetPcDescriptors(); |
197 void GetVarDescriptors(); | 195 void GetVarDescriptors(); |
198 void GetDescIndices(); | 196 void GetDescIndices(); |
199 | 197 |
200 RawObject* GetLocalVar(intptr_t slot_index); | 198 RawObject* GetLocalVar(intptr_t slot_index); |
201 RawInstance* GetLocalInstanceVar(intptr_t slot_index); | 199 RawInstance* GetLocalInstanceVar(intptr_t slot_index); |
202 RawContext* GetLocalContextVar(intptr_t slot_index); | 200 RawContext* GetLocalContextVar(intptr_t slot_index); |
203 | 201 |
204 RawInstance* GetLocalVarValue(intptr_t slot_index); | 202 RawInstance* GetLocalVarValue(intptr_t slot_index); |
205 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); | 203 RawInstance* GetInstanceCallReceiver(intptr_t num_actual_args); |
206 RawObject* GetClosureObject(intptr_t num_acatual_args); | 204 RawObject* GetClosureObject(intptr_t num_acatual_args); |
207 | 205 |
208 uword pc_; | 206 uword pc_; |
209 uword fp_; | 207 uword fp_; |
210 uword sp_; | 208 uword sp_; |
211 | 209 |
212 // The anchor of the context chain for this function. | 210 // The anchor of the context chain for this function. |
213 Context& ctx_; | 211 Context& ctx_; |
214 const Code& code_; | 212 const Code& code_; |
215 const Function& function_; | 213 const Function& function_; |
216 intptr_t token_pos_; | 214 intptr_t token_pos_; |
217 intptr_t pc_desc_index_; | 215 const RawPcDescriptors::PcDescriptorRec* desc_rec_; |
| 216 |
218 intptr_t line_number_; | 217 intptr_t line_number_; |
219 intptr_t column_number_; | 218 intptr_t column_number_; |
220 intptr_t context_level_; | 219 intptr_t context_level_; |
221 | 220 |
222 // Some frames are deoptimized into a side array in order to inspect them. | 221 // Some frames are deoptimized into a side array in order to inspect them. |
223 const Array& deopt_frame_; | 222 const Array& deopt_frame_; |
224 const intptr_t deopt_frame_offset_; | 223 const intptr_t deopt_frame_offset_; |
225 | 224 |
226 bool vars_initialized_; | 225 bool vars_initialized_; |
227 LocalVarDescriptors& var_descriptors_; | 226 LocalVarDescriptors& var_descriptors_; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 549 |
551 friend class Isolate; | 550 friend class Isolate; |
552 friend class SourceBreakpoint; | 551 friend class SourceBreakpoint; |
553 DISALLOW_COPY_AND_ASSIGN(Debugger); | 552 DISALLOW_COPY_AND_ASSIGN(Debugger); |
554 }; | 553 }; |
555 | 554 |
556 | 555 |
557 } // namespace dart | 556 } // namespace dart |
558 | 557 |
559 #endif // VM_DEBUGGER_H_ | 558 #endif // VM_DEBUGGER_H_ |
OLD | NEW |