Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: runtime/vm/debugger.h

Issue 117133005: Change how debugger handles source breakpoints (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | runtime/vm/debugger.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ActiveVariables; 15 class ActiveVariables;
16 class CodeBreakpoint; 16 class CodeBreakpoint;
17 class Isolate; 17 class Isolate;
18 class JSONArray; 18 class JSONArray;
19 class JSONStream; 19 class JSONStream;
20 class ObjectPointerVisitor; 20 class ObjectPointerVisitor;
21 class RemoteObjectCache; 21 class RemoteObjectCache;
22 class SourceBreakpoint; 22 class SourceBreakpoint;
23 class StackFrame; 23 class StackFrame;
24 24
25 // SourceBreakpoint represents a user-specified breakpoint location in 25 // SourceBreakpoint represents a user-specified breakpoint location in
26 // Dart source. There may be more than one CodeBreakpoint object per 26 // Dart source. There may be more than one CodeBreakpoint object per
27 // SourceBreakpoint. 27 // SourceBreakpoint.
28 class SourceBreakpoint { 28 class SourceBreakpoint {
29 public: 29 public:
turnidge 2013/12/19 22:31:59 Maybe comment whether the range includes end or no
hausner 2013/12/21 00:08:32 obsolete
30 SourceBreakpoint(intptr_t id, const Function& func, intptr_t token_pos); 30 SourceBreakpoint(intptr_t id, const Script& script,
31 intptr_t range_start,
32 intptr_t range_end);
31 33
32 RawFunction* function() const { return function_; } 34 RawFunction* function() const { return function_; }
33 intptr_t token_pos() const { return token_pos_; } 35 intptr_t token_pos() const { return token_pos_; }
34 void set_token_pos(intptr_t value) { token_pos_ = value; }
35 intptr_t id() const { return id_; } 36 intptr_t id() const { return id_; }
36 37
37 RawScript* SourceCode(); 38 RawScript* script() { return script_; }
38 RawString* SourceUrl(); 39 RawString* SourceUrl();
39 intptr_t LineNumber(); 40 intptr_t LineNumber();
40 41
41 void GetCodeLocation(Library* lib, 42 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos);
42 Script* script,
43 intptr_t* token_pos) const;
44 43
45 void Enable(); 44 void Enable();
46 void Disable(); 45 void Disable();
47 bool IsEnabled() const { return is_enabled_; } 46 bool IsEnabled() const { return is_enabled_; }
47 bool IsResolved() { return token_pos_ >= 0; }
48 48
49 void PrintToJSONStream(JSONStream* stream) const; 49 void PrintToJSONStream(JSONStream* stream);
50 50
51 private: 51 private:
52 void VisitObjectPointers(ObjectPointerVisitor* visitor); 52 void VisitObjectPointers(ObjectPointerVisitor* visitor);
53 53
54 void set_function(const Function& func); 54 void SetResolved(const Function& func, intptr_t token_pos);
55 void set_next(SourceBreakpoint* value) { next_ = value; } 55 void set_next(SourceBreakpoint* value) { next_ = value; }
56 SourceBreakpoint* next() const { return this->next_; } 56 SourceBreakpoint* next() const { return this->next_; }
57 57
58 const intptr_t id_; 58 const intptr_t id_;
59 RawScript* script_;
60 const intptr_t range_start_;
61 const intptr_t range_end_;
62 bool is_enabled_;
63 SourceBreakpoint* next_;
64
65 // Valid for resolved breakpoints:
59 RawFunction* function_; 66 RawFunction* function_;
60 intptr_t token_pos_; 67 intptr_t token_pos_;
61 intptr_t line_number_; 68 intptr_t line_number_;
62 bool is_enabled_;
63
64 SourceBreakpoint* next_;
65 69
66 friend class Debugger; 70 friend class Debugger;
67 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint); 71 DISALLOW_COPY_AND_ASSIGN(SourceBreakpoint);
68 }; 72 };
69 73
70 74
71 // CodeBreakpoint represents a location in compiled code. There may be 75 // CodeBreakpoint represents a location in compiled code. There may be
72 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a 76 // more than one CodeBreakpoint for one SourceBreakpoint, e.g. when a
73 // function gets compiled as a regular function and as a closure. 77 // function gets compiled as a regular function and as a closure.
74 class CodeBreakpoint { 78 class CodeBreakpoint {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 static bool IsDebuggable(const Function& func); 367 static bool IsDebuggable(const Function& func);
364 368
365 private: 369 private:
366 enum ResumeAction { 370 enum ResumeAction {
367 kContinue, 371 kContinue,
368 kStepOver, 372 kStepOver,
369 kStepOut, 373 kStepOut,
370 kSingleStep 374 kSingleStep
371 }; 375 };
372 376
377 void FindAllFunctions(const Script& script,
378 intptr_t start_pos,
379 intptr_t end_pos,
380 GrowableObjectArray* function_list);
381 RawFunction* FindBestFit(const Script& script,
382 intptr_t range_start,
383 intptr_t range_end);
384 RawFunction* FindInnermostClosure(const Function& function,
385 intptr_t range_start,
386 intptr_t range_end);
373 intptr_t ResolveBreakpointPos(const Function& func, 387 intptr_t ResolveBreakpointPos(const Function& func,
374 intptr_t first_token_pos, 388 intptr_t first_token_pos,
375 intptr_t last_token_pos); 389 intptr_t last_token_pos);
376 void DeoptimizeWorld(); 390 void DeoptimizeWorld();
377 void InstrumentForStepping(const Function& target_function); 391 void InstrumentForStepping(const Function& target_function);
392 SourceBreakpoint* SetBreakpoint(const Script& script,
393 intptr_t range_start,
394 intptr_t range_end);
378 SourceBreakpoint* SetBreakpoint(const Function& target_function, 395 SourceBreakpoint* SetBreakpoint(const Function& target_function,
379 intptr_t first_token_pos, 396 intptr_t first_token_pos,
380 intptr_t last_token_pos); 397 intptr_t last_token_pos);
381 void RemoveInternalBreakpoints(); 398 void RemoveInternalBreakpoints();
382 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); 399 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt);
383 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); 400 void RegisterSourceBreakpoint(SourceBreakpoint* bpt);
384 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); 401 void RegisterCodeBreakpoint(CodeBreakpoint* bpt);
385 SourceBreakpoint* GetSourceBreakpoint(const Function& func, 402 SourceBreakpoint* GetResolvedBreakpoint(const Script& script,
386 intptr_t token_pos); 403 intptr_t token_pos);
404 SourceBreakpoint* GetUnresolvedBreakpoint(const Script& script,
405 intptr_t range_start);
387 void MakeCodeBreakpointsAt(const Function& func, 406 void MakeCodeBreakpointsAt(const Function& func,
388 intptr_t token_pos,
389 SourceBreakpoint* bpt); 407 SourceBreakpoint* bpt);
390 // Returns NULL if no breakpoint exists for the given address. 408 // Returns NULL if no breakpoint exists for the given address.
391 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); 409 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
392 410
393 void SyncBreakpoint(SourceBreakpoint* bpt); 411 void SyncBreakpoint(SourceBreakpoint* bpt);
394 412
395 ActivationFrame* TopDartFrame() const; 413 ActivationFrame* TopDartFrame() const;
396 static ActivationFrame* CollectDartFrame(Isolate* isolate, 414 static ActivationFrame* CollectDartFrame(Isolate* isolate,
397 uword pc, 415 uword pc,
398 StackFrame* frame, 416 StackFrame* frame,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 470
453 friend class Isolate; 471 friend class Isolate;
454 friend class SourceBreakpoint; 472 friend class SourceBreakpoint;
455 DISALLOW_COPY_AND_ASSIGN(Debugger); 473 DISALLOW_COPY_AND_ASSIGN(Debugger);
456 }; 474 };
457 475
458 476
459 } // namespace dart 477 } // namespace dart
460 478
461 #endif // VM_DEBUGGER_H_ 479 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | runtime/vm/debugger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698