Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: src/debug.h

Issue 20491: Add host callback for debug break.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | src/debug.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 static void OnDebugBreak(Handle<Object> break_points_hit); 374 static void OnDebugBreak(Handle<Object> break_points_hit);
375 static void OnException(Handle<Object> exception, bool uncaught); 375 static void OnException(Handle<Object> exception, bool uncaught);
376 static void OnBeforeCompile(Handle<Script> script); 376 static void OnBeforeCompile(Handle<Script> script);
377 static void OnAfterCompile(Handle<Script> script, 377 static void OnAfterCompile(Handle<Script> script,
378 Handle<JSFunction> fun); 378 Handle<JSFunction> fun);
379 static void OnNewFunction(Handle<JSFunction> fun); 379 static void OnNewFunction(Handle<JSFunction> fun);
380 static void ProcessDebugEvent(v8::DebugEvent event, 380 static void ProcessDebugEvent(v8::DebugEvent event,
381 Handle<Object> event_data); 381 Handle<Object> event_data);
382 static void SetEventListener(Handle<Object> callback, Handle<Object> data); 382 static void SetEventListener(Handle<Object> callback, Handle<Object> data);
383 static void SetMessageHandler(v8::DebugMessageHandler handler, void* data); 383 static void SetMessageHandler(v8::DebugMessageHandler handler, void* data);
384 static void SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
385 void* data);
384 static void SendMessage(Vector<uint16_t> message); 386 static void SendMessage(Vector<uint16_t> message);
385 static void ProcessCommand(Vector<const uint16_t> command); 387 static void ProcessCommand(Vector<const uint16_t> command);
388 static void ProcessHostDispatch(void* dispatch);
386 static void UpdateActiveDebugger(); 389 static void UpdateActiveDebugger();
387 static Handle<Object> Call(Handle<JSFunction> fun, 390 static Handle<Object> Call(Handle<JSFunction> fun,
388 Handle<Object> data, 391 Handle<Object> data,
389 bool* pending_exception); 392 bool* pending_exception);
390 393
391 inline static bool EventActive(v8::DebugEvent event) { 394 inline static bool EventActive(v8::DebugEvent event) {
392 // Currently argument event is not used. 395 // Currently argument event is not used.
393 return !Debugger::compiling_natives_ && Debugger::debugger_active_; 396 return !Debugger::compiling_natives_ && Debugger::debugger_active_;
394 } 397 }
395 398
396 static void set_debugger_active(bool debugger_active) { 399 static void set_debugger_active(bool debugger_active) {
397 Debugger::debugger_active_ = debugger_active; 400 Debugger::debugger_active_ = debugger_active;
398 } 401 }
399 static bool debugger_active() { return Debugger::debugger_active_; } 402 static bool debugger_active() { return Debugger::debugger_active_; }
400 static void set_compiling_natives(bool compiling_natives) { 403 static void set_compiling_natives(bool compiling_natives) {
401 Debugger::compiling_natives_ = compiling_natives; 404 Debugger::compiling_natives_ = compiling_natives;
402 } 405 }
403 static bool compiling_natives() { return Debugger::compiling_natives_; } 406 static bool compiling_natives() { return Debugger::compiling_natives_; }
404 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; } 407 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; }
405 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; } 408 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; }
406 409
407 private: 410 private:
408 static Handle<Object> event_listener_; // Global handle to listener 411 static Handle<Object> event_listener_; // Global handle to listener
409 static Handle<Object> event_listener_data_; 412 static Handle<Object> event_listener_data_;
410 static bool debugger_active_; // Are there any active debugger? 413 static bool debugger_active_; // Are there any active debugger?
411 static bool compiling_natives_; // Are we compiling natives? 414 static bool compiling_natives_; // Are we compiling natives?
412 static bool is_loading_debugger_; // Are we loading the debugger? 415 static bool is_loading_debugger_; // Are we loading the debugger?
413 static DebugMessageThread* message_thread_; 416 static DebugMessageThread* message_thread_;
414 static v8::DebugMessageHandler debug_message_handler_; 417 static v8::DebugMessageHandler message_handler_;
415 static void* debug_message_handler_data_; 418 static void* message_handler_data_;
419 static v8::DebugHostDispatchHandler host_dispatch_handler_;
420 static void* host_dispatch_handler_data_;
421
422 friend class DebugMessageThread;
yurys 2009/02/19 14:44:18 wrong indentation
416 }; 423 };
417 424
418 425
419 // A Queue of Vector<uint16_t> objects. A thread-safe version is 426 // A Queue of Vector<uint16_t> objects. A thread-safe version is
420 // LockingMessageQueue, based on this class. 427 // LockingMessageQueue, based on this class.
421 class MessageQueue BASE_EMBEDDED { 428 class MessageQueue BASE_EMBEDDED {
422 public: 429 public:
423 explicit MessageQueue(int size); 430 explicit MessageQueue(int size);
424 ~MessageQueue(); 431 ~MessageQueue();
425 bool IsEmpty() const { return start_ == end_; } 432 bool IsEmpty() const { return start_ == end_; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // This is where V8 hands off 481 // This is where V8 hands off
475 // processing of the event to the DebugMessageThread thread, 482 // processing of the event to the DebugMessageThread thread,
476 // which forwards it to the debug_message_handler set by the API. 483 // which forwards it to the debug_message_handler set by the API.
477 void SendMessage(Vector<uint16_t> event_json); 484 void SendMessage(Vector<uint16_t> event_json);
478 // Formats an event into JSON, and calls SendMessage. 485 // Formats an event into JSON, and calls SendMessage.
479 bool SetEventJSONFromEvent(Handle<Object> event_data); 486 bool SetEventJSONFromEvent(Handle<Object> event_data);
480 // Puts a command coming from the public API on the queue. Called 487 // Puts a command coming from the public API on the queue. Called
481 // by the API client thread. This is where the API client hands off 488 // by the API client thread. This is where the API client hands off
482 // processing of the command to the DebugMessageThread thread. 489 // processing of the command to the DebugMessageThread thread.
483 void ProcessCommand(Vector<uint16_t> command); 490 void ProcessCommand(Vector<uint16_t> command);
491 void ProcessHostDispatch(void* dispatch);
484 void OnDebuggerInactive(); 492 void OnDebuggerInactive();
485 493
486 // Main function of DebugMessageThread thread. 494 // Main function of DebugMessageThread thread.
487 void Run(); 495 void Run();
488 496
489 bool host_running_; // Is the debugging host running or stopped? 497 bool host_running_; // Is the debugging host running or stopped?
490 Semaphore* command_received_; // Non-zero when command queue is non-empty. 498 Semaphore* command_received_; // Non-zero when command queue is non-empty.
491 Semaphore* message_received_; // Exactly equal to message queue length. 499 Semaphore* message_received_; // Exactly equal to message queue length.
492 private: 500 private:
493 bool TwoByteEqualsAscii(Vector<uint16_t> two_byte, const char* ascii); 501 bool TwoByteEqualsAscii(Vector<uint16_t> two_byte, const char* ascii);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 612 }
605 private: 613 private:
606 Debug::AddressId id_; 614 Debug::AddressId id_;
607 int reg_; 615 int reg_;
608 }; 616 };
609 617
610 618
611 } } // namespace v8::internal 619 } } // namespace v8::internal
612 620
613 #endif // V8_V8_DEBUG_H_ 621 #endif // V8_V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | src/debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698