OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DEBUG_DEBUG_H_ | 5 #ifndef V8_DEBUG_DEBUG_H_ |
6 #define V8_DEBUG_DEBUG_H_ | 6 #define V8_DEBUG_DEBUG_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 void Put(const CommandMessage& message); | 336 void Put(const CommandMessage& message); |
337 void Clear(); | 337 void Clear(); |
338 private: | 338 private: |
339 Logger* logger_; | 339 Logger* logger_; |
340 CommandMessageQueue queue_; | 340 CommandMessageQueue queue_; |
341 mutable base::Mutex mutex_; | 341 mutable base::Mutex mutex_; |
342 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); | 342 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); |
343 }; | 343 }; |
344 | 344 |
345 | 345 |
| 346 class DebugFeatureTracker { |
| 347 public: |
| 348 enum Feature { |
| 349 kActive = 1, |
| 350 kBreakPoint = 2, |
| 351 kStepping = 3, |
| 352 kHeapSnapshot = 4, |
| 353 kAllocationTracking = 5, |
| 354 kProfiler = 6, |
| 355 kLiveEdit = 7, |
| 356 }; |
| 357 |
| 358 explicit DebugFeatureTracker(Isolate* isolate) |
| 359 : isolate_(isolate), bitfield_(0) {} |
| 360 void Track(Feature feature); |
| 361 |
| 362 private: |
| 363 Isolate* isolate_; |
| 364 uint32_t bitfield_; |
| 365 }; |
| 366 |
| 367 |
346 // This class contains the debugger support. The main purpose is to handle | 368 // This class contains the debugger support. The main purpose is to handle |
347 // setting break points in the code. | 369 // setting break points in the code. |
348 // | 370 // |
349 // This class controls the debug info for all functions which currently have | 371 // This class controls the debug info for all functions which currently have |
350 // active breakpoints in them. This debug info is held in the heap root object | 372 // active breakpoints in them. This debug info is held in the heap root object |
351 // debug_info which is a FixedArray. Each entry in this list is of class | 373 // debug_info which is a FixedArray. Each entry in this list is of class |
352 // DebugInfo. | 374 // DebugInfo. |
353 class Debug { | 375 class Debug { |
354 public: | 376 public: |
355 // Debug event triggers. | 377 // Debug event triggers. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 Object*** address = &thread_local_.restarter_frame_function_pointer_; | 523 Object*** address = &thread_local_.restarter_frame_function_pointer_; |
502 return reinterpret_cast<Address>(address); | 524 return reinterpret_cast<Address>(address); |
503 } | 525 } |
504 | 526 |
505 Address step_in_fp_addr() { | 527 Address step_in_fp_addr() { |
506 return reinterpret_cast<Address>(&thread_local_.step_into_fp_); | 528 return reinterpret_cast<Address>(&thread_local_.step_into_fp_); |
507 } | 529 } |
508 | 530 |
509 StepAction last_step_action() { return thread_local_.last_step_action_; } | 531 StepAction last_step_action() { return thread_local_.last_step_action_; } |
510 | 532 |
| 533 DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } |
| 534 |
511 private: | 535 private: |
512 explicit Debug(Isolate* isolate); | 536 explicit Debug(Isolate* isolate); |
513 | 537 |
514 void UpdateState(); | 538 void UpdateState(); |
515 void Unload(); | 539 void Unload(); |
516 void SetNextBreakId() { | 540 void SetNextBreakId() { |
517 thread_local_.break_id_ = ++thread_local_.break_count_; | 541 thread_local_.break_id_ = ++thread_local_.break_count_; |
518 } | 542 } |
519 | 543 |
520 // Check whether there are commands in the command queue. | 544 // Check whether there are commands in the command queue. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 bool break_on_exception_; | 623 bool break_on_exception_; |
600 bool break_on_uncaught_exception_; | 624 bool break_on_uncaught_exception_; |
601 | 625 |
602 DebugInfoListNode* debug_info_list_; // List of active debug info objects. | 626 DebugInfoListNode* debug_info_list_; // List of active debug info objects. |
603 | 627 |
604 // Storage location for jump when exiting debug break calls. | 628 // Storage location for jump when exiting debug break calls. |
605 // Note that this address is not GC safe. It should be computed immediately | 629 // Note that this address is not GC safe. It should be computed immediately |
606 // before returning to the DebugBreakCallHelper. | 630 // before returning to the DebugBreakCallHelper. |
607 Address after_break_target_; | 631 Address after_break_target_; |
608 | 632 |
| 633 // Used to collect histogram data on debugger feature usage. |
| 634 DebugFeatureTracker feature_tracker_; |
| 635 |
609 // Per-thread data. | 636 // Per-thread data. |
610 class ThreadLocal { | 637 class ThreadLocal { |
611 public: | 638 public: |
612 // Top debugger entry. | 639 // Top debugger entry. |
613 base::AtomicWord current_debug_scope_; | 640 base::AtomicWord current_debug_scope_; |
614 | 641 |
615 // Counter for generating next break id. | 642 // Counter for generating next break id. |
616 int break_count_; | 643 int break_count_; |
617 | 644 |
618 // Current break id. | 645 // Current break id. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 | 788 |
762 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); | 789 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); |
763 static void ClearDebugBreakSlot(Address pc); | 790 static void ClearDebugBreakSlot(Address pc); |
764 }; | 791 }; |
765 | 792 |
766 | 793 |
767 } // namespace internal | 794 } // namespace internal |
768 } // namespace v8 | 795 } // namespace v8 |
769 | 796 |
770 #endif // V8_DEBUG_DEBUG_H_ | 797 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |