| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 virtual Handle<Object> GetEventData() const = 0; | 120 virtual Handle<Object> GetEventData() const = 0; |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * Get the debugger protocol JSON. | 123 * Get the debugger protocol JSON. |
| 124 */ | 124 */ |
| 125 virtual Handle<String> GetJSON() const = 0; | 125 virtual Handle<String> GetJSON() const = 0; |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * Get the context active when the debug event happened. Note this is not | 128 * Get the context active when the debug event happened. Note this is not |
| 129 * the current active context as the JavaScript part of the debugger is | 129 * the current active context as the JavaScript part of the debugger is |
| 130 * running in it's own context which is entered at this point. | 130 * running in its own context which is entered at this point. |
| 131 */ | 131 */ |
| 132 virtual Handle<Context> GetEventContext() const = 0; | 132 virtual Handle<Context> GetEventContext() const = 0; |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Client data passed with the corresponding request if any. This is the | 135 * Client data passed with the corresponding request if any. This is the |
| 136 * client_data data value passed into Debug::SendCommand along with the | 136 * client_data data value passed into Debug::SendCommand along with the |
| 137 * request that led to the message or NULL if the message is an event. The | 137 * request that led to the message or NULL if the message is an event. The |
| 138 * debugger takes ownership of the data and will delete it even if there is | 138 * debugger takes ownership of the data and will delete it even if there is |
| 139 * no message handler. | 139 * no message handler. |
| 140 */ | 140 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 157 /** | 157 /** |
| 158 * Access to execution state and event data of the debug event. Don't store | 158 * Access to execution state and event data of the debug event. Don't store |
| 159 * these cross callbacks as their content becomes invalid. | 159 * these cross callbacks as their content becomes invalid. |
| 160 */ | 160 */ |
| 161 virtual Handle<Object> GetExecutionState() const = 0; | 161 virtual Handle<Object> GetExecutionState() const = 0; |
| 162 virtual Handle<Object> GetEventData() const = 0; | 162 virtual Handle<Object> GetEventData() const = 0; |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * Get the context active when the debug event happened. Note this is not | 165 * Get the context active when the debug event happened. Note this is not |
| 166 * the current active context as the JavaScript part of the debugger is | 166 * the current active context as the JavaScript part of the debugger is |
| 167 * running in it's own context which is entered at this point. | 167 * running in its own context which is entered at this point. |
| 168 */ | 168 */ |
| 169 virtual Handle<Context> GetEventContext() const = 0; | 169 virtual Handle<Context> GetEventContext() const = 0; |
| 170 | 170 |
| 171 /** | 171 /** |
| 172 * Client data passed with the corresponding callbak whet it was registered. | 172 * Client data passed with the corresponding callback when it was |
| 173 * registered. |
| 173 */ | 174 */ |
| 174 virtual Handle<Value> GetCallbackData() const = 0; | 175 virtual Handle<Value> GetCallbackData() const = 0; |
| 175 | 176 |
| 176 /** | 177 /** |
| 177 * Client data passed to DebugBreakForCommand function. The | 178 * Client data passed to DebugBreakForCommand function. The |
| 178 * debugger takes ownership of the data and will delete it even if | 179 * debugger takes ownership of the data and will delete it even if |
| 179 * there is no message handler. | 180 * there is no message handler. |
| 180 */ | 181 */ |
| 181 virtual ClientData* GetClientData() const = 0; | 182 virtual ClientData* GetClientData() const = 0; |
| 182 | 183 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 304 |
| 304 /** | 305 /** |
| 305 * Run a JavaScript function in the debugger. | 306 * Run a JavaScript function in the debugger. |
| 306 * \param fun the function to call | 307 * \param fun the function to call |
| 307 * \param data passed as second argument to the function | 308 * \param data passed as second argument to the function |
| 308 * With this call the debugger is entered and the function specified is called | 309 * With this call the debugger is entered and the function specified is called |
| 309 * with the execution state as the first argument. This makes it possible to | 310 * with the execution state as the first argument. This makes it possible to |
| 310 * get access to information otherwise not available during normal JavaScript | 311 * get access to information otherwise not available during normal JavaScript |
| 311 * execution e.g. details on stack frames. Receiver of the function call will | 312 * execution e.g. details on stack frames. Receiver of the function call will |
| 312 * be the debugger context global object, however this is a subject to change. | 313 * be the debugger context global object, however this is a subject to change. |
| 313 * The following example show a JavaScript function which when passed to | 314 * The following example shows a JavaScript function which when passed to |
| 314 * v8::Debug::Call will return the current line of JavaScript execution. | 315 * v8::Debug::Call will return the current line of JavaScript execution. |
| 315 * | 316 * |
| 316 * \code | 317 * \code |
| 317 * function frame_source_line(exec_state) { | 318 * function frame_source_line(exec_state) { |
| 318 * return exec_state.frame(0).sourceLine(); | 319 * return exec_state.frame(0).sourceLine(); |
| 319 * } | 320 * } |
| 320 * \endcode | 321 * \endcode |
| 321 */ | 322 */ |
| 322 static Local<Value> Call(v8::Handle<v8::Function> fun, | 323 static Local<Value> Call(v8::Handle<v8::Function> fun, |
| 323 Handle<Value> data = Handle<Value>()); | 324 Handle<Value> data = Handle<Value>()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 345 * remote debugger) but they all must be handled synchronously: V8 cannot | 346 * remote debugger) but they all must be handled synchronously: V8 cannot |
| 346 * do 2 things at one time so normal script execution must be interrupted | 347 * do 2 things at one time so normal script execution must be interrupted |
| 347 * for a while. | 348 * for a while. |
| 348 * | 349 * |
| 349 * Generally when message arrives V8 may be in one of 3 states: | 350 * Generally when message arrives V8 may be in one of 3 states: |
| 350 * 1. V8 is running script; V8 will automatically interrupt and process all | 351 * 1. V8 is running script; V8 will automatically interrupt and process all |
| 351 * pending messages (however auto_break flag should be enabled); | 352 * pending messages (however auto_break flag should be enabled); |
| 352 * 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated | 353 * 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated |
| 353 * to reading and processing debug messages; | 354 * to reading and processing debug messages; |
| 354 * 3. V8 is not running at all or has called some long-working C++ function; | 355 * 3. V8 is not running at all or has called some long-working C++ function; |
| 355 * by default it means that processing of all debug message will be deferred | 356 * by default it means that processing of all debug messages will be deferred |
| 356 * until V8 gets control again; however, embedding application may improve | 357 * until V8 gets control again; however, embedding application may improve |
| 357 * this by manually calling this method. | 358 * this by manually calling this method. |
| 358 * | 359 * |
| 359 * It makes sense to call this method whenever a new debug message arrived and | 360 * It makes sense to call this method whenever a new debug message arrived and |
| 360 * V8 is not already running. Method v8::Debug::SetDebugMessageDispatchHandler | 361 * V8 is not already running. Method v8::Debug::SetDebugMessageDispatchHandler |
| 361 * should help with the former condition. | 362 * should help with the former condition. |
| 362 * | 363 * |
| 363 * Technically this method in many senses is equivalent to executing empty | 364 * Technically this method in many senses is equivalent to executing empty |
| 364 * script: | 365 * script: |
| 365 * 1. It does nothing except for processing all pending debug messages. | 366 * 1. It does nothing except for processing all pending debug messages. |
| 366 * 2. It should be invoked with the same precautions and from the same context | 367 * 2. It should be invoked with the same precautions and from the same context |
| 367 * as V8 script would be invoked from, because: | 368 * as V8 script would be invoked from, because: |
| 368 * a. with "evaluate" command it can do whatever normal script can do, | 369 * a. with "evaluate" command it can do whatever normal script can do, |
| 369 * including all native calls; | 370 * including all native calls; |
| 370 * b. no other thread should call V8 while this method is running | 371 * b. no other thread should call V8 while this method is running |
| 371 * (v8::Locker may be used here). | 372 * (v8::Locker may be used here). |
| 372 * | 373 * |
| 373 * "Evaluate" debug command behavior currently is not specified in scope | 374 * "Evaluate" debug command behavior currently is not specified in scope |
| 374 * of this method. | 375 * of this method. |
| 375 */ | 376 */ |
| 376 static void ProcessDebugMessages(); | 377 static void ProcessDebugMessages(); |
| 377 | 378 |
| 378 /** | 379 /** |
| 379 * Debugger is running in it's own context which is entered while debugger | 380 * Debugger is running in its own context which is entered while debugger |
| 380 * messages are being dispatched. This is an explicit getter for this | 381 * messages are being dispatched. This is an explicit getter for this |
| 381 * debugger context. Note that the content of the debugger context is subject | 382 * debugger context. Note that the content of the debugger context is subject |
| 382 * to change. | 383 * to change. |
| 383 */ | 384 */ |
| 384 static Local<Context> GetDebugContext(); | 385 static Local<Context> GetDebugContext(); |
| 385 }; | 386 }; |
| 386 | 387 |
| 387 | 388 |
| 388 } // namespace v8 | 389 } // namespace v8 |
| 389 | 390 |
| 390 | 391 |
| 391 #undef EXPORT | 392 #undef EXPORT |
| 392 | 393 |
| 393 | 394 |
| 394 #endif // V8_V8_DEBUG_H_ | 395 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |