OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEBUG_DEBUG_INTERFACE_H_ | 5 #ifndef V8_DEBUG_DEBUG_INTERFACE_H_ |
6 #define V8_DEBUG_DEBUG_INTERFACE_H_ | 6 #define V8_DEBUG_DEBUG_INTERFACE_H_ |
7 | 7 |
8 #include "include/v8-debug.h" | 8 #include "include/v8-debug.h" |
9 #include "include/v8-util.h" | 9 #include "include/v8-util.h" |
10 #include "include/v8.h" | 10 #include "include/v8.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 StepNext = 1, // Step to the next statement in the current function. | 134 StepNext = 1, // Step to the next statement in the current function. |
135 StepIn = 2, // Step into new functions invoked or the next statement | 135 StepIn = 2, // Step into new functions invoked or the next statement |
136 // in the current function. | 136 // in the current function. |
137 StepFrame = 3 // Step into a new frame or return to previous frame. | 137 StepFrame = 3 // Step into a new frame or return to previous frame. |
138 }; | 138 }; |
139 | 139 |
140 static void PrepareStep(Isolate* isolate, StepAction action); | 140 static void PrepareStep(Isolate* isolate, StepAction action); |
141 static void ClearStepping(Isolate* isolate); | 141 static void ClearStepping(Isolate* isolate); |
142 | 142 |
143 /** | 143 /** |
| 144 * Defines location inside script. |
| 145 * Lines and columns are 0-based. |
| 146 */ |
| 147 class Location { |
| 148 public: |
| 149 Location(int lineNumber, int columnNumber); |
| 150 /** |
| 151 * Create empty location. |
| 152 */ |
| 153 Location(); |
| 154 |
| 155 int GetLineNumber() const; |
| 156 int GetColumnNumber() const; |
| 157 bool IsEmpty() const; |
| 158 |
| 159 private: |
| 160 int lineNumber_; |
| 161 int columnNumber_; |
| 162 }; |
| 163 |
| 164 /** |
144 * Native wrapper around v8::internal::Script object. | 165 * Native wrapper around v8::internal::Script object. |
145 */ | 166 */ |
146 class Script { | 167 class Script { |
147 public: | 168 public: |
148 v8::Isolate* GetIsolate() const; | 169 v8::Isolate* GetIsolate() const; |
149 | 170 |
150 ScriptOriginOptions OriginOptions() const; | 171 ScriptOriginOptions OriginOptions() const; |
151 bool WasCompiled() const; | 172 bool WasCompiled() const; |
152 int Id() const; | 173 int Id() const; |
153 int LineOffset() const; | 174 int LineOffset() const; |
154 int ColumnOffset() const; | 175 int ColumnOffset() const; |
155 std::vector<int> LineEnds() const; | 176 std::vector<int> LineEnds() const; |
156 MaybeLocal<String> Name() const; | 177 MaybeLocal<String> Name() const; |
157 MaybeLocal<String> SourceURL() const; | 178 MaybeLocal<String> SourceURL() const; |
158 MaybeLocal<String> SourceMappingURL() const; | 179 MaybeLocal<String> SourceMappingURL() const; |
159 MaybeLocal<String> ContextData() const; | 180 MaybeLocal<String> ContextData() const; |
160 MaybeLocal<String> Source() const; | 181 MaybeLocal<String> Source() const; |
| 182 bool GetPossibleBreakpoints(const Location& start, const Location& end, |
| 183 std::vector<Location>* locations) const; |
161 | 184 |
162 /** | 185 /** |
163 * script parameter is a wrapper v8::internal::JSObject for | 186 * script parameter is a wrapper v8::internal::JSObject for |
164 * v8::internal::Script. | 187 * v8::internal::Script. |
165 * This function gets v8::internal::Script from v8::internal::JSObject and | 188 * This function gets v8::internal::Script from v8::internal::JSObject and |
166 * wraps it with DebugInterface::Script. | 189 * wraps it with DebugInterface::Script. |
167 * Returns empty local if not called with a valid wrapper of | 190 * Returns empty local if not called with a valid wrapper of |
168 * v8::internal::Script. | 191 * v8::internal::Script. |
169 */ | 192 */ |
170 static MaybeLocal<Script> Wrap(Isolate* isolate, | 193 static MaybeLocal<Script> Wrap(Isolate* isolate, |
171 v8::Local<v8::Object> script); | 194 v8::Local<v8::Object> script); |
| 195 |
| 196 private: |
| 197 int GetSourcePosition(const Location& location) const; |
172 }; | 198 }; |
173 | 199 |
174 /** | 200 /** |
175 * Return array of compiled scripts. | 201 * Return array of compiled scripts. |
176 */ | 202 */ |
177 static void GetLoadedScripts(Isolate* isolate, | 203 static void GetLoadedScripts(Isolate* isolate, |
178 PersistentValueVector<Script>& scripts); | 204 PersistentValueVector<Script>& scripts); |
179 }; | 205 }; |
180 | 206 |
181 } // namespace v8 | 207 } // namespace v8 |
182 | 208 |
183 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ | 209 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ |
OLD | NEW |