V8 Project
debug.h
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_DEBUG_H_
6 #define V8_DEBUG_H_
7 
8 #include "src/allocation.h"
9 #include "src/arguments.h"
10 #include "src/assembler.h"
12 #include "src/execution.h"
13 #include "src/factory.h"
14 #include "src/flags.h"
15 #include "src/frames-inl.h"
16 #include "src/hashmap.h"
17 #include "src/liveedit.h"
18 #include "src/string-stream.h"
19 #include "src/v8threads.h"
20 
21 #include "include/v8-debug.h"
22 
23 namespace v8 {
24 namespace internal {
25 
26 
27 // Forward declarations.
28 class DebugScope;
29 
30 
31 // Step actions. NOTE: These values are in macros.py as well.
32 enum StepAction {
33  StepNone = -1, // Stepping not prepared.
34  StepOut = 0, // Step out of the current function.
35  StepNext = 1, // Step to the next statement in the current function.
36  StepIn = 2, // Step into new functions invoked or the next statement
37  // in the current function.
38  StepMin = 3, // Perform a minimum step in the current function.
39  StepInMin = 4 // Step into new functions invoked or perform a minimum step
40  // in the current function.
41 };
42 
43 
44 // Type of exception break. NOTE: These values are in macros.py as well.
48 };
49 
50 
51 // Type of exception break. NOTE: These values are in macros.py as well.
55 };
56 
57 
58 // The different types of breakpoint position alignments.
59 // Must match Debug.BreakPositionAlignment in debug-debugger.js
63 };
64 
65 
66 // Class for iterating through the break points in a function and changing
67 // them.
69  public:
70  explicit BreakLocationIterator(Handle<DebugInfo> debug_info,
71  BreakLocatorType type);
72  virtual ~BreakLocationIterator();
73 
74  void Next();
75  void Next(int count);
78  BreakPositionAlignment alignment);
79  void Reset();
80  bool Done() const;
81  void SetBreakPoint(Handle<Object> break_point_object);
82  void ClearBreakPoint(Handle<Object> break_point_object);
83  void SetOneShot();
84  void ClearOneShot();
85  bool IsStepInLocation(Isolate* isolate);
86  void PrepareStepIn(Isolate* isolate);
87  bool IsExit() const;
88  bool HasBreakPoint();
89  bool IsDebugBreak();
91  void ClearAllDebugBreak();
92 
93 
94  inline int code_position() {
95  return static_cast<int>(pc() - debug_info_->code()->entry());
96  }
97  inline int break_point() { return break_point_; }
98  inline int position() { return position_; }
99  inline int statement_position() { return statement_position_; }
100  inline Address pc() { return reloc_iterator_->rinfo()->pc(); }
101  inline Code* code() { return debug_info_->code(); }
102  inline RelocInfo* rinfo() { return reloc_iterator_->rinfo(); }
103  inline RelocInfo::Mode rmode() const {
104  return reloc_iterator_->rinfo()->rmode();
105  }
108  }
110  return reloc_iterator_original_->rinfo()->rmode();
111  }
112 
113  bool IsDebuggerStatement();
114 
115  protected:
116  bool RinfoDone() const;
117  void RinfoNext();
118 
126 
127  private:
128  void SetDebugBreak();
129  void ClearDebugBreak();
130 
131  void SetDebugBreakAtIC();
132  void ClearDebugBreakAtIC();
133 
137 
138  bool IsDebugBreakSlot();
142 
144 };
145 
146 
147 // Cache of all script objects in the heap. When a script is added a weak handle
148 // to it is created and that weak handle is stored in the cache. The weak handle
149 // callback takes care of removing the script from the cache. The key used in
150 // the cache is the script id.
151 class ScriptCache : private HashMap {
152  public:
153  explicit ScriptCache(Isolate* isolate);
154  virtual ~ScriptCache() { Clear(); }
155 
156  // Add script to the cache.
157  void Add(Handle<Script> script);
158 
159  // Return the scripts in the cache.
161 
162  private:
163  // Calculate the hash value from the key (script id).
164  static uint32_t Hash(int key) {
166  }
167 
168  // Clear the cache releasing all the weak handles.
169  void Clear();
170 
171  // Weak handle callback for scripts in the cache.
172  static void HandleWeakScript(
174 
176 };
177 
178 
179 // Linked list holding debug info objects. The debug info objects are kept as
180 // weak handles to avoid a debug info object to keep a function alive.
182  public:
184  virtual ~DebugInfoListNode();
185 
186  DebugInfoListNode* next() { return next_; }
189 
190  private:
191  // Global (weak) handle to the debug info object.
193 
194  // Next pointer for linked list.
196 };
197 
198 
199 
200 // Message delivered to the message handler callback. This is either a debugger
201 // event or the response to a command.
203  public:
204  // Create a message object for a debug event.
205  static MessageImpl NewEvent(DebugEvent event,
206  bool running,
207  Handle<JSObject> exec_state,
208  Handle<JSObject> event_data);
209 
210  // Create a message object for the response to a debug command.
211  static MessageImpl NewResponse(DebugEvent event,
212  bool running,
213  Handle<JSObject> exec_state,
214  Handle<JSObject> event_data,
215  Handle<String> response_json,
216  v8::Debug::ClientData* client_data);
217 
218  // Implementation of interface v8::Debug::Message.
219  virtual bool IsEvent() const;
220  virtual bool IsResponse() const;
221  virtual DebugEvent GetEvent() const;
222  virtual bool WillStartRunning() const;
224  virtual v8::Handle<v8::Object> GetEventData() const;
225  virtual v8::Handle<v8::String> GetJSON() const;
227  virtual v8::Debug::ClientData* GetClientData() const;
228  virtual v8::Isolate* GetIsolate() const;
229 
230  private:
231  MessageImpl(bool is_event,
232  DebugEvent event,
233  bool running,
234  Handle<JSObject> exec_state,
235  Handle<JSObject> event_data,
236  Handle<String> response_json,
237  v8::Debug::ClientData* client_data);
238 
239  bool is_event_; // Does this message represent a debug event?
240  DebugEvent event_; // Debug event causing the break.
241  bool running_; // Will the VM start running after this event?
242  Handle<JSObject> exec_state_; // Current execution state.
243  Handle<JSObject> event_data_; // Data associated with the event.
244  Handle<String> response_json_; // Response JSON if message holds a response.
245  v8::Debug::ClientData* client_data_; // Client data passed with the request.
246 };
247 
248 
249 // Details of the debug event delivered to the debug event listener.
251  public:
253  Handle<JSObject> exec_state,
254  Handle<JSObject> event_data,
255  Handle<Object> callback_data,
256  v8::Debug::ClientData* client_data);
257  virtual DebugEvent GetEvent() const;
259  virtual v8::Handle<v8::Object> GetEventData() const;
261  virtual v8::Handle<v8::Value> GetCallbackData() const;
262  virtual v8::Debug::ClientData* GetClientData() const;
263  private:
264  DebugEvent event_; // Debug event causing the break.
265  Handle<JSObject> exec_state_; // Current execution state.
266  Handle<JSObject> event_data_; // Data associated with the event.
267  Handle<Object> callback_data_; // User data passed with the callback
268  // when it was registered.
269  v8::Debug::ClientData* client_data_; // Data passed to DebugBreakForCommand.
270 };
271 
272 
273 // Message send by user to v8 debugger or debugger output message.
274 // In addition to command text it may contain a pointer to some user data
275 // which are expected to be passed along with the command reponse to message
276 // handler.
278  public:
279  static CommandMessage New(const Vector<uint16_t>& command,
280  v8::Debug::ClientData* data);
281  CommandMessage();
282 
283  // Deletes user data and disposes of the text.
284  void Dispose();
285  Vector<uint16_t> text() const { return text_; }
287  private:
289  v8::Debug::ClientData* data);
290 
293 };
294 
295 
296 // A Queue of CommandMessage objects. A thread-safe version is
297 // LockingCommandMessageQueue, based on this class.
298 class CommandMessageQueue BASE_EMBEDDED {
299  public:
300  explicit CommandMessageQueue(int size);
302  bool IsEmpty() const { return start_ == end_; }
304  void Put(const CommandMessage& message);
305  void Clear() { start_ = end_ = 0; } // Queue is empty after Clear().
306  private:
307  // Doubles the size of the message queue, and copies the messages.
308  void Expand();
309 
311  int start_;
312  int end_;
313  int size_; // The size of the queue buffer. Queue can hold size-1 messages.
314 };
315 
316 
317 // LockingCommandMessageQueue is a thread-safe circular buffer of CommandMessage
318 // messages. The message data is not managed by LockingCommandMessageQueue.
319 // Pointers to the data are passed in and out. Implemented by adding a
320 // Mutex to CommandMessageQueue. Includes logging of all puts and gets.
321 class LockingCommandMessageQueue BASE_EMBEDDED {
322  public:
324  bool IsEmpty() const;
326  void Put(const CommandMessage& message);
327  void Clear();
328  private:
330  CommandMessageQueue queue_;
331  mutable base::Mutex mutex_;
332  DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue);
333 };
334 
335 
336 // This class contains the debugger support. The main purpose is to handle
337 // setting break points in the code.
338 //
339 // This class controls the debug info for all functions which currently have
340 // active breakpoints in them. This debug info is held in the heap root object
341 // debug_info which is a FixedArray. Each entry in this list is of class
342 // DebugInfo.
343 class Debug {
344  public:
345  // Debug event triggers.
346  void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue);
347 
348  void OnThrow(Handle<Object> exception, bool uncaught);
349  void OnPromiseReject(Handle<JSObject> promise, Handle<Object> value);
350  void OnCompileError(Handle<Script> script);
351  void OnBeforeCompile(Handle<Script> script);
352  void OnAfterCompile(Handle<Script> script);
353  void OnPromiseEvent(Handle<JSObject> data);
355 
356  // API facing.
357  void SetEventListener(Handle<Object> callback, Handle<Object> data);
360  v8::Debug::ClientData* client_data = NULL);
361  // Enqueue a debugger command to the command queue for event listeners.
362  void EnqueueDebugCommand(v8::Debug::ClientData* client_data = NULL);
364  Handle<Object> data);
366  void HandleDebugBreak();
367  void ProcessDebugMessages(bool debug_command_only);
368 
369  // Internal logic
370  bool Load();
371  void Break(Arguments args, JavaScriptFrame*);
373 
374  // Scripts handling.
376 
377  // Break point handling.
378  bool SetBreakPoint(Handle<JSFunction> function,
379  Handle<Object> break_point_object,
380  int* source_position);
382  Handle<Object> break_point_object,
383  int* source_position,
384  BreakPositionAlignment alignment);
385  void ClearBreakPoint(Handle<Object> break_point_object);
386  void ClearAllBreakPoints();
387  void FloodWithOneShot(Handle<JSFunction> function);
390  void ChangeBreakOnException(ExceptionBreakType type, bool enable);
392 
393  // Stepping handling.
394  void PrepareStep(StepAction step_action,
395  int step_count,
396  StackFrame::Id frame_id);
397  void ClearStepping();
398  void ClearStepOut();
399  bool IsStepping() { return thread_local_.step_count_ > 0; }
400  bool StepNextContinue(BreakLocationIterator* break_location_iterator,
401  JavaScriptFrame* frame);
402  bool StepInActive() { return thread_local_.step_into_fp_ != 0; }
403  void HandleStepIn(Handle<JSFunction> function,
404  Handle<Object> holder,
405  Address fp,
406  bool is_constructor);
407  bool StepOutActive() { return thread_local_.step_out_fp_ != 0; }
408 
409  // Purge all code objects that have no debug break slots.
410  void PrepareForBreakPoints();
411 
412  // Returns whether the operation succeeded. Compilation can only be triggered
413  // if a valid closure is passed as the second argument, otherwise the shared
414  // function needs to be compiled already.
416  Handle<JSFunction> function);
418  static bool HasDebugInfo(Handle<SharedFunctionInfo> shared);
419 
420  // This function is used in FunctionNameUsing* tests.
422 
423  // Returns true if the current stub call is patched to call the debugger.
424  static bool IsDebugBreak(Address addr);
425  // Returns true if the current return statement has been patched to be
426  // a debugger breakpoint.
427  static bool IsDebugBreakAtReturn(RelocInfo* rinfo);
428 
431  BreakPositionAlignment position_aligment);
432 
433  // Check whether a global object is the debug global object.
434  bool IsDebugGlobal(GlobalObject* global);
435 
436  // Check whether this frame is just about to return.
437  bool IsBreakAtReturn(JavaScriptFrame* frame);
438 
439  // Support for LiveEdit
440  void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
442  Object** restarter_frame_function_pointer);
443 
444  // Passed to MakeWeak.
445  static void HandleWeakDebugInfo(
447 
448  // Threading support.
449  char* ArchiveDebug(char* to);
450  char* RestoreDebug(char* from);
451  static int ArchiveSpacePerThread();
453 
454  // Record function from which eval was called.
455  static void RecordEvalCaller(Handle<Script> script);
456 
457  // Flags and states.
461  bool live_edit_enabled() const {
462  return FLAG_enable_liveedit && live_edit_enabled_ ;
463  }
464 
465  inline bool is_active() const { return is_active_; }
466  inline bool is_loaded() const { return !debug_context_.is_null(); }
467  inline bool has_break_points() const { return has_break_points_; }
468  inline bool in_debug_scope() const {
470  }
471  void set_disable_break(bool v) { break_disabled_ = v; }
472 
473  StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; }
474  int break_id() { return thread_local_.break_id_; }
475 
476  // Support for embedding into generated code.
478  return reinterpret_cast<Address>(&is_active_);
479  }
480 
482  return reinterpret_cast<Address>(&after_break_target_);
483  }
484 
487  return reinterpret_cast<Address>(address);
488  }
489 
491  return reinterpret_cast<Address>(&thread_local_.step_into_fp_);
492  }
493 
494  private:
495  explicit Debug(Isolate* isolate);
496 
497  void UpdateState();
498  void Unload();
499  void SetNextBreakId() {
501  }
502 
503  // Check whether there are commands in the command queue.
504  inline bool has_commands() const { return !command_queue_.IsEmpty(); }
505  inline bool ignore_events() const { return is_suppressed_ || !is_active_; }
506 
507  void OnException(Handle<Object> exception, bool uncaught,
508  Handle<Object> promise);
509 
510  // Constructors for debug event objects.
512  const char* constructor_name,
513  int argc,
514  Handle<Object> argv[]);
517  Handle<Object> break_points_hit);
519  Handle<Object> exception,
520  bool uncaught,
521  Handle<Object> promise);
523  Handle<Script> script, v8::DebugEvent type);
525  Handle<JSObject> promise_event);
527  Handle<JSObject> task_event);
528 
529  // Mirror cache handling.
530  void ClearMirrorCache();
531 
532  // Returns a promise if the pushed try-catch handler matches the current one.
534 
536  Handle<Object> exec_state,
537  Handle<Object> event_data,
538  v8::Debug::ClientData* client_data);
540  Handle<JSObject> event_data,
541  bool auto_continue);
543  Handle<JSObject> exec_state,
544  Handle<JSObject> event_data,
545  bool auto_continue);
546  void InvokeMessageHandler(MessageImpl message);
547 
548  static bool CompileDebuggerScript(Isolate* isolate, int index);
549  void ClearOneShot();
550  void ActivateStepIn(StackFrame* frame);
551  void ClearStepIn();
552  void ActivateStepOut(StackFrame* frame);
553  void ClearStepNext();
554  // Returns whether the compile succeeded.
555  void RemoveDebugInfo(Handle<DebugInfo> debug_info);
557  bool CheckBreakPoint(Handle<Object> break_point_object);
558 
559  inline void AssertDebugContext() {
562  }
563 
564  void ThreadInit();
565 
566  // Global handles.
570 
572 
573  static const int kQueueInitialSize = 4;
574  base::Semaphore command_received_; // Signaled for each command received.
575  LockingCommandMessageQueue command_queue_;
576  LockingCommandMessageQueue event_command_queue_;
577 
585 
586  ScriptCache* script_cache_; // Cache of all scripts in the heap.
587  DebugInfoListNode* debug_info_list_; // List of active debug info objects.
588 
589  // Storage location for jump when exiting debug break calls.
590  // Note that this address is not GC safe. It should be computed immediately
591  // before returning to the DebugBreakCallHelper.
593 
594  // Per-thread data.
595  class ThreadLocal {
596  public:
597  // Top debugger entry.
599 
600  // Counter for generating next break id.
602 
603  // Current break id.
605 
606  // Frame id for the frame of the current break.
607  StackFrame::Id break_frame_id_;
608 
609  // Step action for last step performed.
611 
612  // Source statement position from last step next action.
614 
615  // Number of steps left to perform before debug event.
617 
618  // Frame pointer from last step next action.
620 
621  // Number of queued steps left to perform before debug event.
623 
624  // Frame pointer for frame from which step in was performed.
626 
627  // Frame pointer for the frame where debugger should be called when current
628  // step out action is completed.
630 
631  // Stores the way how LiveEdit has patched the stack. It is used when
632  // debugger returns control back to user script.
634 
635  // When restarter frame is on stack, stores the address
636  // of the pointer to function being restarted. Otherwise (most of the time)
637  // stores NULL. This pointer is used with 'step in' implementation.
639  };
640 
641  // Storage location for registers when handling debug break calls
643 
645 
646  friend class Isolate;
647  friend class DebugScope;
648  friend class DisableBreak;
649  friend class LiveEdit;
650  friend class SuppressDebug;
651 
652  friend Handle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc
653  friend void CheckDebuggerUnloaded(bool check_functions); // In test-debug.cc
654 
656 };
657 
658 
660 
661 
662 // This scope is used to load and enter the debug context and create a new
663 // break state. Leaving the scope will restore the previous state.
664 // On failure to load, FailedToEnter returns true.
665 class DebugScope BASE_EMBEDDED {
666  public:
667  explicit DebugScope(Debug* debug);
669 
670  // Check whether loading was successful.
671  inline bool failed() { return failed_; }
672 
673  // Get the active context from before entering the debugger.
674  inline Handle<Context> GetContext() { return save_.context(); }
675 
676  private:
677  Isolate* isolate() { return debug_->isolate_; }
678 
680  DebugScope* prev_; // Previous scope if entered recursively.
681  StackFrame::Id break_frame_id_; // Previous break frame id.
682  int break_id_; // Previous break id.
683  bool failed_; // Did the debug context fail to load?
684  SaveContext save_; // Saves previous context.
685  PostponeInterruptsScope no_termination_exceptons_;
686 };
687 
688 
689 // Stack allocated class for disabling break.
690 class DisableBreak BASE_EMBEDDED {
691  public:
692  explicit DisableBreak(Debug* debug, bool disable_break)
693  : debug_(debug), old_state_(debug->break_disabled_) {
694  debug_->break_disabled_ = disable_break;
695  }
696  ~DisableBreak() { debug_->break_disabled_ = old_state_; }
697 
698  private:
699  Debug* debug_;
702 };
703 
704 
705 class SuppressDebug BASE_EMBEDDED {
706  public:
707  explicit SuppressDebug(Debug* debug)
708  : debug_(debug), old_state_(debug->is_suppressed_) {
709  debug_->is_suppressed_ = true;
710  }
711  ~SuppressDebug() { debug_->is_suppressed_ = old_state_; }
712 
713  private:
714  Debug* debug_;
715  bool old_state_;
716  DISALLOW_COPY_AND_ASSIGN(SuppressDebug);
717 };
718 
719 
720 // Code generator routines.
721 class DebugCodegen : public AllStatic {
722  public:
723  static void GenerateSlot(MacroAssembler* masm);
736 
737  // FrameDropper is a code replacement for a JavaScript frame with possibly
738  // several frames above.
739  // There is no calling conventions here, because it never actually gets
740  // called, it only gets returned to.
742 };
743 
744 
745 } } // namespace v8::internal
746 
747 #endif // V8_DEBUG_H_
A client object passed to the v8 debugger whose ownership will be taken by it.
Definition: v8-debug.h:35
An event details object passed to the debug event listener.
Definition: v8-debug.h:97
A message object passed to the debug message handler.
Definition: v8-debug.h:44
void(* MessageHandler)(const Message &message)
Debug message callback function.
Definition: v8-debug.h:152
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
A single JavaScript stack frame.
Definition: v8.h:1358
DisableBreak(Debug *debug, bool disable_break)
Definition: debug.h:692
StackFrame::Id break_frame_id_
Definition: debug.h:681
CommandMessage * messages_
Definition: debug.h:310
Handle< Context > GetContext()
Definition: debug.h:674
DISALLOW_COPY_AND_ASSIGN(DisableBreak)
CommandMessageQueue queue_
Definition: debug.h:330
void Put(const CommandMessage &message)
DISALLOW_COPY_AND_ASSIGN(SuppressDebug)
LockingCommandMessageQueue(Logger *logger, int size)
DebugScope * prev_
Definition: debug.h:680
bool IsEmpty() const
Definition: debug.h:302
DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue)
SuppressDebug(Debug *debug)
Definition: debug.h:707
PostponeInterruptsScope no_termination_exceptons_
Definition: debug.h:685
Handle< DebugInfo > debug_info_
Definition: debug.h:123
void ClearBreakPoint(Handle< Object > break_point_object)
Definition: debug.cc:281
void FindBreakLocationFromAddress(Address pc)
Definition: debug.cc:187
DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator)
BreakLocationIterator(Handle< DebugInfo > debug_info, BreakLocatorType type)
Definition: debug.cc:62
RelocInfo::Mode rmode() const
Definition: debug.h:103
RelocIterator * reloc_iterator_
Definition: debug.h:124
void SetBreakPoint(Handle< Object > break_point_object)
Definition: debug.cc:269
RelocIterator * reloc_iterator_original_
Definition: debug.h:125
bool IsStepInLocation(Isolate *isolate)
Definition: debug.cc:365
void PrepareStepIn(Isolate *isolate)
Definition: debug.cc:381
RelocInfo::Mode original_rmode() const
Definition: debug.h:109
void FindBreakLocationFromPosition(int position, BreakPositionAlignment alignment)
Definition: debug.cc:209
Vector< uint16_t > text() const
Definition: debug.h:285
static CommandMessage New(const Vector< uint16_t > &command, v8::Debug::ClientData *data)
Definition: debug.cc:3300
v8::Debug::ClientData * client_data() const
Definition: debug.h:286
Vector< uint16_t > text_
Definition: debug.h:291
v8::Debug::ClientData * client_data_
Definition: debug.h:292
static void GenerateSlot(MacroAssembler *masm)
static void GenerateStoreICDebugBreak(MacroAssembler *masm)
static void GenerateLoadICDebugBreak(MacroAssembler *masm)
static void GeneratePlainReturnLiveEdit(MacroAssembler *masm)
static void GenerateCallConstructStubDebugBreak(MacroAssembler *masm)
static void GenerateCallConstructStubRecordDebugBreak(MacroAssembler *masm)
static void GenerateCallFunctionStubDebugBreak(MacroAssembler *masm)
static void GenerateCompareNilICDebugBreak(MacroAssembler *masm)
static void GenerateKeyedStoreICDebugBreak(MacroAssembler *masm)
static void GenerateCallICStubDebugBreak(MacroAssembler *masm)
static void GenerateFrameDropperLiveEdit(MacroAssembler *masm)
static void GenerateKeyedLoadICDebugBreak(MacroAssembler *masm)
static void GenerateReturnDebugBreak(MacroAssembler *masm)
static void GenerateSlotDebugBreak(MacroAssembler *masm)
Handle< DebugInfo > debug_info_
Definition: debug.h:192
DebugInfoListNode * next_
Definition: debug.h:195
void set_next(DebugInfoListNode *next)
Definition: debug.h:187
DebugInfoListNode * next()
Definition: debug.h:186
Handle< DebugInfo > debug_info()
Definition: debug.h:188
DebugInfoListNode(DebugInfo *debug_info)
Definition: debug.cc:713
Object ** restarter_frame_function_pointer_
Definition: debug.h:638
LiveEdit::FrameDropMode frame_drop_mode_
Definition: debug.h:633
DebugScope * current_debug_scope_
Definition: debug.h:598
StackFrame::Id break_frame_id_
Definition: debug.h:607
static bool HasDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1062
Handle< Context > GetDebugContext()
Definition: debug.cc:2778
void OnException(Handle< Object > exception, bool uncaught, Handle< Object > promise)
Definition: debug.cc:2528
void UpdateState()
Definition: debug.cc:2954
MUST_USE_RESULT MaybeHandle< Object > MakeAsyncTaskEvent(Handle< JSObject > task_event)
Definition: debug.cc:2497
bool ignore_events() const
Definition: debug.h:505
static void HandleWeakDebugInfo(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: debug.cc:691
bool StepInActive()
Definition: debug.h:402
void OnThrow(Handle< Object > exception, bool uncaught)
Definition: debug.cc:2504
bool has_break_points_
Definition: debug.h:581
bool StepOutActive()
Definition: debug.h:407
void AssertDebugContext()
Definition: debug.h:559
void SetNextBreakId()
Definition: debug.h:499
void EnqueueCommandMessage(Vector< const uint16_t > command, v8::Debug::ClientData *client_data=NULL)
Definition: debug.cc:2979
void ActivateStepIn(StackFrame *frame)
Definition: debug.cc:1675
bool break_disabled_
Definition: debug.h:582
Handle< Object > event_listener_data_
Definition: debug.h:569
bool EnsureDebugInfo(Handle< SharedFunctionInfo > shared, Handle< JSFunction > function)
Definition: debug.cc:2177
void PrepareForBreakPoints()
Definition: debug.cc:1907
void ClearAllBreakPoints()
Definition: debug.cc:1181
static const int kQueueInitialSize
Definition: debug.h:573
void HandleStepIn(Handle< JSFunction > function, Handle< Object > holder, Address fp, bool is_constructor)
Definition: debug.cc:1593
ScriptCache * script_cache_
Definition: debug.h:586
void ActivateStepOut(StackFrame *frame)
Definition: debug.cc:1686
static void RecordEvalCaller(Handle< Script > script)
Definition: debug.cc:2419
void OnAsyncTaskEvent(Handle< JSObject > data)
Definition: debug.cc:2690
MUST_USE_RESULT MaybeHandle< Object > MakeBreakEvent(Handle< Object > break_points_hit)
Definition: debug.cc:2460
Address after_break_target_
Definition: debug.h:592
bool IsStepping()
Definition: debug.h:399
LockingCommandMessageQueue event_command_queue_
Definition: debug.h:576
friend Handle< FixedArray > GetDebuggedFunctions()
MUST_USE_RESULT MaybeHandle< Object > Call(Handle< JSFunction > fun, Handle< Object > data)
Definition: debug.cc:3004
void Break(Arguments args, JavaScriptFrame *)
Definition: debug.cc:866
Handle< Object > event_listener_
Definition: debug.h:568
void InvokeMessageHandler(MessageImpl message)
Definition: debug.cc:2970
ThreadLocal thread_local_
Definition: debug.h:642
void RemoveDebugInfo(Handle< DebugInfo > debug_info)
Definition: debug.cc:2208
bool PromiseHasRejectHandler(Handle< JSObject > promise)
Definition: debug.cc:1265
void ClearStepNext()
Definition: debug.cc:1697
void ClearMirrorCache()
Definition: debug.cc:2389
Address step_in_fp_addr()
Definition: debug.h:490
void SetMessageHandler(v8::Debug::MessageHandler handler)
Definition: debug.cc:2942
DebugScope * debugger_entry()
Definition: debug.h:458
friend class SuppressDebug
Definition: debug.h:650
void ClearStepIn()
Definition: debug.cc:1681
MUST_USE_RESULT MaybeHandle< Object > MakeExecutionState()
Definition: debug.cc:2453
bool has_commands() const
Definition: debug.h:504
friend class DebugScope
Definition: debug.h:647
StackFrame::Id break_frame_id()
Definition: debug.h:473
MUST_USE_RESULT MaybeHandle< Object > MakeJSObject(const char *constructor_name, int argc, Handle< Object > argv[])
Definition: debug.cc:2434
char * ArchiveDebug(char *to)
Definition: debug.cc:571
static Handle< DebugInfo > GetDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1069
static bool IsDebugBreakAtReturn(RelocInfo *rinfo)
bool has_break_points() const
Definition: debug.h:467
void ClearOneShot()
Definition: debug.cc:1658
Address is_active_address()
Definition: debug.h:477
bool live_edit_enabled_
Definition: debug.h:580
void ChangeBreakOnException(ExceptionBreakType type, bool enable)
Definition: debug.cc:1247
v8::Debug::MessageHandler message_handler_
Definition: debug.h:571
Object * FindSharedFunctionInfoInScript(Handle< Script > script, int position)
Definition: debug.cc:2071
void FreeThreadResources()
Definition: debug.h:452
bool live_edit_enabled() const
Definition: debug.h:461
void HandleDebugBreak()
Definition: debug.cc:3024
friend void CheckDebuggerUnloaded(bool check_functions)
Address restarter_frame_function_pointer_address()
Definition: debug.h:485
bool CheckBreakPoint(Handle< Object > break_point_object)
Definition: debug.cc:1027
static Handle< Object > GetSourceBreakLocations(Handle< SharedFunctionInfo > shared, BreakPositionAlignment position_aligment)
Definition: debug.cc:1551
LockingCommandMessageQueue command_queue_
Definition: debug.h:575
bool break_on_exception_
Definition: debug.h:583
void OnAfterCompile(Handle< Script > script)
Definition: debug.cc:2621
void FloodBoundFunctionWithOneShot(Handle< JSFunction > function)
Definition: debug.cc:1216
bool break_on_uncaught_exception_
Definition: debug.h:584
void OnCompileError(Handle< Script > script)
Definition: debug.cc:2562
void ProcessDebugEvent(v8::DebugEvent event, Handle< JSObject > event_data, bool auto_continue)
Definition: debug.cc:2709
void FloodWithOneShot(Handle< JSFunction > function)
Definition: debug.cc:1197
void OnDebugBreak(Handle< Object > break_points_hit, bool auto_continue)
Definition: debug.cc:2580
bool SetBreakPoint(Handle< JSFunction > function, Handle< Object > break_point_object, int *source_position)
Definition: debug.cc:1075
void SetEventListener(Handle< Object > callback, Handle< Object > data)
Definition: debug.cc:2921
bool is_loaded() const
Definition: debug.h:466
void ClearBreakPoint(Handle< Object > break_point_object)
Definition: debug.cc:1150
bool SetBreakPointForScript(Handle< Script > script, Handle< Object > break_point_object, int *source_position, BreakPositionAlignment alignment)
Definition: debug.cc:1105
friend class DisableBreak
Definition: debug.h:648
bool IsDebugGlobal(GlobalObject *global)
Definition: debug.cc:2384
void ProcessDebugMessages(bool debug_command_only)
Definition: debug.cc:3057
bool in_debug_scope() const
Definition: debug.h:468
void ThreadInit()
Definition: debug.cc:554
void OnBeforeCompile(Handle< Script > script)
Definition: debug.cc:2600
void SetAfterBreakTarget(JavaScriptFrame *frame)
Definition: debug.cc:2239
Isolate * isolate_
Definition: debug.h:644
void PrepareStep(StepAction step_action, int step_count, StackFrame::Id frame_id)
Definition: debug.cc:1276
void OnPromiseReject(Handle< JSObject > promise, Handle< Object > value)
Definition: debug.cc:2521
Address after_break_target_address()
Definition: debug.h:481
void FloodHandlerWithOneShot()
Definition: debug.cc:1229
void OnPromiseEvent(Handle< JSObject > data)
Definition: debug.cc:2671
void set_live_edit_enabled(bool v)
Definition: debug.h:460
MUST_USE_RESULT MaybeHandle< Object > MakeCompileEvent(Handle< Script > script, v8::DebugEvent type)
Definition: debug.cc:2480
DebugInfoListNode * debug_info_list_
Definition: debug.h:587
static bool CompileDebuggerScript(Isolate *isolate, int index)
Definition: debug.cc:728
DISALLOW_COPY_AND_ASSIGN(Debug)
bool is_active() const
Definition: debug.h:465
void NotifyMessageHandler(v8::DebugEvent event, Handle< JSObject > exec_state, Handle< JSObject > event_data, bool auto_continue)
Definition: debug.cc:2785
Handle< Context > debug_context_
Definition: debug.h:567
static int ArchiveSpacePerThread()
Definition: debug.cc:586
void ClearStepping()
Definition: debug.cc:1643
char * RestoreDebug(char *from)
Definition: debug.cc:579
bool is_suppressed_
Definition: debug.h:579
MUST_USE_RESULT MaybeHandle< Object > MakePromiseEvent(Handle< JSObject > promise_event)
Definition: debug.cc:2490
void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, LiveEdit::FrameDropMode mode, Object **restarter_frame_function_pointer)
Definition: debug.cc:2372
Handle< Context > debug_context()
Definition: debug.h:459
base::Semaphore command_received_
Definition: debug.h:574
bool IsBreakOnException(ExceptionBreakType type)
Definition: debug.cc:1256
Handle< FixedArray > GetLoadedScripts()
Definition: debug.cc:2404
void CallEventCallback(v8::DebugEvent event, Handle< Object > exec_state, Handle< Object > event_data, v8::Debug::ClientData *client_data)
Definition: debug.cc:2748
MUST_USE_RESULT MaybeHandle< Object > MakeExceptionEvent(Handle< Object > exception, bool uncaught, Handle< Object > promise)
Definition: debug.cc:2468
static bool IsDebugBreak(Address addr)
Definition: debug.cc:1541
void ClearStepOut()
Definition: debug.cc:1692
bool IsBreakAtReturn(JavaScriptFrame *frame)
Definition: debug.cc:2329
Handle< Object > CheckBreakPoints(Handle< Object > break_point)
Definition: debug.cc:991
Debug(Isolate *isolate)
Definition: debug.cc:30
void EnqueueDebugCommand(v8::Debug::ClientData *client_data=NULL)
Definition: debug.cc:2995
bool StepNextContinue(BreakLocationIterator *break_location_iterator, JavaScriptFrame *frame)
Definition: debug.cc:1511
void set_disable_break(bool v)
Definition: debug.h:471
EventDetailsImpl(DebugEvent event, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< Object > callback_data, v8::Debug::ClientData *client_data)
Definition: debug.cc:3239
Handle< JSObject > event_data_
Definition: debug.h:266
Handle< Object > callback_data_
Definition: debug.h:267
virtual DebugEvent GetEvent() const
Event type.
Definition: debug.cc:3251
virtual v8::Handle< v8::Object > GetEventData() const
Definition: debug.cc:3261
virtual v8::Handle< v8::Object > GetExecutionState() const
Access to execution state and event data of the debug event.
Definition: debug.cc:3256
virtual v8::Handle< v8::Value > GetCallbackData() const
Client data passed with the corresponding callback when it was registered.
Definition: debug.cc:3271
virtual v8::Handle< v8::Context > GetEventContext() const
Get the context active when the debug event happened.
Definition: debug.cc:3266
virtual v8::Debug::ClientData * GetClientData() const
Client data passed to DebugBreakForCommand function.
Definition: debug.cc:3276
Handle< JSObject > exec_state_
Definition: debug.h:265
v8::Debug::ClientData * client_data_
Definition: debug.h:269
Context * context()
Definition: isolate.h:548
virtual bool WillStartRunning() const
Indicate whether this is a response to a continue command which will start the VM running after this ...
Definition: debug.cc:3180
virtual bool IsResponse() const
Definition: debug.cc:3170
virtual DebugEvent GetEvent() const
Definition: debug.cc:3175
virtual v8::Handle< v8::Object > GetEventData() const
Definition: debug.cc:3195
static MessageImpl NewResponse(DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< String > response_json, v8::Debug::ClientData *client_data)
Definition: debug.cc:3137
virtual v8::Debug::ClientData * GetClientData() const
Client data passed with the corresponding request if any.
Definition: debug.cc:3234
Handle< String > response_json_
Definition: debug.h:244
Handle< JSObject > event_data_
Definition: debug.h:243
virtual v8::Isolate * GetIsolate() const
Definition: debug.cc:3190
virtual v8::Handle< v8::Context > GetEventContext() const
Get the context active when the debug event happened.
Definition: debug.cc:3225
virtual v8::Handle< v8::Object > GetExecutionState() const
Access to execution state and event data.
Definition: debug.cc:3185
virtual v8::Handle< v8::String > GetJSON() const
Get the debugger protocol JSON.
Definition: debug.cc:3200
Handle< JSObject > exec_state_
Definition: debug.h:242
MessageImpl(bool is_event, DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< String > response_json, v8::Debug::ClientData *client_data)
Definition: debug.cc:3149
v8::Debug::ClientData * client_data_
Definition: debug.h:245
static MessageImpl NewEvent(DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data)
Definition: debug.cc:3127
virtual bool IsEvent() const
Check type of message.
Definition: debug.cc:3165
byte * pc() const
Definition: assembler.h:457
Mode rmode() const
Definition: assembler.h:459
virtual ~ScriptCache()
Definition: debug.h:154
Handle< FixedArray > GetScripts()
Definition: debug.cc:642
static void HandleWeakScript(const v8::WeakCallbackData< v8::Value, void > &data)
Definition: debug.cc:671
ScriptCache(Isolate *isolate)
Definition: debug.cc:591
static uint32_t Hash(int key)
Definition: debug.h:164
void Add(Handle< Script > script)
Definition: debug.cc:614
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205
#define MUST_USE_RESULT
Definition: macros.h:266
DECLARE_RUNTIME_FUNCTION(Debug_Break)
const Register fp
static const uint32_t kZeroHashSeed
Definition: utils.h:245
ExceptionBreakType
Definition: debug.h:45
@ BreakUncaughtException
Definition: debug.h:47
@ BreakException
Definition: debug.h:46
BreakPositionAlignment
Definition: debug.h:60
@ STATEMENT_ALIGNED
Definition: debug.h:61
@ BREAK_POSITION_ALIGNED
Definition: debug.h:62
byte * Address
Definition: globals.h:101
@ StepMin
Definition: debug.h:38
@ StepNext
Definition: debug.h:35
@ StepNone
Definition: debug.h:33
@ StepInMin
Definition: debug.h:39
@ StepIn
Definition: debug.h:36
@ StepOut
Definition: debug.h:34
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
Definition: utils.h:249
BreakLocatorType
Definition: debug.h:52
@ ALL_BREAK_LOCATIONS
Definition: debug.h:53
@ SOURCE_BREAK_LOCATIONS
Definition: debug.h:54
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
DebugEvent
Definition: v8-debug.h:16