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" |
11 #include "vm/port.h" | 11 #include "vm/port.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 class CodeBreakpoint; | 15 class CodeBreakpoint; |
16 class Isolate; | 16 class Isolate; |
17 class JSONArray; | 17 class JSONArray; |
18 class JSONStream; | 18 class JSONStream; |
19 class ObjectPointerVisitor; | 19 class ObjectPointerVisitor; |
20 class RemoteObjectCache; | 20 class RemoteObjectCache; |
21 class BreakpointLocation; | 21 class SourceBreakpoint; |
22 class StackFrame; | 22 class StackFrame; |
23 | 23 |
24 // A user-defined breakpoint, which either fires once, for a particular closure, | 24 // SourceBreakpoint represents a user-specified breakpoint location in |
25 // or always. The API's notion of a breakpoint corresponds to this object. | 25 // Dart source. There may be more than one CodeBreakpoint object per |
26 class Breakpoint { | 26 // SourceBreakpoint. |
27 public: | |
28 Breakpoint(intptr_t id, BreakpointLocation* bpt_location) | |
29 : id_(id), | |
30 kind_(Breakpoint::kNone), | |
31 next_(NULL), | |
32 closure_(Instance::null()), | |
33 bpt_location_(bpt_location) {} | |
34 | |
35 intptr_t id() const { return id_; } | |
36 Breakpoint* next() const { return next_; } | |
37 void set_next(Breakpoint* n) { next_ = n; } | |
38 | |
39 BreakpointLocation* bpt_location() const { return bpt_location_; } | |
40 void set_bpt_location(BreakpointLocation* new_bpt_location); | |
41 | |
42 bool IsRepeated() const { return kind_ == kRepeated; } | |
43 bool IsSingleShot() const { return kind_ == kSingleShot; } | |
44 bool IsPerClosure() const { return kind_ == kPerClosure; } | |
45 RawInstance* closure() const { return closure_; } | |
46 | |
47 void SetIsRepeated() { | |
48 ASSERT(kind_ == kNone); | |
49 kind_ = kRepeated; | |
50 } | |
51 | |
52 void SetIsSingleShot() { | |
53 ASSERT(kind_ == kNone); | |
54 kind_ = kSingleShot; | |
55 } | |
56 | |
57 void SetIsPerClosure(const Instance& closure) { | |
58 ASSERT(kind_ == kNone); | |
59 kind_ = kPerClosure; | |
60 closure_ = closure.raw(); | |
61 } | |
62 | |
63 void PrintJSON(JSONStream* stream); | |
64 | |
65 private: | |
66 void VisitObjectPointers(ObjectPointerVisitor* visitor); | |
67 | |
68 enum ConditionKind { | |
69 kNone, | |
70 kRepeated, | |
71 kSingleShot, | |
72 kPerClosure, | |
73 }; | |
74 | |
75 intptr_t id_; | |
76 ConditionKind kind_; | |
77 Breakpoint* next_; | |
78 RawInstance* closure_; | |
79 BreakpointLocation* bpt_location_; | |
80 | |
81 friend class BreakpointLocation; | |
82 DISALLOW_COPY_AND_ASSIGN(Breakpoint); | |
83 }; | |
84 | |
85 | |
86 // BreakpointLocation represents a collection of breakpoint conditions at the | |
87 // same token position in Dart source. There may be more than one CodeBreakpoint | |
88 // object per BreakpointLocation. | |
89 // An unresolved breakpoint is one where the underlying code has not | 27 // An unresolved breakpoint is one where the underlying code has not |
90 // been compiled yet. Since the code has not been compiled, we don't know | 28 // been compiled yet. Since the code has not been compiled, we don't know |
91 // the definitive source location yet. The requested source location may | 29 // the definitive source location yet. The requested source location may |
92 // change when the underlying code gets compiled. | 30 // change when the underlying code gets compiled. |
93 // A latent breakpoint represents a breakpoint location in Dart source | 31 // A latent breakpoint represents a breakpoint location in Dart source |
94 // that is not loaded in the VM when the breakpoint is requested. | 32 // that is not loaded in the VM when the breakpoint is requested. |
95 // When a script with matching url is loaded, a latent breakpoint | 33 // When a script with matching url is loaded, a latent breakpoint |
96 // becomes an unresolved breakpoint. | 34 // becomes an unresolved breakpoint. |
97 class BreakpointLocation { | 35 class SourceBreakpoint { |
98 public: | 36 public: |
99 // Create a new unresolved breakpoint. | 37 // Create a new unresolved breakpoint. |
100 BreakpointLocation(const Script& script, | 38 SourceBreakpoint(intptr_t id, |
101 intptr_t token_pos, | 39 const Script& script, |
102 intptr_t end_token_pos); | 40 intptr_t token_pos, |
| 41 intptr_t end_token_pos); |
103 // Create a new latent breakpoint. | 42 // Create a new latent breakpoint. |
104 BreakpointLocation(const String& url, | 43 SourceBreakpoint(intptr_t id, |
105 intptr_t line_number); | 44 const String& url, |
106 | 45 intptr_t line_number); |
107 ~BreakpointLocation(); | |
108 | 46 |
109 RawFunction* function() const { return function_; } | 47 RawFunction* function() const { return function_; } |
110 intptr_t token_pos() const { return token_pos_; } | 48 intptr_t token_pos() const { return token_pos_; } |
111 intptr_t end_token_pos() const { return end_token_pos_; } | 49 intptr_t end_token_pos() const { return end_token_pos_; } |
| 50 intptr_t id() const { return id_; } |
112 | 51 |
113 RawScript* script() const { return script_; } | 52 RawScript* script() const { return script_; } |
114 RawString* url() const { return url_; } | 53 RawString* url() const { return url_; } |
115 intptr_t LineNumber(); | 54 intptr_t LineNumber(); |
116 | 55 |
117 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); | 56 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); |
118 | 57 |
119 Breakpoint* AddRepeated(Debugger* dbg); | 58 void Enable(); |
120 Breakpoint* AddSingleShot(Debugger* dbg); | 59 void Disable(); |
121 Breakpoint* AddPerClosure(Debugger* dbg, const Instance& closure); | 60 bool IsEnabled() const { return is_enabled_; } |
122 | |
123 bool AnyEnabled() const; | |
124 bool IsResolved() const { return is_resolved_; } | 61 bool IsResolved() const { return is_resolved_; } |
125 bool IsLatent() const { return token_pos_ < 0; } | 62 bool IsLatent() const { return token_pos_ < 0; } |
126 | 63 |
| 64 bool IsOneShot() const { return is_one_shot_; } |
| 65 void SetIsOneShot() { is_one_shot_ = true; } |
| 66 |
| 67 void PrintJSON(JSONStream* stream); |
| 68 |
127 private: | 69 private: |
128 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 70 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
129 | 71 |
130 void SetResolved(const Function& func, intptr_t token_pos); | 72 void SetResolved(const Function& func, intptr_t token_pos); |
| 73 void set_next(SourceBreakpoint* value) { next_ = value; } |
| 74 SourceBreakpoint* next() const { return this->next_; } |
131 | 75 |
132 BreakpointLocation* next() const { return this->next_; } | 76 const intptr_t id_; |
133 void set_next(BreakpointLocation* value) { next_ = value; } | |
134 | |
135 void AddBreakpoint(Breakpoint* bpt, Debugger* dbg); | |
136 | |
137 Breakpoint* breakpoints() const { return this->conditions_; } | |
138 void set_breakpoints(Breakpoint* head) { this->conditions_ = head; } | |
139 | |
140 RawScript* script_; | 77 RawScript* script_; |
141 RawString* url_; | 78 RawString* url_; |
142 intptr_t token_pos_; | 79 intptr_t token_pos_; |
143 intptr_t end_token_pos_; | 80 intptr_t end_token_pos_; |
144 bool is_resolved_; | 81 bool is_resolved_; |
145 BreakpointLocation* next_; | 82 bool is_enabled_; |
146 Breakpoint* conditions_; | 83 bool is_one_shot_; |
| 84 SourceBreakpoint* next_; |
147 | 85 |
148 // Valid for resolved breakpoints: | 86 // Valid for resolved breakpoints: |
149 RawFunction* function_; | 87 RawFunction* function_; |
150 intptr_t line_number_; | 88 intptr_t line_number_; |
151 | 89 |
152 friend class Debugger; | 90 friend class Debugger; |
153 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation); | 91 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); |
154 }; | 92 }; |
155 | 93 |
156 | 94 |
157 // CodeBreakpoint represents a location in compiled code. There may be | 95 // CodeBreakpoint represents a location in compiled code. There may be |
158 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a | 96 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a |
159 // function gets compiled as a regular function and as a closure. | 97 // function gets compiled as a regular function and as a closure. |
160 class CodeBreakpoint { | 98 class CodeBreakpoint { |
161 public: | 99 public: |
162 CodeBreakpoint(const Code& code, | 100 CodeBreakpoint(const Code& code, |
163 intptr_t token_pos, | 101 intptr_t token_pos, |
164 uword pc, | 102 uword pc, |
165 RawPcDescriptors::Kind kind); | 103 RawPcDescriptors::Kind kind); |
166 ~CodeBreakpoint(); | 104 ~CodeBreakpoint(); |
167 | 105 |
168 RawFunction* function() const; | 106 RawFunction* function() const; |
169 uword pc() const { return pc_; } | 107 uword pc() const { return pc_; } |
170 intptr_t token_pos() const { return token_pos_; } | 108 intptr_t token_pos() const { return token_pos_; } |
171 bool IsInternal() const { return bpt_location_ == NULL; } | 109 bool IsInternal() const { return src_bpt_ == NULL; } |
172 | 110 |
173 RawScript* SourceCode(); | 111 RawScript* SourceCode(); |
174 RawString* SourceUrl(); | 112 RawString* SourceUrl(); |
175 intptr_t LineNumber(); | 113 intptr_t LineNumber(); |
176 | 114 |
177 void Enable(); | 115 void Enable(); |
178 void Disable(); | 116 void Disable(); |
179 bool IsEnabled() const { return is_enabled_; } | 117 bool IsEnabled() const { return is_enabled_; } |
180 | 118 |
181 uword OrigStubAddress() const; | 119 uword OrigStubAddress() const; |
182 | 120 |
183 private: | 121 private: |
184 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 122 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
185 | 123 |
186 BreakpointLocation* bpt_location() const { return bpt_location_; } | 124 SourceBreakpoint* src_bpt() const { return src_bpt_; } |
187 void set_bpt_location(BreakpointLocation* value) { bpt_location_ = value; } | 125 void set_src_bpt(SourceBreakpoint* value) { src_bpt_ = value; } |
188 | 126 |
189 void set_next(CodeBreakpoint* value) { next_ = value; } | 127 void set_next(CodeBreakpoint* value) { next_ = value; } |
190 CodeBreakpoint* next() const { return this->next_; } | 128 CodeBreakpoint* next() const { return this->next_; } |
191 | 129 |
192 void PatchCode(); | 130 void PatchCode(); |
193 void RestoreCode(); | 131 void RestoreCode(); |
194 | 132 |
195 RawCode* code_; | 133 RawCode* code_; |
196 intptr_t token_pos_; | 134 intptr_t token_pos_; |
197 uword pc_; | 135 uword pc_; |
198 intptr_t line_number_; | 136 intptr_t line_number_; |
199 bool is_enabled_; | 137 bool is_enabled_; |
200 | 138 |
201 BreakpointLocation* bpt_location_; | 139 SourceBreakpoint* src_bpt_; |
202 CodeBreakpoint* next_; | 140 CodeBreakpoint* next_; |
203 | 141 |
204 RawPcDescriptors::Kind breakpoint_kind_; | 142 RawPcDescriptors::Kind breakpoint_kind_; |
205 uword saved_value_; | 143 uword saved_value_; |
206 | 144 |
207 friend class Debugger; | 145 friend class Debugger; |
208 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); | 146 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); |
209 }; | 147 }; |
210 | 148 |
211 | 149 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 187 |
250 intptr_t NumLocalVariables(); | 188 intptr_t NumLocalVariables(); |
251 | 189 |
252 void VariableAt(intptr_t i, | 190 void VariableAt(intptr_t i, |
253 String* name, | 191 String* name, |
254 intptr_t* token_pos, | 192 intptr_t* token_pos, |
255 intptr_t* end_pos, | 193 intptr_t* end_pos, |
256 Object* value); | 194 Object* value); |
257 | 195 |
258 RawArray* GetLocalVariables(); | 196 RawArray* GetLocalVariables(); |
259 RawObject* GetParameter(intptr_t index); | |
260 RawObject* GetClosure(); | |
261 RawObject* GetReceiver(); | 197 RawObject* GetReceiver(); |
262 | 198 |
263 const Context& GetSavedCurrentContext(); | 199 const Context& GetSavedCurrentContext(); |
264 | 200 |
265 RawObject* Evaluate(const String& expr); | 201 RawObject* Evaluate(const String& expr); |
266 | 202 |
267 // Print the activation frame into |jsobj|. if |full| is false, script | 203 // Print the activation frame into |jsobj|. if |full| is false, script |
268 // and local variable objects are only references. if |full| is true, | 204 // and local variable objects are only references. if |full| is true, |
269 // the complete script, function, and, local variable objects are included. | 205 // the complete script, function, and, local variable objects are included. |
270 void PrintToJSONObject(JSONObject* jsobj, bool full = false); | 206 void PrintToJSONObject(JSONObject* jsobj, bool full = false); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 266 |
331 private: | 267 private: |
332 void AddActivation(ActivationFrame* frame); | 268 void AddActivation(ActivationFrame* frame); |
333 ZoneGrowableArray<ActivationFrame*> trace_; | 269 ZoneGrowableArray<ActivationFrame*> trace_; |
334 | 270 |
335 friend class Debugger; | 271 friend class Debugger; |
336 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); | 272 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); |
337 }; | 273 }; |
338 | 274 |
339 | 275 |
| 276 typedef void BreakpointHandler(Dart_Port isolate_id, |
| 277 SourceBreakpoint* bpt, |
| 278 DebuggerStackTrace* stack); |
| 279 |
| 280 |
340 class DebuggerEvent { | 281 class DebuggerEvent { |
341 public: | 282 public: |
342 enum EventType { | 283 enum EventType { |
343 kBreakpointReached = 1, | 284 kBreakpointReached = 1, |
344 kBreakpointResolved = 2, | 285 kBreakpointResolved = 2, |
345 kExceptionThrown = 3, | 286 kExceptionThrown = 3, |
346 kIsolateCreated = 4, | 287 kIsolateCreated = 4, |
347 kIsolateShutdown = 5, | 288 kIsolateShutdown = 5, |
348 kIsolateInterrupted = 6, | 289 kIsolateInterrupted = 6, |
349 }; | 290 }; |
(...skipping 17 matching lines...) Expand all Loading... |
367 | 308 |
368 ActivationFrame* top_frame() const { | 309 ActivationFrame* top_frame() const { |
369 ASSERT(IsPauseEvent()); | 310 ASSERT(IsPauseEvent()); |
370 return top_frame_; | 311 return top_frame_; |
371 } | 312 } |
372 void set_top_frame(ActivationFrame* frame) { | 313 void set_top_frame(ActivationFrame* frame) { |
373 ASSERT(IsPauseEvent()); | 314 ASSERT(IsPauseEvent()); |
374 top_frame_ = frame; | 315 top_frame_ = frame; |
375 } | 316 } |
376 | 317 |
377 Breakpoint* breakpoint() const { | 318 SourceBreakpoint* breakpoint() const { |
378 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); | 319 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); |
379 return breakpoint_; | 320 return breakpoint_; |
380 } | 321 } |
381 void set_breakpoint(Breakpoint* bpt) { | 322 void set_breakpoint(SourceBreakpoint* bpt) { |
382 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); | 323 ASSERT(type_ == kBreakpointReached || type_ == kBreakpointResolved); |
383 breakpoint_ = bpt; | 324 breakpoint_ = bpt; |
384 } | 325 } |
385 | 326 |
386 const Object* exception() const { | 327 const Object* exception() const { |
387 ASSERT(type_ == kExceptionThrown); | 328 ASSERT(type_ == kExceptionThrown); |
388 return exception_; | 329 return exception_; |
389 } | 330 } |
390 void set_exception(const Object* exception) { | 331 void set_exception(const Object* exception) { |
391 ASSERT(type_ == kExceptionThrown); | 332 ASSERT(type_ == kExceptionThrown); |
392 exception_ = exception; | 333 exception_ = exception; |
393 } | 334 } |
394 | 335 |
395 Dart_Port isolate_id() const { | 336 Dart_Port isolate_id() const { |
396 return isolate_->main_port(); | 337 return isolate_->main_port(); |
397 } | 338 } |
398 | 339 |
399 private: | 340 private: |
400 Isolate* isolate_; | 341 Isolate* isolate_; |
401 EventType type_; | 342 EventType type_; |
402 ActivationFrame* top_frame_; | 343 ActivationFrame* top_frame_; |
403 Breakpoint* breakpoint_; | 344 SourceBreakpoint* breakpoint_; |
404 const Object* exception_; | 345 const Object* exception_; |
405 }; | 346 }; |
406 | 347 |
407 | 348 |
408 class Debugger { | 349 class Debugger { |
409 public: | 350 public: |
410 typedef void EventHandler(DebuggerEvent* event); | 351 typedef void EventHandler(DebuggerEvent* event); |
411 | 352 |
412 Debugger(); | 353 Debugger(); |
413 ~Debugger(); | 354 ~Debugger(); |
414 | 355 |
415 void Initialize(Isolate* isolate); | 356 void Initialize(Isolate* isolate); |
416 void NotifyIsolateCreated(); | 357 void NotifyIsolateCreated(); |
417 void Shutdown(); | 358 void Shutdown(); |
418 | 359 |
419 void NotifyCompilation(const Function& func); | 360 void NotifyCompilation(const Function& func); |
420 void NotifyDoneLoading(); | 361 void NotifyDoneLoading(); |
421 | 362 |
422 RawFunction* ResolveFunction(const Library& library, | 363 RawFunction* ResolveFunction(const Library& library, |
423 const String& class_name, | 364 const String& class_name, |
424 const String& function_name); | 365 const String& function_name); |
425 | 366 |
426 // Set breakpoint at closest location to function entry. | 367 // Set breakpoint at closest location to function entry. |
427 Breakpoint* SetBreakpointAtEntry(const Function& target_function, | 368 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function); |
428 bool single_shot); | |
429 Breakpoint* SetBreakpointAtActivation(const Instance& closure); | |
430 | 369 |
431 // TODO(turnidge): script_url may no longer be specific enough. | 370 // TODO(turnidge): script_url may no longer be specific enough. |
432 Breakpoint* SetBreakpointAtLine(const String& script_url, | 371 SourceBreakpoint* SetBreakpointAtLine(const String& script_url, |
433 intptr_t line_number); | 372 intptr_t line_number); |
434 RawError* OneTimeBreakAtEntry(const Function& target_function); | 373 RawError* OneTimeBreakAtEntry(const Function& target_function); |
435 | 374 |
436 BreakpointLocation* BreakpointLocationAtLine(const String& script_url, | |
437 intptr_t line_number); | |
438 | |
439 | |
440 void RemoveBreakpoint(intptr_t bp_id); | 375 void RemoveBreakpoint(intptr_t bp_id); |
441 Breakpoint* GetBreakpointById(intptr_t id); | 376 SourceBreakpoint* GetBreakpointById(intptr_t id); |
442 | 377 |
443 void SetStepOver(); | 378 void SetStepOver(); |
444 void SetSingleStep(); | 379 void SetSingleStep(); |
445 void SetStepOut(); | 380 void SetStepOut(); |
446 bool IsStepping() const { return resume_action_ != kContinue; } | 381 bool IsStepping() const { return resume_action_ != kContinue; } |
447 | 382 |
448 bool IsPaused() const { return pause_event_ != NULL; } | 383 bool IsPaused() const { return pause_event_ != NULL; } |
449 | 384 |
450 // Indicates why the debugger is currently paused. If the debugger | 385 // Indicates why the debugger is currently paused. If the debugger |
451 // is not paused, this returns NULL. Note that the debugger can be | 386 // is not paused, this returns NULL. Note that the debugger can be |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 intptr_t start_pos, | 469 intptr_t start_pos, |
535 intptr_t end_pos, | 470 intptr_t end_pos, |
536 GrowableObjectArray* function_list); | 471 GrowableObjectArray* function_list); |
537 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); | 472 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); |
538 RawFunction* FindInnermostClosure(const Function& function, | 473 RawFunction* FindInnermostClosure(const Function& function, |
539 intptr_t token_pos); | 474 intptr_t token_pos); |
540 intptr_t ResolveBreakpointPos(const Function& func, | 475 intptr_t ResolveBreakpointPos(const Function& func, |
541 intptr_t requested_token_pos, | 476 intptr_t requested_token_pos, |
542 intptr_t last_token_pos); | 477 intptr_t last_token_pos); |
543 void DeoptimizeWorld(); | 478 void DeoptimizeWorld(); |
544 BreakpointLocation* SetBreakpoint(const Script& script, | 479 SourceBreakpoint* SetBreakpoint(const Script& script, |
545 intptr_t token_pos, | 480 intptr_t token_pos, |
546 intptr_t last_token_pos); | 481 intptr_t last_token_pos); |
547 void RemoveInternalBreakpoints(); | 482 void RemoveInternalBreakpoints(); |
548 void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location); | 483 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); |
549 BreakpointLocation* GetLatentBreakpoint(const String& url, intptr_t line); | 484 SourceBreakpoint* GetLatentBreakpoint(const String& url, intptr_t line); |
550 void RegisterBreakpointLocation(BreakpointLocation* bpt); | 485 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); |
551 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); | 486 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); |
552 BreakpointLocation* GetBreakpointLocation(const Script& script, | 487 SourceBreakpoint* GetSourceBreakpoint(const Script& script, |
553 intptr_t token_pos); | 488 intptr_t token_pos); |
554 void MakeCodeBreakpointAt(const Function& func, | 489 void MakeCodeBreakpointAt(const Function& func, |
555 BreakpointLocation* bpt); | 490 SourceBreakpoint* bpt); |
556 // Returns NULL if no breakpoint exists for the given address. | 491 // Returns NULL if no breakpoint exists for the given address. |
557 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); | 492 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); |
558 | 493 |
559 void SyncBreakpointLocation(BreakpointLocation* loc); | 494 void SyncBreakpoint(SourceBreakpoint* bpt); |
560 | 495 |
561 ActivationFrame* TopDartFrame() const; | 496 ActivationFrame* TopDartFrame() const; |
562 static ActivationFrame* CollectDartFrame(Isolate* isolate, | 497 static ActivationFrame* CollectDartFrame(Isolate* isolate, |
563 uword pc, | 498 uword pc, |
564 StackFrame* frame, | 499 StackFrame* frame, |
565 const Code& code, | 500 const Code& code, |
566 const Array& deopt_frame, | 501 const Array& deopt_frame, |
567 intptr_t deopt_frame_offset); | 502 intptr_t deopt_frame_offset); |
568 static RawArray* DeoptimizeToArray(Isolate* isolate, | 503 static RawArray* DeoptimizeToArray(Isolate* isolate, |
569 StackFrame* frame, | 504 StackFrame* frame, |
570 const Code& code); | 505 const Code& code); |
571 static DebuggerStackTrace* CollectStackTrace(); | 506 static DebuggerStackTrace* CollectStackTrace(); |
572 void SignalBpResolved(Breakpoint *bpt); | 507 void SignalBpResolved(SourceBreakpoint *bpt); |
573 void SignalPausedEvent(ActivationFrame* top_frame, | 508 void SignalPausedEvent(ActivationFrame* top_frame, |
574 Breakpoint* bpt); | 509 SourceBreakpoint* bpt); |
575 | 510 |
576 intptr_t nextId() { return next_id_++; } | 511 intptr_t nextId() { return next_id_++; } |
577 | 512 |
578 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 513 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
579 const Instance& exc); | 514 const Instance& exc); |
580 | 515 |
581 void CollectLibraryFields(const GrowableObjectArray& field_list, | 516 void CollectLibraryFields(const GrowableObjectArray& field_list, |
582 const Library& lib, | 517 const Library& lib, |
583 const String& prefix, | 518 const String& prefix, |
584 bool include_private_fields); | 519 bool include_private_fields); |
585 | 520 |
586 // Handles any events which pause vm execution. Breakpoints, | 521 // Handles any events which pause vm execution. Breakpoints, |
587 // interrupts, etc. | 522 // interrupts, etc. |
588 void Pause(DebuggerEvent* event); | 523 void Pause(DebuggerEvent* event); |
589 | 524 |
590 void HandleSteppingRequest(DebuggerStackTrace* stack_trace); | 525 void HandleSteppingRequest(DebuggerStackTrace* stack_trace); |
591 | 526 |
592 Isolate* isolate_; | 527 Isolate* isolate_; |
593 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. | 528 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. |
594 bool initialized_; | 529 bool initialized_; |
595 | 530 |
596 // ID number generator. | 531 // ID number generator. |
597 intptr_t next_id_; | 532 intptr_t next_id_; |
598 | 533 |
599 BreakpointLocation* latent_locations_; | 534 SourceBreakpoint* latent_breakpoints_; |
600 BreakpointLocation* breakpoint_locations_; | 535 SourceBreakpoint* src_breakpoints_; |
601 CodeBreakpoint* code_breakpoints_; | 536 CodeBreakpoint* code_breakpoints_; |
602 | 537 |
603 // Tells debugger what to do when resuming execution after a breakpoint. | 538 // Tells debugger what to do when resuming execution after a breakpoint. |
604 ResumeAction resume_action_; | 539 ResumeAction resume_action_; |
605 | 540 |
606 // Do not call back to breakpoint handler if this flag is set. | 541 // Do not call back to breakpoint handler if this flag is set. |
607 // Effectively this means ignoring breakpoints. Set when Dart code may | 542 // Effectively this means ignoring breakpoints. Set when Dart code may |
608 // be run as a side effect of getting values of fields. | 543 // be run as a side effect of getting values of fields. |
609 bool ignore_breakpoints_; | 544 bool ignore_breakpoints_; |
610 | 545 |
(...skipping 12 matching lines...) Expand all Loading... |
623 // When stepping through code, only pause the program if the top | 558 // When stepping through code, only pause the program if the top |
624 // frame corresponds to this fp value, or if the top frame is | 559 // frame corresponds to this fp value, or if the top frame is |
625 // lower on the stack. | 560 // lower on the stack. |
626 uword stepping_fp_; | 561 uword stepping_fp_; |
627 | 562 |
628 Dart_ExceptionPauseInfo exc_pause_info_; | 563 Dart_ExceptionPauseInfo exc_pause_info_; |
629 | 564 |
630 static EventHandler* event_handler_; | 565 static EventHandler* event_handler_; |
631 | 566 |
632 friend class Isolate; | 567 friend class Isolate; |
633 friend class BreakpointLocation; | 568 friend class SourceBreakpoint; |
634 DISALLOW_COPY_AND_ASSIGN(Debugger); | 569 DISALLOW_COPY_AND_ASSIGN(Debugger); |
635 }; | 570 }; |
636 | 571 |
637 | 572 |
638 } // namespace dart | 573 } // namespace dart |
639 | 574 |
640 #endif // VM_DEBUGGER_H_ | 575 #endif // VM_DEBUGGER_H_ |
OLD | NEW |