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

Side by Side Diff: src/debug.h

Issue 14886: Bring toiger up to date with bleeding edge 984. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years 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/constants-arm.h ('k') | src/debug.cc » ('j') | no next file with comments »
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // when host_running_ is false. 454 // when host_running_ is false.
455 void DebugEvent(v8::DebugEvent, 455 void DebugEvent(v8::DebugEvent,
456 Handle<Object> exec_state, 456 Handle<Object> exec_state,
457 Handle<Object> event_data); 457 Handle<Object> event_data);
458 // Puts event on the output queue. Called by V8. 458 // Puts event on the output queue. Called by V8.
459 // This is where V8 hands off 459 // This is where V8 hands off
460 // processing of the event to the DebugMessageThread thread, 460 // processing of the event to the DebugMessageThread thread,
461 // which forwards it to the debug_message_handler set by the API. 461 // which forwards it to the debug_message_handler set by the API.
462 void SendMessage(Vector<uint16_t> event_json); 462 void SendMessage(Vector<uint16_t> event_json);
463 // Formats an event into JSON, and calls SendMessage. 463 // Formats an event into JSON, and calls SendMessage.
464 void SetEventJSONFromEvent(Handle<Object> event_data); 464 bool SetEventJSONFromEvent(Handle<Object> event_data);
465 // Puts a command coming from the public API on the queue. Called 465 // Puts a command coming from the public API on the queue. Called
466 // by the API client thread. This is where the API client hands off 466 // by the API client thread. This is where the API client hands off
467 // processing of the command to the DebugMessageThread thread. 467 // processing of the command to the DebugMessageThread thread.
468 void ProcessCommand(Vector<uint16_t> command); 468 void ProcessCommand(Vector<uint16_t> command);
469 void OnDebuggerInactive(); 469 void OnDebuggerInactive();
470 470
471 // Main function of DebugMessageThread thread. 471 // Main function of DebugMessageThread thread.
472 void Run(); 472 void Run();
473 473
474 bool host_running_; // Is the debugging host running or stopped? 474 bool host_running_; // Is the debugging host running or stopped?
475 Semaphore* command_received_; // Non-zero when command queue is non-empty. 475 Semaphore* command_received_; // Non-zero when command queue is non-empty.
476 Semaphore* message_received_; // Exactly equal to message queue length. 476 Semaphore* message_received_; // Exactly equal to message queue length.
477 private: 477 private:
478 bool TwoByteEqualsAscii(Vector<uint16_t> two_byte, const char* ascii); 478 bool TwoByteEqualsAscii(Vector<uint16_t> two_byte, const char* ascii);
479 479
480 static const int kQueueInitialSize = 4; 480 static const int kQueueInitialSize = 4;
481 LockingMessageQueue command_queue_; 481 LockingMessageQueue command_queue_;
482 LockingMessageQueue message_queue_; 482 LockingMessageQueue message_queue_;
483 DISALLOW_COPY_AND_ASSIGN(DebugMessageThread); 483 DISALLOW_COPY_AND_ASSIGN(DebugMessageThread);
484 }; 484 };
485 485
486 486
487 // This class is used for entering the debugger. Create an instance in the stack 487 // This class is used for entering the debugger. Create an instance in the stack
488 // to enter the debugger. This will set the current break state, make sure the 488 // to enter the debugger. This will set the current break state, make sure the
489 // debugger is loaded and switch to the debugger context. If the debugger for 489 // debugger is loaded and switch to the debugger context. If the debugger for
490 // some reason could not be entered FailedToEnter will return true. 490 // some reason could not be entered FailedToEnter will return true.
491 class EnterDebugger BASE_EMBEDDED { 491 class EnterDebugger BASE_EMBEDDED {
492 public: 492 public:
493 EnterDebugger() : set_(!it_.done()) { 493 EnterDebugger() : has_js_frames_(!it_.done()) {
494 // If there is no JavaScript frames on the stack don't switch to new break 494 // Store the previous break id and frame id.
495 // and break frame. 495 break_id_ = Top::break_id();
496 if (set_) { 496 break_frame_id_ = Top::break_frame_id();
497 // Store the previous break is and frame id.
498 break_id_ = Top::break_id();
499 break_frame_id_ = Top::break_frame_id();
500 497
501 // Create the new break info. 498 // Create the new break info. If there is no JavaScript frames there is no
499 // break frame id.
500 if (has_js_frames_) {
502 Top::new_break(it_.frame()->id()); 501 Top::new_break(it_.frame()->id());
502 } else {
503 Top::new_break(StackFrame::NO_ID);
503 } 504 }
504 505
505 // Make sure that debugger is loaded and enter the debugger context. 506 // Make sure that debugger is loaded and enter the debugger context.
506 load_failed_ = !Debug::Load(); 507 load_failed_ = !Debug::Load();
507 if (!load_failed_) { 508 if (!load_failed_) {
508 // NOTE the member variable save which saves the previous context before 509 // NOTE the member variable save which saves the previous context before
509 // this change. 510 // this change.
510 Top::set_context(*Debug::debug_context()); 511 Top::set_context(*Debug::debug_context());
511 } 512 }
512 } 513 }
513 514
514 ~EnterDebugger() { 515 ~EnterDebugger() {
515 if (set_) { 516 // Restore to the previous break state.
516 // Restore to the previous break state. 517 Top::set_break(break_frame_id_, break_id_);
517 Top::set_break(break_frame_id_, break_id_);
518 }
519 } 518 }
520 519
521 // Check whether the debugger could be entered. 520 // Check whether the debugger could be entered.
522 inline bool FailedToEnter() { return load_failed_; } 521 inline bool FailedToEnter() { return load_failed_; }
523 522
524 // Check whether there are any JavaScript frames on the stack. 523 // Check whether there are any JavaScript frames on the stack.
525 inline bool HasJavaScriptFrames() { return set_; } 524 inline bool HasJavaScriptFrames() { return has_js_frames_; }
526 525
527 private: 526 private:
528 JavaScriptFrameIterator it_; 527 JavaScriptFrameIterator it_;
529 const bool set_; // Was the break actually set? 528 const bool has_js_frames_; // Were there any JavaScript frames?
530 StackFrame::Id break_frame_id_; // Previous break frame id. 529 StackFrame::Id break_frame_id_; // Previous break frame id.
531 int break_id_; // Previous break id. 530 int break_id_; // Previous break id.
532 bool load_failed_; // Did the debugger fail to load? 531 bool load_failed_; // Did the debugger fail to load?
533 SaveContext save_; // Saves previous context. 532 SaveContext save_; // Saves previous context.
534 }; 533 };
535 534
536 535
537 // Stack allocated class for disabling break. 536 // Stack allocated class for disabling break.
538 class DisableBreak BASE_EMBEDDED { 537 class DisableBreak BASE_EMBEDDED {
539 public: 538 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 589 }
591 private: 590 private:
592 Debug::AddressId id_; 591 Debug::AddressId id_;
593 int reg_; 592 int reg_;
594 }; 593 };
595 594
596 595
597 } } // namespace v8::internal 596 } } // namespace v8::internal
598 597
599 #endif // V8_V8_DEBUG_H_ 598 #endif // V8_V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/constants-arm.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698