| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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_V8_DEBUG_H_ | 5 #ifndef V8_V8_DEBUG_H_ |
| 6 #define V8_V8_DEBUG_H_ | 6 #define V8_V8_DEBUG_H_ |
| 7 | 7 |
| 8 #include "v8.h" // NOLINT(build/include) | 8 #include "v8.h" // NOLINT(build/include) |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 */ | 150 */ |
| 151 typedef void (*MessageHandler)(const Message& message); | 151 typedef void (*MessageHandler)(const Message& message); |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * Callback function for the host to ensure debug messages are processed. | 154 * Callback function for the host to ensure debug messages are processed. |
| 155 */ | 155 */ |
| 156 typedef void (*DebugMessageDispatchHandler)(); | 156 typedef void (*DebugMessageDispatchHandler)(); |
| 157 | 157 |
| 158 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, | 158 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, |
| 159 Local<Value> data = Local<Value>()); | 159 Local<Value> data = Local<Value>()); |
| 160 V8_DEPRECATED("Use version with an Isolate", | |
| 161 static bool SetDebugEventListener( | |
| 162 EventCallback that, Local<Value> data = Local<Value>())); | |
| 163 | 160 |
| 164 // Schedule a debugger break to happen when JavaScript code is run | 161 // Schedule a debugger break to happen when JavaScript code is run |
| 165 // in the given isolate. | 162 // in the given isolate. |
| 166 static void DebugBreak(Isolate* isolate); | 163 static void DebugBreak(Isolate* isolate); |
| 167 | 164 |
| 168 // Remove scheduled debugger break in given isolate if it has not | 165 // Remove scheduled debugger break in given isolate if it has not |
| 169 // happened yet. | 166 // happened yet. |
| 170 static void CancelDebugBreak(Isolate* isolate); | 167 static void CancelDebugBreak(Isolate* isolate); |
| 171 | 168 |
| 172 // Check if a debugger break is scheduled in the given isolate. | 169 // Check if a debugger break is scheduled in the given isolate. |
| 173 static bool CheckDebugBreak(Isolate* isolate); | 170 static bool CheckDebugBreak(Isolate* isolate); |
| 174 | 171 |
| 175 // Message based interface. The message protocol is JSON. | 172 // Message based interface. The message protocol is JSON. |
| 176 static void SetMessageHandler(Isolate* isolate, MessageHandler handler); | 173 static void SetMessageHandler(Isolate* isolate, MessageHandler handler); |
| 177 V8_DEPRECATED("Use version with an Isolate", | |
| 178 static void SetMessageHandler(MessageHandler handler)); | |
| 179 | 174 |
| 180 static void SendCommand(Isolate* isolate, | 175 static void SendCommand(Isolate* isolate, |
| 181 const uint16_t* command, int length, | 176 const uint16_t* command, int length, |
| 182 ClientData* client_data = NULL); | 177 ClientData* client_data = NULL); |
| 183 | 178 |
| 184 /** | 179 /** |
| 185 * Run a JavaScript function in the debugger. | 180 * Run a JavaScript function in the debugger. |
| 186 * \param fun the function to call | 181 * \param fun the function to call |
| 187 * \param data passed as second argument to the function | 182 * \param data passed as second argument to the function |
| 188 * With this call the debugger is entered and the function specified is called | 183 * With this call the debugger is entered and the function specified is called |
| 189 * with the execution state as the first argument. This makes it possible to | 184 * with the execution state as the first argument. This makes it possible to |
| 190 * get access to information otherwise not available during normal JavaScript | 185 * get access to information otherwise not available during normal JavaScript |
| 191 * execution e.g. details on stack frames. Receiver of the function call will | 186 * execution e.g. details on stack frames. Receiver of the function call will |
| 192 * be the debugger context global object, however this is a subject to change. | 187 * be the debugger context global object, however this is a subject to change. |
| 193 * The following example shows a JavaScript function which when passed to | 188 * The following example shows a JavaScript function which when passed to |
| 194 * v8::Debug::Call will return the current line of JavaScript execution. | 189 * v8::Debug::Call will return the current line of JavaScript execution. |
| 195 * | 190 * |
| 196 * \code | 191 * \code |
| 197 * function frame_source_line(exec_state) { | 192 * function frame_source_line(exec_state) { |
| 198 * return exec_state.frame(0).sourceLine(); | 193 * return exec_state.frame(0).sourceLine(); |
| 199 * } | 194 * } |
| 200 * \endcode | 195 * \endcode |
| 201 */ | 196 */ |
| 202 static V8_DEPRECATED("Use maybe version", | |
| 203 Local<Value> Call(v8::Local<v8::Function> fun, | |
| 204 Local<Value> data = Local<Value>())); | |
| 205 // TODO(dcarney): data arg should be a MaybeLocal | 197 // TODO(dcarney): data arg should be a MaybeLocal |
| 206 static MaybeLocal<Value> Call(Local<Context> context, | 198 static MaybeLocal<Value> Call(Local<Context> context, |
| 207 v8::Local<v8::Function> fun, | 199 v8::Local<v8::Function> fun, |
| 208 Local<Value> data = Local<Value>()); | 200 Local<Value> data = Local<Value>()); |
| 209 | 201 |
| 210 /** | 202 /** |
| 211 * Returns a mirror object for the given object. | 203 * Returns a mirror object for the given object. |
| 212 */ | 204 */ |
| 213 static V8_DEPRECATED("Use maybe version", | |
| 214 Local<Value> GetMirror(v8::Local<v8::Value> obj)); | |
| 215 static MaybeLocal<Value> GetMirror(Local<Context> context, | 205 static MaybeLocal<Value> GetMirror(Local<Context> context, |
| 216 v8::Local<v8::Value> obj); | 206 v8::Local<v8::Value> obj); |
| 217 | 207 |
| 218 /** | 208 /** |
| 219 * Makes V8 process all pending debug messages. | 209 * Makes V8 process all pending debug messages. |
| 220 * | 210 * |
| 221 * From V8 point of view all debug messages come asynchronously (e.g. from | 211 * From V8 point of view all debug messages come asynchronously (e.g. from |
| 222 * remote debugger) but they all must be handled synchronously: V8 cannot | 212 * remote debugger) but they all must be handled synchronously: V8 cannot |
| 223 * do 2 things at one time so normal script execution must be interrupted | 213 * do 2 things at one time so normal script execution must be interrupted |
| 224 * for a while. | 214 * for a while. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 240 * as V8 script would be invoked from, because: | 230 * as V8 script would be invoked from, because: |
| 241 * a. with "evaluate" command it can do whatever normal script can do, | 231 * a. with "evaluate" command it can do whatever normal script can do, |
| 242 * including all native calls; | 232 * including all native calls; |
| 243 * b. no other thread should call V8 while this method is running | 233 * b. no other thread should call V8 while this method is running |
| 244 * (v8::Locker may be used here). | 234 * (v8::Locker may be used here). |
| 245 * | 235 * |
| 246 * "Evaluate" debug command behavior currently is not specified in scope | 236 * "Evaluate" debug command behavior currently is not specified in scope |
| 247 * of this method. | 237 * of this method. |
| 248 */ | 238 */ |
| 249 static void ProcessDebugMessages(Isolate* isolate); | 239 static void ProcessDebugMessages(Isolate* isolate); |
| 250 V8_DEPRECATED("Use version with an Isolate", | |
| 251 static void ProcessDebugMessages()); | |
| 252 | 240 |
| 253 /** | 241 /** |
| 254 * Debugger is running in its own context which is entered while debugger | 242 * Debugger is running in its own context which is entered while debugger |
| 255 * messages are being dispatched. This is an explicit getter for this | 243 * messages are being dispatched. This is an explicit getter for this |
| 256 * debugger context. Note that the content of the debugger context is subject | 244 * debugger context. Note that the content of the debugger context is subject |
| 257 * to change. The Context exists only when the debugger is active, i.e. at | 245 * to change. The Context exists only when the debugger is active, i.e. at |
| 258 * least one DebugEventListener or MessageHandler is set. | 246 * least one DebugEventListener or MessageHandler is set. |
| 259 */ | 247 */ |
| 260 static Local<Context> GetDebugContext(Isolate* isolate); | 248 static Local<Context> GetDebugContext(Isolate* isolate); |
| 261 V8_DEPRECATED("Use version with an Isolate", | |
| 262 static Local<Context> GetDebugContext()); | |
| 263 | 249 |
| 264 /** | 250 /** |
| 265 * While in the debug context, this method returns the top-most non-debug | 251 * While in the debug context, this method returns the top-most non-debug |
| 266 * context, if it exists. | 252 * context, if it exists. |
| 267 */ | 253 */ |
| 268 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate); | 254 static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate); |
| 269 | 255 |
| 270 /** | 256 /** |
| 271 * Enable/disable LiveEdit functionality for the given Isolate | 257 * Enable/disable LiveEdit functionality for the given Isolate |
| 272 * (default Isolate if not provided). V8 will abort if LiveEdit is | 258 * (default Isolate if not provided). V8 will abort if LiveEdit is |
| (...skipping 19 matching lines...) Expand all Loading... |
| 292 }; | 278 }; |
| 293 | 279 |
| 294 | 280 |
| 295 } // namespace v8 | 281 } // namespace v8 |
| 296 | 282 |
| 297 | 283 |
| 298 #undef EXPORT | 284 #undef EXPORT |
| 299 | 285 |
| 300 | 286 |
| 301 #endif // V8_V8_DEBUG_H_ | 287 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |