| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 */ | 109 */ |
| 110 virtual Local<Context> GetEventContext() const = 0; | 110 virtual Local<Context> GetEventContext() const = 0; |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Client data passed with the corresponding callback when it was | 113 * Client data passed with the corresponding callback when it was |
| 114 * registered. | 114 * registered. |
| 115 */ | 115 */ |
| 116 virtual Local<Value> GetCallbackData() const = 0; | 116 virtual Local<Value> GetCallbackData() const = 0; |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * Client data passed to DebugBreakForCommand function. The | 119 * This is now a dummy that returns nullptr. |
| 120 * debugger takes ownership of the data and will delete it even if | |
| 121 * there is no message handler. | |
| 122 */ | 120 */ |
| 123 virtual ClientData* GetClientData() const = 0; | 121 virtual ClientData* GetClientData() const = 0; |
| 124 | 122 |
| 125 virtual Isolate* GetIsolate() const = 0; | 123 virtual Isolate* GetIsolate() const = 0; |
| 126 | 124 |
| 127 virtual ~EventDetails() {} | 125 virtual ~EventDetails() {} |
| 128 }; | 126 }; |
| 129 | 127 |
| 130 /** | 128 /** |
| 131 * Debug event callback function. | 129 * Debug event callback function. |
| 132 * | 130 * |
| 133 * \param event_details object providing information about the debug event | 131 * \param event_details object providing information about the debug event |
| 134 * | 132 * |
| 135 * A EventCallback2 does not take possession of the event data, | 133 * A EventCallback does not take possession of the event data, |
| 136 * and must not rely on the data persisting after the handler returns. | 134 * and must not rely on the data persisting after the handler returns. |
| 137 */ | 135 */ |
| 138 typedef void (*EventCallback)(const EventDetails& event_details); | 136 typedef void (*EventCallback)(const EventDetails& event_details); |
| 139 | 137 |
| 140 /** | 138 /** |
| 141 * Debug message callback function. | 139 * This is now a no-op. |
| 142 * | |
| 143 * \param message the debug message handler message object | |
| 144 * | |
| 145 * A MessageHandler does not take possession of the message data, | |
| 146 * and must not rely on the data persisting after the handler returns. | |
| 147 */ | 140 */ |
| 148 typedef void (*MessageHandler)(const Message& message); | 141 typedef void (*MessageHandler)(const Message& message); |
| 149 | 142 |
| 150 /** | 143 /** |
| 151 * Callback function for the host to ensure debug messages are processed. | 144 * This is now a no-op. |
| 152 */ | 145 */ |
| 153 typedef void (*DebugMessageDispatchHandler)(); | 146 typedef void (*DebugMessageDispatchHandler)(); |
| 154 | 147 |
| 155 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, | 148 static bool SetDebugEventListener(Isolate* isolate, EventCallback that, |
| 156 Local<Value> data = Local<Value>()); | 149 Local<Value> data = Local<Value>()); |
| 157 | 150 |
| 158 // Schedule a debugger break to happen when JavaScript code is run | 151 // Schedule a debugger break to happen when JavaScript code is run |
| 159 // in the given isolate. | 152 // in the given isolate. |
| 160 static void DebugBreak(Isolate* isolate); | 153 static void DebugBreak(Isolate* isolate); |
| 161 | 154 |
| 162 // Remove scheduled debugger break in given isolate if it has not | 155 // Remove scheduled debugger break in given isolate if it has not |
| 163 // happened yet. | 156 // happened yet. |
| 164 static void CancelDebugBreak(Isolate* isolate); | 157 static void CancelDebugBreak(Isolate* isolate); |
| 165 | 158 |
| 166 // Check if a debugger break is scheduled in the given isolate. | 159 // Check if a debugger break is scheduled in the given isolate. |
| 167 V8_DEPRECATED("No longer supported", | 160 V8_DEPRECATED("No longer supported", |
| 168 static bool CheckDebugBreak(Isolate* isolate)); | 161 static bool CheckDebugBreak(Isolate* isolate)); |
| 169 | 162 |
| 170 // Message based interface. The message protocol is JSON. | 163 // This is now a no-op. |
| 171 V8_DEPRECATED("No longer supported", | 164 V8_DEPRECATED("No longer supported", |
| 172 static void SetMessageHandler(Isolate* isolate, | 165 static void SetMessageHandler(Isolate* isolate, |
| 173 MessageHandler handler)); | 166 MessageHandler handler)); |
| 174 | 167 |
| 168 // This is now a no-op. |
| 175 V8_DEPRECATED("No longer supported", | 169 V8_DEPRECATED("No longer supported", |
| 176 static void SendCommand(Isolate* isolate, | 170 static void SendCommand(Isolate* isolate, |
| 177 const uint16_t* command, int length, | 171 const uint16_t* command, int length, |
| 178 ClientData* client_data = NULL)); | 172 ClientData* client_data = NULL)); |
| 179 | 173 |
| 180 /** | 174 /** |
| 181 * Run a JavaScript function in the debugger. | 175 * Run a JavaScript function in the debugger. |
| 182 * \param fun the function to call | 176 * \param fun the function to call |
| 183 * \param data passed as second argument to the function | 177 * \param data passed as second argument to the function |
| 184 * With this call the debugger is entered and the function specified is called | 178 * With this call the debugger is entered and the function specified is called |
| (...skipping 15 matching lines...) Expand all Loading... |
| 200 v8::Local<v8::Function> fun, | 194 v8::Local<v8::Function> fun, |
| 201 Local<Value> data = Local<Value>()); | 195 Local<Value> data = Local<Value>()); |
| 202 | 196 |
| 203 /** | 197 /** |
| 204 * Returns a mirror object for the given object. | 198 * Returns a mirror object for the given object. |
| 205 */ | 199 */ |
| 206 V8_DEPRECATED("No longer supported", | 200 V8_DEPRECATED("No longer supported", |
| 207 static MaybeLocal<Value> GetMirror(Local<Context> context, | 201 static MaybeLocal<Value> GetMirror(Local<Context> context, |
| 208 v8::Local<v8::Value> obj)); | 202 v8::Local<v8::Value> obj)); |
| 209 | 203 |
| 210 /** | 204 // This is now a no-op. |
| 211 * Makes V8 process all pending debug messages. | |
| 212 * | |
| 213 * From V8 point of view all debug messages come asynchronously (e.g. from | |
| 214 * remote debugger) but they all must be handled synchronously: V8 cannot | |
| 215 * do 2 things at one time so normal script execution must be interrupted | |
| 216 * for a while. | |
| 217 * | |
| 218 * Generally when message arrives V8 may be in one of 3 states: | |
| 219 * 1. V8 is running script; V8 will automatically interrupt and process all | |
| 220 * pending messages; | |
| 221 * 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated | |
| 222 * to reading and processing debug messages; | |
| 223 * 3. V8 is not running at all or has called some long-working C++ function; | |
| 224 * by default it means that processing of all debug messages will be deferred | |
| 225 * until V8 gets control again; however, embedding application may improve | |
| 226 * this by manually calling this method. | |
| 227 * | |
| 228 * Technically this method in many senses is equivalent to executing empty | |
| 229 * script: | |
| 230 * 1. It does nothing except for processing all pending debug messages. | |
| 231 * 2. It should be invoked with the same precautions and from the same context | |
| 232 * as V8 script would be invoked from, because: | |
| 233 * a. with "evaluate" command it can do whatever normal script can do, | |
| 234 * including all native calls; | |
| 235 * b. no other thread should call V8 while this method is running | |
| 236 * (v8::Locker may be used here). | |
| 237 * | |
| 238 * "Evaluate" debug command behavior currently is not specified in scope | |
| 239 * of this method. | |
| 240 */ | |
| 241 V8_DEPRECATED("No longer supported", | 205 V8_DEPRECATED("No longer supported", |
| 242 static void ProcessDebugMessages(Isolate* isolate)); | 206 static void ProcessDebugMessages(Isolate* isolate)); |
| 243 | 207 |
| 244 /** | 208 /** |
| 245 * Debugger is running in its own context which is entered while debugger | 209 * Debugger is running in its own context which is entered while debugger |
| 246 * messages are being dispatched. This is an explicit getter for this | 210 * messages are being dispatched. This is an explicit getter for this |
| 247 * debugger context. Note that the content of the debugger context is subject | 211 * debugger context. Note that the content of the debugger context is subject |
| 248 * to change. The Context exists only when the debugger is active, i.e. at | 212 * to change. The Context exists only when the debugger is active, i.e. at |
| 249 * least one DebugEventListener or MessageHandler is set. | 213 * least one DebugEventListener or MessageHandler is set. |
| 250 */ | 214 */ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 }; | 248 }; |
| 285 | 249 |
| 286 | 250 |
| 287 } // namespace v8 | 251 } // namespace v8 |
| 288 | 252 |
| 289 | 253 |
| 290 #undef EXPORT | 254 #undef EXPORT |
| 291 | 255 |
| 292 | 256 |
| 293 #endif // V8_V8_DEBUG_H_ | 257 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |