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

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

Issue 9271008: Implement deletion of breakpoints (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/include/dart_debugger_api.h ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/object.h" 8 #include "vm/object.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 class Breakpoint; 12 class Breakpoint;
13 class Isolate; 13 class Isolate;
14 class ObjectPointerVisitor; 14 class ObjectPointerVisitor;
15 class ActiveVariables; 15 class ActiveVariables;
16 16
17 17
18 // Breakpoint represents a location in Dart source and the corresponding 18 // Breakpoint represents a location in Dart source and the corresponding
19 // address in compiled code. 19 // address in compiled code.
20 class Breakpoint { 20 class Breakpoint {
21 public: 21 public:
22 Breakpoint(const Function& func, intptr_t pc_desc_index); 22 Breakpoint(const Function& func, intptr_t pc_desc_index);
23 23
24 RawFunction* function() const { return function_; } 24 RawFunction* function() const { return function_; }
25 uword pc() const { return pc_; } 25 uword pc() const { return pc_; }
26 intptr_t token_index() const { return token_index_; }
26 27
27 RawScript* SourceCode(); 28 RawScript* SourceCode();
28 RawString* SourceUrl(); 29 RawString* SourceUrl();
29 intptr_t LineNumber(); 30 intptr_t LineNumber();
30 31
31 private: 32 private:
32 void VisitObjectPointers(ObjectPointerVisitor* visitor); 33 void VisitObjectPointers(ObjectPointerVisitor* visitor);
33 34
34 void set_next(Breakpoint* value) { next_ = value; } 35 void set_next(Breakpoint* value) { next_ = value; }
35 Breakpoint* next() const { return this->next_; } 36 Breakpoint* next() const { return this->next_; }
37 intptr_t pc_desc_index() const { return pc_desc_index_; }
36 38
37 RawFunction* function_; 39 RawFunction* function_;
38 intptr_t pc_desc_index_; 40 intptr_t pc_desc_index_;
39 intptr_t token_index_; 41 intptr_t token_index_;
40 uword pc_; 42 uword pc_;
43 uword saved_bytes_;
41 intptr_t line_number_; 44 intptr_t line_number_;
42 Breakpoint* next_; 45 Breakpoint* next_;
43 46
44 friend class Debugger; 47 friend class Debugger;
45 DISALLOW_COPY_AND_ASSIGN(Breakpoint); 48 DISALLOW_COPY_AND_ASSIGN(Breakpoint);
46 }; 49 };
47 50
48 51
49 // ActivationFrame represents one dart function activation frame 52 // ActivationFrame represents one dart function activation frame
50 // on the call stack. 53 // on the call stack.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 DISALLOW_COPY_AND_ASSIGN(StackTrace); 110 DISALLOW_COPY_AND_ASSIGN(StackTrace);
108 }; 111 };
109 112
110 113
111 typedef void BreakpointHandler(Breakpoint* bpt, StackTrace* stack); 114 typedef void BreakpointHandler(Breakpoint* bpt, StackTrace* stack);
112 115
113 116
114 class Debugger { 117 class Debugger {
115 public: 118 public:
116 Debugger(); 119 Debugger();
120 ~Debugger();
117 121
118 void Initialize(Isolate* isolate); 122 void Initialize(Isolate* isolate);
123 void Shutdown();
119 bool IsActive(); 124 bool IsActive();
120 125
121 void SetBreakpointHandler(BreakpointHandler* handler); 126 void SetBreakpointHandler(BreakpointHandler* handler);
122 127
123 RawFunction* ResolveFunction(const Library& library, 128 RawFunction* ResolveFunction(const Library& library,
124 const String& class_name, 129 const String& class_name,
125 const String& function_name); 130 const String& function_name);
126 131
127 // Set breakpoint at closest location to function entry. 132 // Set breakpoint at closest location to function entry.
128 Breakpoint* SetBreakpointAtEntry(const Function& target_function); 133 Breakpoint* SetBreakpointAtEntry(const Function& target_function);
129 Breakpoint* SetBreakpointAtLine(const String& script_url, 134 Breakpoint* SetBreakpointAtLine(const String& script_url,
130 intptr_t line_number); 135 intptr_t line_number);
131 136
137 void RemoveBreakpoint(Breakpoint* bpt);
138
132 void VisitObjectPointers(ObjectPointerVisitor* visitor); 139 void VisitObjectPointers(ObjectPointerVisitor* visitor);
133 140
134 // Returns NULL if no breakpoint exists for the given address. 141 // Returns NULL if no breakpoint exists for the given address.
135 Breakpoint* GetBreakpoint(uword breakpoint_address); 142 Breakpoint* GetBreakpoint(uword breakpoint_address);
136 143
137 // Called from Runtime when a breakpoint in Dart code is reached. 144 // Called from Runtime when a breakpoint in Dart code is reached.
138 void BreakpointCallback(); 145 void BreakpointCallback();
139 146
140 // Utility functions. 147 // Utility functions.
141 static const char* QualifiedFunctionName(const Function& func); 148 static const char* QualifiedFunctionName(const Function& func);
142 149
143 private: 150 private:
144 Breakpoint* SetBreakpoint(const Function& target_function, 151 Breakpoint* SetBreakpoint(const Function& target_function,
145 intptr_t token_index); 152 intptr_t token_index);
146 void AddBreakpoint(Breakpoint* bpt); 153 void UnsetBreakpoint(Breakpoint* bpt);
154 Breakpoint* NewBreakpoint(const Function& func, intptr_t pc_desc_index);
155 void RegisterBreakpoint(Breakpoint* bpt);
156 Breakpoint* GetBreakpointByFunction(const Function& func,
157 intptr_t token_index);
147 158
148 bool initialized_; 159 bool initialized_;
149 BreakpointHandler* bp_handler_; 160 BreakpointHandler* bp_handler_;
150 Breakpoint* breakpoints_; 161 Breakpoint* breakpoints_;
151 DISALLOW_COPY_AND_ASSIGN(Debugger); 162 DISALLOW_COPY_AND_ASSIGN(Debugger);
152 }; 163 };
153 164
154 165
155 } // namespace dart 166 } // namespace dart
156 167
157 #endif // VM_DEBUGGER_H_ 168 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « runtime/include/dart_debugger_api.h ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698