| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 */ | 69 */ |
| 70 namespace v8 { | 70 namespace v8 { |
| 71 | 71 |
| 72 // Debug events which can occur in the V8 JavaScript engine. | 72 // Debug events which can occur in the V8 JavaScript engine. |
| 73 enum DebugEvent { | 73 enum DebugEvent { |
| 74 Break = 1, | 74 Break = 1, |
| 75 Exception = 2, | 75 Exception = 2, |
| 76 NewFunction = 3, | 76 NewFunction = 3, |
| 77 BeforeCompile = 4, | 77 BeforeCompile = 4, |
| 78 AfterCompile = 5, | 78 AfterCompile = 5, |
| 79 ScriptCollected = 6 | 79 ScriptCollected = 6, |
| 80 BreakForCommand = 7 |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 | 83 |
| 83 class EXPORT Debug { | 84 class EXPORT Debug { |
| 84 public: | 85 public: |
| 85 /** | 86 /** |
| 86 * A client object passed to the v8 debugger whose ownership will be taken by | 87 * A client object passed to the v8 debugger whose ownership will be taken by |
| 87 * it. v8 is always responsible for deleting the object. | 88 * it. v8 is always responsible for deleting the object. |
| 88 */ | 89 */ |
| 89 class ClientData { | 90 class ClientData { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 * 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 |
| 166 * running in it's own context which is entered at this point. | 167 * running in it's own context which is entered at this point. |
| 167 */ | 168 */ |
| 168 virtual Handle<Context> GetEventContext() const = 0; | 169 virtual Handle<Context> GetEventContext() const = 0; |
| 169 | 170 |
| 170 /** | 171 /** |
| 171 * Client data passed with the corresponding callbak whet it was registered. | 172 * Client data passed with the corresponding callbak whet it was registered. |
| 172 */ | 173 */ |
| 173 virtual Handle<Value> GetCallbackData() const = 0; | 174 virtual Handle<Value> GetCallbackData() const = 0; |
| 174 | 175 |
| 176 /** |
| 177 * Client data passed to DebugBreakForCommand function. The |
| 178 * debugger takes ownership of the data and will delete it even if |
| 179 * there is no message handler. |
| 180 */ |
| 181 virtual ClientData* GetClientData() const = 0; |
| 182 |
| 175 virtual ~EventDetails() {} | 183 virtual ~EventDetails() {} |
| 176 }; | 184 }; |
| 177 | 185 |
| 178 | 186 |
| 179 /** | 187 /** |
| 180 * Debug event callback function. | 188 * Debug event callback function. |
| 181 * | 189 * |
| 182 * \param event the type of the debug event that triggered the callback | 190 * \param event the type of the debug event that triggered the callback |
| 183 * (enum DebugEvent) | 191 * (enum DebugEvent) |
| 184 * \param exec_state execution state (JavaScript object) | 192 * \param exec_state execution state (JavaScript object) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 static bool SetDebugEventListener2(EventCallback2 that, | 249 static bool SetDebugEventListener2(EventCallback2 that, |
| 242 Handle<Value> data = Handle<Value>()); | 250 Handle<Value> data = Handle<Value>()); |
| 243 | 251 |
| 244 // Set a JavaScript debug event listener. | 252 // Set a JavaScript debug event listener. |
| 245 static bool SetDebugEventListener(v8::Handle<v8::Object> that, | 253 static bool SetDebugEventListener(v8::Handle<v8::Object> that, |
| 246 Handle<Value> data = Handle<Value>()); | 254 Handle<Value> data = Handle<Value>()); |
| 247 | 255 |
| 248 // Break execution of JavaScript. | 256 // Break execution of JavaScript. |
| 249 static void DebugBreak(); | 257 static void DebugBreak(); |
| 250 | 258 |
| 259 // Break execution of JavaScript (this method can be invoked from a |
| 260 // non-VM thread) for further client command execution on a VM |
| 261 // thread. Client data is then passed in EventDetails to |
| 262 // EventCallback at the moment when the VM actually stops. |
| 263 static void DebugBreakForCommand(ClientData* data = NULL); |
| 264 |
| 251 // Message based interface. The message protocol is JSON. NOTE the message | 265 // Message based interface. The message protocol is JSON. NOTE the message |
| 252 // handler thread is not supported any more parameter must be false. | 266 // handler thread is not supported any more parameter must be false. |
| 253 static void SetMessageHandler(MessageHandler handler, | 267 static void SetMessageHandler(MessageHandler handler, |
| 254 bool message_handler_thread = false); | 268 bool message_handler_thread = false); |
| 255 static void SetMessageHandler2(MessageHandler2 handler); | 269 static void SetMessageHandler2(MessageHandler2 handler); |
| 256 static void SendCommand(const uint16_t* command, int length, | 270 static void SendCommand(const uint16_t* command, int length, |
| 257 ClientData* client_data = NULL); | 271 ClientData* client_data = NULL); |
| 258 | 272 |
| 259 // Dispatch interface. | 273 // Dispatch interface. |
| 260 static void SetHostDispatchHandler(HostDispatchHandler handler, | 274 static void SetHostDispatchHandler(HostDispatchHandler handler, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 }; | 372 }; |
| 359 | 373 |
| 360 | 374 |
| 361 } // namespace v8 | 375 } // namespace v8 |
| 362 | 376 |
| 363 | 377 |
| 364 #undef EXPORT | 378 #undef EXPORT |
| 365 | 379 |
| 366 | 380 |
| 367 #endif // V8_V8_DEBUG_H_ | 381 #endif // V8_V8_DEBUG_H_ |
| OLD | NEW |