OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 /** | 256 /** |
257 * Enable the V8 builtin debug agent. The debugger agent will listen on the | 257 * Enable the V8 builtin debug agent. The debugger agent will listen on the |
258 * supplied TCP/IP port for remote debugger connection. | 258 * supplied TCP/IP port for remote debugger connection. |
259 * \param name the name of the embedding application | 259 * \param name the name of the embedding application |
260 * \param port the TCP/IP port to listen on | 260 * \param port the TCP/IP port to listen on |
261 * \param wait_for_connection whether V8 should pause on a first statement | 261 * \param wait_for_connection whether V8 should pause on a first statement |
262 * allowing remote debugger to connect before anything interesting happened | 262 * allowing remote debugger to connect before anything interesting happened |
263 */ | 263 */ |
264 static bool EnableAgent(const char* name, int port, | 264 static bool EnableAgent(const char* name, int port, |
265 bool wait_for_connection = false); | 265 bool wait_for_connection = false); |
| 266 |
| 267 /** |
| 268 * Makes V8 process all pending debug messages. |
| 269 * |
| 270 * From V8 point of view all debug messages come asynchronously (e.g. from |
| 271 * remote debugger) but they all must be handled synchronously: V8 cannot |
| 272 * do 2 things at one time so normal script execution must be interrupted |
| 273 * for a while. |
| 274 * |
| 275 * Generally when message arrives V8 may be in one of 3 states: |
| 276 * 1. V8 is running script; V8 will automatically interrupt and process all |
| 277 * pending messages (however auto_break flag should be enabled); |
| 278 * 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated |
| 279 * to reading and processing debug messages; |
| 280 * 3. V8 is not running at all or has called some long-working C++ function; |
| 281 * by default it means that processing of all debug message will be deferred |
| 282 * until V8 gets control again; however, embedding application may improve |
| 283 * this by manually calling this method. |
| 284 * |
| 285 * It makes sense to call this method whenever a new debug message arrived and |
| 286 * V8 is not already running. Method v8::Debug::SetDebugMessageDispatchHandler |
| 287 * should help with the former condition. |
| 288 * |
| 289 * Technically this method in many senses is equivalent to executing empty |
| 290 * script: |
| 291 * 1. It does nothing except for processing all pending debug messages. |
| 292 * 2. It should be invoked with the same precautions and from the same context |
| 293 * as V8 script would be invoked from, because: |
| 294 * a. with "evaluate" command it can do whatever normal script can do, |
| 295 * including all native calls; |
| 296 * b. no other thread should call V8 while this method is running |
| 297 * (v8::Locker may be used here). |
| 298 * |
| 299 * "Evaluate" debug command behavior currently is not specified in scope |
| 300 * of this method. |
| 301 */ |
| 302 static void ProcessDebugMessages(); |
266 }; | 303 }; |
267 | 304 |
268 | 305 |
269 } // namespace v8 | 306 } // namespace v8 |
270 | 307 |
271 | 308 |
272 #undef EXPORT | 309 #undef EXPORT |
273 | 310 |
274 | 311 |
275 #endif // V8_V8_DEBUG_H_ | 312 #endif // V8_V8_DEBUG_H_ |
OLD | NEW |