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

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

Issue 1312763010: Support column-based breakpoints in the VM and Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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
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_tools_api.h" 8 #include "include/dart_tools_api.h"
9 9
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // change when the underlying code gets compiled. 92 // change when the underlying code gets compiled.
93 // A latent breakpoint represents a breakpoint location in Dart source 93 // A latent breakpoint represents a breakpoint location in Dart source
94 // that is not loaded in the VM when the breakpoint is requested. 94 // that is not loaded in the VM when the breakpoint is requested.
95 // When a script with matching url is loaded, a latent breakpoint 95 // When a script with matching url is loaded, a latent breakpoint
96 // becomes an unresolved breakpoint. 96 // becomes an unresolved breakpoint.
97 class BreakpointLocation { 97 class BreakpointLocation {
98 public: 98 public:
99 // Create a new unresolved breakpoint. 99 // Create a new unresolved breakpoint.
100 BreakpointLocation(const Script& script, 100 BreakpointLocation(const Script& script,
101 intptr_t token_pos, 101 intptr_t token_pos,
102 intptr_t end_token_pos); 102 intptr_t end_token_pos,
103 intptr_t requested_column_number);
103 // Create a new latent breakpoint. 104 // Create a new latent breakpoint.
104 BreakpointLocation(const String& url, 105 BreakpointLocation(const String& url,
105 intptr_t line_number); 106 intptr_t requested_line_number,
107 intptr_t requested_column_number);
106 108
107 ~BreakpointLocation(); 109 ~BreakpointLocation();
108 110
109 RawFunction* function() const { return function_; } 111 RawFunction* function() const { return function_; }
110 intptr_t token_pos() const { return token_pos_; } 112 intptr_t token_pos() const { return token_pos_; }
111 intptr_t end_token_pos() const { return end_token_pos_; } 113 intptr_t end_token_pos() const { return end_token_pos_; }
112 114
113 RawScript* script() const { return script_; } 115 RawScript* script() const { return script_; }
114 RawString* url() const { return url_; } 116 RawString* url() const { return url_; }
117
118 intptr_t requested_line_number() { return requested_line_number_; }
119 intptr_t requested_column_number() { return requested_column_number_; }
120
115 intptr_t LineNumber(); 121 intptr_t LineNumber();
122 intptr_t ColumnNumber();
116 123
117 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos); 124 void GetCodeLocation(Library* lib, Script* script, intptr_t* token_pos);
118 125
119 Breakpoint* AddRepeated(Debugger* dbg); 126 Breakpoint* AddRepeated(Debugger* dbg);
120 Breakpoint* AddSingleShot(Debugger* dbg); 127 Breakpoint* AddSingleShot(Debugger* dbg);
121 Breakpoint* AddPerClosure(Debugger* dbg, const Instance& closure); 128 Breakpoint* AddPerClosure(Debugger* dbg, const Instance& closure);
122 129
123 bool AnyEnabled() const; 130 bool AnyEnabled() const;
124 bool IsResolved() const { return is_resolved_; } 131 bool IsResolved() const { return is_resolved_; }
125 bool IsLatent() const { return token_pos_ < 0; } 132 bool IsLatent() const { return token_pos_ < 0; }
(...skipping 11 matching lines...) Expand all
137 Breakpoint* breakpoints() const { return this->conditions_; } 144 Breakpoint* breakpoints() const { return this->conditions_; }
138 void set_breakpoints(Breakpoint* head) { this->conditions_ = head; } 145 void set_breakpoints(Breakpoint* head) { this->conditions_ = head; }
139 146
140 RawScript* script_; 147 RawScript* script_;
141 RawString* url_; 148 RawString* url_;
142 intptr_t token_pos_; 149 intptr_t token_pos_;
143 intptr_t end_token_pos_; 150 intptr_t end_token_pos_;
144 bool is_resolved_; 151 bool is_resolved_;
145 BreakpointLocation* next_; 152 BreakpointLocation* next_;
146 Breakpoint* conditions_; 153 Breakpoint* conditions_;
154 intptr_t requested_line_number_;
155 intptr_t requested_column_number_;
147 156
148 // Valid for resolved breakpoints: 157 // Valid for resolved breakpoints:
149 RawFunction* function_; 158 RawFunction* function_;
150 intptr_t line_number_; 159 intptr_t line_number_;
160 intptr_t column_number_;
151 161
152 friend class Debugger; 162 friend class Debugger;
153 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation); 163 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
154 }; 164 };
155 165
156 166
157 // CodeBreakpoint represents a location in compiled code. There may be 167 // CodeBreakpoint represents a location in compiled code. There may be
158 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a 168 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a
159 // function gets compiled as a regular function and as a closure. 169 // function gets compiled as a regular function and as a closure.
160 class CodeBreakpoint { 170 class CodeBreakpoint {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 463
454 // Set breakpoint at closest location to function entry. 464 // Set breakpoint at closest location to function entry.
455 Breakpoint* SetBreakpointAtEntry(const Function& target_function, 465 Breakpoint* SetBreakpointAtEntry(const Function& target_function,
456 bool single_shot); 466 bool single_shot);
457 Breakpoint* SetBreakpointAtActivation(const Instance& closure); 467 Breakpoint* SetBreakpointAtActivation(const Instance& closure);
458 Breakpoint* BreakpointAtActivation(const Instance& closure); 468 Breakpoint* BreakpointAtActivation(const Instance& closure);
459 469
460 // TODO(turnidge): script_url may no longer be specific enough. 470 // TODO(turnidge): script_url may no longer be specific enough.
461 Breakpoint* SetBreakpointAtLine(const String& script_url, 471 Breakpoint* SetBreakpointAtLine(const String& script_url,
462 intptr_t line_number); 472 intptr_t line_number);
473 Breakpoint* SetBreakpointAtLineCol(const String& script_url,
474 intptr_t line_number,
475 intptr_t column_number);
463 RawError* OneTimeBreakAtEntry(const Function& target_function); 476 RawError* OneTimeBreakAtEntry(const Function& target_function);
464 477
465 BreakpointLocation* BreakpointLocationAtLine(const String& script_url, 478 BreakpointLocation* BreakpointLocationAtLineCol(const String& script_url,
466 intptr_t line_number); 479 intptr_t line_number,
480 intptr_t column_number);
467 481
468 482
469 void RemoveBreakpoint(intptr_t bp_id); 483 void RemoveBreakpoint(intptr_t bp_id);
470 Breakpoint* GetBreakpointById(intptr_t id); 484 Breakpoint* GetBreakpointById(intptr_t id);
471 485
472 void SetStepOver(); 486 void SetStepOver();
473 void SetSingleStep(); 487 void SetSingleStep();
474 void SetStepOut(); 488 void SetStepOut();
475 bool IsStepping() const { return resume_action_ != kContinue; } 489 bool IsStepping() const { return resume_action_ != kContinue; }
476 490
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 582
569 void FindCompiledFunctions(const Script& script, 583 void FindCompiledFunctions(const Script& script,
570 intptr_t start_pos, 584 intptr_t start_pos,
571 intptr_t end_pos, 585 intptr_t end_pos,
572 GrowableObjectArray* function_list); 586 GrowableObjectArray* function_list);
573 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); 587 RawFunction* FindBestFit(const Script& script, intptr_t token_pos);
574 RawFunction* FindInnermostClosure(const Function& function, 588 RawFunction* FindInnermostClosure(const Function& function,
575 intptr_t token_pos); 589 intptr_t token_pos);
576 intptr_t ResolveBreakpointPos(const Function& func, 590 intptr_t ResolveBreakpointPos(const Function& func,
577 intptr_t requested_token_pos, 591 intptr_t requested_token_pos,
578 intptr_t last_token_pos); 592 intptr_t last_token_pos,
593 intptr_t requested_col);
579 void DeoptimizeWorld(); 594 void DeoptimizeWorld();
580 BreakpointLocation* SetBreakpoint(const Script& script, 595 BreakpointLocation* SetBreakpoint(const Script& script,
581 intptr_t token_pos, 596 intptr_t token_pos,
582 intptr_t last_token_pos); 597 intptr_t last_token_pos,
598 intptr_t requested_col);
583 void RemoveInternalBreakpoints(); 599 void RemoveInternalBreakpoints();
584 void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location); 600 void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location);
585 BreakpointLocation* GetLatentBreakpoint(const String& url, intptr_t line); 601 BreakpointLocation* GetLatentBreakpoint(const String& url,
602 intptr_t line,
603 intptr_t column);
586 void RegisterBreakpointLocation(BreakpointLocation* bpt); 604 void RegisterBreakpointLocation(BreakpointLocation* bpt);
587 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); 605 void RegisterCodeBreakpoint(CodeBreakpoint* bpt);
588 BreakpointLocation* GetBreakpointLocation(const Script& script, 606 BreakpointLocation* GetBreakpointLocation(const Script& script,
589 intptr_t token_pos); 607 intptr_t token_pos,
608 intptr_t requested_column);
590 void MakeCodeBreakpointAt(const Function& func, 609 void MakeCodeBreakpointAt(const Function& func,
591 BreakpointLocation* bpt); 610 BreakpointLocation* bpt);
592 // Returns NULL if no breakpoint exists for the given address. 611 // Returns NULL if no breakpoint exists for the given address.
593 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); 612 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
594 613
595 void SyncBreakpointLocation(BreakpointLocation* loc); 614 void SyncBreakpointLocation(BreakpointLocation* loc);
596 615
597 ActivationFrame* TopDartFrame() const; 616 ActivationFrame* TopDartFrame() const;
598 static ActivationFrame* CollectDartFrame(Isolate* isolate, 617 static ActivationFrame* CollectDartFrame(Isolate* isolate,
599 uword pc, 618 uword pc,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 686
668 friend class Isolate; 687 friend class Isolate;
669 friend class BreakpointLocation; 688 friend class BreakpointLocation;
670 DISALLOW_COPY_AND_ASSIGN(Debugger); 689 DISALLOW_COPY_AND_ASSIGN(Debugger);
671 }; 690 };
672 691
673 692
674 } // namespace dart 693 } // namespace dart
675 694
676 #endif // VM_DEBUGGER_H_ 695 #endif // VM_DEBUGGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698