V8 Project
v8::internal::Debug Class Reference

#include <debug.h>

+ Collaboration diagram for v8::internal::Debug:

Classes

class  ThreadLocal
 

Public Member Functions

void OnDebugBreak (Handle< Object > break_points_hit, bool auto_continue)
 
void OnThrow (Handle< Object > exception, bool uncaught)
 
void OnPromiseReject (Handle< JSObject > promise, Handle< Object > value)
 
void OnCompileError (Handle< Script > script)
 
void OnBeforeCompile (Handle< Script > script)
 
void OnAfterCompile (Handle< Script > script)
 
void OnPromiseEvent (Handle< JSObject > data)
 
void OnAsyncTaskEvent (Handle< JSObject > data)
 
void SetEventListener (Handle< Object > callback, Handle< Object > data)
 
void SetMessageHandler (v8::Debug::MessageHandler handler)
 
void EnqueueCommandMessage (Vector< const uint16_t > command, v8::Debug::ClientData *client_data=NULL)
 
void EnqueueDebugCommand (v8::Debug::ClientData *client_data=NULL)
 
MUST_USE_RESULT MaybeHandle< ObjectCall (Handle< JSFunction > fun, Handle< Object > data)
 
Handle< ContextGetDebugContext ()
 
void HandleDebugBreak ()
 
void ProcessDebugMessages (bool debug_command_only)
 
bool Load ()
 
void Break (Arguments args, JavaScriptFrame *)
 
void SetAfterBreakTarget (JavaScriptFrame *frame)
 
Handle< FixedArrayGetLoadedScripts ()
 
bool SetBreakPoint (Handle< JSFunction > function, Handle< Object > break_point_object, int *source_position)
 
bool SetBreakPointForScript (Handle< Script > script, Handle< Object > break_point_object, int *source_position, BreakPositionAlignment alignment)
 
void ClearBreakPoint (Handle< Object > break_point_object)
 
void ClearAllBreakPoints ()
 
void FloodWithOneShot (Handle< JSFunction > function)
 
void FloodBoundFunctionWithOneShot (Handle< JSFunction > function)
 
void FloodHandlerWithOneShot ()
 
void ChangeBreakOnException (ExceptionBreakType type, bool enable)
 
bool IsBreakOnException (ExceptionBreakType type)
 
void PrepareStep (StepAction step_action, int step_count, StackFrame::Id frame_id)
 
void ClearStepping ()
 
void ClearStepOut ()
 
bool IsStepping ()
 
bool StepNextContinue (BreakLocationIterator *break_location_iterator, JavaScriptFrame *frame)
 
bool StepInActive ()
 
void HandleStepIn (Handle< JSFunction > function, Handle< Object > holder, Address fp, bool is_constructor)
 
bool StepOutActive ()
 
void PrepareForBreakPoints ()
 
bool EnsureDebugInfo (Handle< SharedFunctionInfo > shared, Handle< JSFunction > function)
 
ObjectFindSharedFunctionInfoInScript (Handle< Script > script, int position)
 
bool IsDebugGlobal (GlobalObject *global)
 
bool IsBreakAtReturn (JavaScriptFrame *frame)
 
void FramesHaveBeenDropped (StackFrame::Id new_break_frame_id, LiveEdit::FrameDropMode mode, Object **restarter_frame_function_pointer)
 
char * ArchiveDebug (char *to)
 
char * RestoreDebug (char *from)
 
void FreeThreadResources ()
 
DebugScopedebugger_entry ()
 
Handle< Contextdebug_context ()
 
void set_live_edit_enabled (bool v)
 
bool live_edit_enabled () const
 
bool is_active () const
 
bool is_loaded () const
 
bool has_break_points () const
 
bool in_debug_scope () const
 
void set_disable_break (bool v)
 
StackFrame::Id break_frame_id ()
 
int break_id ()
 
Address is_active_address ()
 
Address after_break_target_address ()
 
Address restarter_frame_function_pointer_address ()
 
Address step_in_fp_addr ()
 

Static Public Member Functions

static Handle< DebugInfoGetDebugInfo (Handle< SharedFunctionInfo > shared)
 
static bool HasDebugInfo (Handle< SharedFunctionInfo > shared)
 
static bool IsDebugBreak (Address addr)
 
static bool IsDebugBreakAtReturn (RelocInfo *rinfo)
 
static Handle< ObjectGetSourceBreakLocations (Handle< SharedFunctionInfo > shared, BreakPositionAlignment position_aligment)
 
static void HandleWeakDebugInfo (const v8::WeakCallbackData< v8::Value, void > &data)
 
static int ArchiveSpacePerThread ()
 
static void RecordEvalCaller (Handle< Script > script)
 

Private Member Functions

 Debug (Isolate *isolate)
 
void UpdateState ()
 
void Unload ()
 
void SetNextBreakId ()
 
bool has_commands () const
 
bool ignore_events () const
 
void OnException (Handle< Object > exception, bool uncaught, Handle< Object > promise)
 
MUST_USE_RESULT MaybeHandle< ObjectMakeJSObject (const char *constructor_name, int argc, Handle< Object > argv[])
 
MUST_USE_RESULT MaybeHandle< ObjectMakeExecutionState ()
 
MUST_USE_RESULT MaybeHandle< ObjectMakeBreakEvent (Handle< Object > break_points_hit)
 
MUST_USE_RESULT MaybeHandle< ObjectMakeExceptionEvent (Handle< Object > exception, bool uncaught, Handle< Object > promise)
 
MUST_USE_RESULT MaybeHandle< ObjectMakeCompileEvent (Handle< Script > script, v8::DebugEvent type)
 
MUST_USE_RESULT MaybeHandle< ObjectMakePromiseEvent (Handle< JSObject > promise_event)
 
MUST_USE_RESULT MaybeHandle< ObjectMakeAsyncTaskEvent (Handle< JSObject > task_event)
 
void ClearMirrorCache ()
 
bool PromiseHasRejectHandler (Handle< JSObject > promise)
 
void CallEventCallback (v8::DebugEvent event, Handle< Object > exec_state, Handle< Object > event_data, v8::Debug::ClientData *client_data)
 
void ProcessDebugEvent (v8::DebugEvent event, Handle< JSObject > event_data, bool auto_continue)
 
void NotifyMessageHandler (v8::DebugEvent event, Handle< JSObject > exec_state, Handle< JSObject > event_data, bool auto_continue)
 
void InvokeMessageHandler (MessageImpl message)
 
void ClearOneShot ()
 
void ActivateStepIn (StackFrame *frame)
 
void ClearStepIn ()
 
void ActivateStepOut (StackFrame *frame)
 
void ClearStepNext ()
 
void RemoveDebugInfo (Handle< DebugInfo > debug_info)
 
Handle< ObjectCheckBreakPoints (Handle< Object > break_point)
 
bool CheckBreakPoint (Handle< Object > break_point_object)
 
void AssertDebugContext ()
 
void ThreadInit ()
 
 DISALLOW_COPY_AND_ASSIGN (Debug)
 

Static Private Member Functions

static bool CompileDebuggerScript (Isolate *isolate, int index)
 

Private Attributes

Handle< Contextdebug_context_
 
Handle< Objectevent_listener_
 
Handle< Objectevent_listener_data_
 
v8::Debug::MessageHandler message_handler_
 
base::Semaphore command_received_
 
LockingCommandMessageQueue command_queue_
 
LockingCommandMessageQueue event_command_queue_
 
bool is_active_
 
bool is_suppressed_
 
bool live_edit_enabled_
 
bool has_break_points_
 
bool break_disabled_
 
bool break_on_exception_
 
bool break_on_uncaught_exception_
 
ScriptCachescript_cache_
 
DebugInfoListNodedebug_info_list_
 
Address after_break_target_
 
ThreadLocal thread_local_
 
Isolateisolate_
 

Static Private Attributes

static const int kQueueInitialSize = 4
 

Friends

class Isolate
 
class DebugScope
 
class DisableBreak
 
class LiveEdit
 
class SuppressDebug
 
Handle< FixedArrayGetDebuggedFunctions ()
 
void CheckDebuggerUnloaded (bool check_functions)
 

Detailed Description

Definition at line 343 of file debug.h.

Constructor & Destructor Documentation

◆ Debug()

v8::internal::Debug::Debug ( Isolate isolate)
explicitprivate

Definition at line 30 of file debug.cc.

31  : debug_context_(Handle<Context>()),
32  event_listener_(Handle<Object>()),
33  event_listener_data_(Handle<Object>()),
36  command_queue_(isolate->logger(), kQueueInitialSize),
37  event_command_queue_(isolate->logger(), kQueueInitialSize),
38  is_active_(false),
39  is_suppressed_(false),
40  live_edit_enabled_(true), // TODO(yangguo): set to false by default.
41  has_break_points_(false),
42  break_disabled_(false),
43  break_on_exception_(false),
47  isolate_(isolate) {
48  ThreadInit();
49 }
bool has_break_points_
Definition: debug.h:581
bool break_disabled_
Definition: debug.h:582
Handle< Object > event_listener_data_
Definition: debug.h:569
static const int kQueueInitialSize
Definition: debug.h:573
ScriptCache * script_cache_
Definition: debug.h:586
LockingCommandMessageQueue event_command_queue_
Definition: debug.h:576
Handle< Object > event_listener_
Definition: debug.h:568
bool live_edit_enabled_
Definition: debug.h:580
v8::Debug::MessageHandler message_handler_
Definition: debug.h:571
LockingCommandMessageQueue command_queue_
Definition: debug.h:575
bool break_on_exception_
Definition: debug.h:583
bool break_on_uncaught_exception_
Definition: debug.h:584
void ThreadInit()
Definition: debug.cc:554
Isolate * isolate_
Definition: debug.h:644
DebugInfoListNode * debug_info_list_
Definition: debug.h:587
Handle< Context > debug_context_
Definition: debug.h:567
bool is_suppressed_
Definition: debug.h:579
base::Semaphore command_received_
Definition: debug.h:574
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

References ThreadInit().

+ Here is the call graph for this function:

Member Function Documentation

◆ ActivateStepIn()

void v8::internal::Debug::ActivateStepIn ( StackFrame frame)
private

Definition at line 1675 of file debug.cc.

1675  {
1676  DCHECK(!StepOutActive());
1677  thread_local_.step_into_fp_ = frame->UnpaddedFP();
1678 }
bool StepOutActive()
Definition: debug.h:407
ThreadLocal thread_local_
Definition: debug.h:642
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::Debug::ThreadLocal::step_into_fp_, StepOutActive(), and thread_local_.

Referenced by PrepareStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ActivateStepOut()

void v8::internal::Debug::ActivateStepOut ( StackFrame frame)
private

Definition at line 1686 of file debug.cc.

1686  {
1687  DCHECK(!StepInActive());
1688  thread_local_.step_out_fp_ = frame->UnpaddedFP();
1689 }
bool StepInActive()
Definition: debug.h:402

References DCHECK, v8::internal::Debug::ThreadLocal::step_out_fp_, StepInActive(), and thread_local_.

Referenced by PrepareStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ after_break_target_address()

Address v8::internal::Debug::after_break_target_address ( )
inline

Definition at line 481 of file debug.h.

481  {
482  return reinterpret_cast<Address>(&after_break_target_);
483  }
Address after_break_target_
Definition: debug.h:592
byte * Address
Definition: globals.h:101

References after_break_target_.

◆ ArchiveDebug()

char * v8::internal::Debug::ArchiveDebug ( char *  to)

Definition at line 571 of file debug.cc.

571  {
572  char* to = storage;
573  MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
574  ThreadInit();
575  return storage + ArchiveSpacePerThread();
576 }
static int ArchiveSpacePerThread()
Definition: debug.cc:586
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
void MemCopy(void *dest, const void *src, size_t size)
Definition: utils.h:350

References ArchiveSpacePerThread(), v8::internal::MemCopy(), thread_local_, ThreadInit(), and to().

Referenced by v8::internal::ThreadManager::EagerlyArchiveThread().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ArchiveSpacePerThread()

int v8::internal::Debug::ArchiveSpacePerThread ( )
static

Definition at line 586 of file debug.cc.

586  {
587  return sizeof(ThreadLocal);
588 }

Referenced by ArchiveDebug(), v8::internal::ArchiveSpacePerThread(), and RestoreDebug().

+ Here is the caller graph for this function:

◆ AssertDebugContext()

void v8::internal::Debug::AssertDebugContext ( )
inlineprivate

Definition at line 559 of file debug.h.

559  {
562  }
bool in_debug_scope() const
Definition: debug.h:468
Handle< Context > debug_context()
Definition: debug.h:459
Context * context()
Definition: isolate.h:548

References v8::internal::Isolate::context(), DCHECK, debug_context(), in_debug_scope(), and isolate_.

Referenced by ClearMirrorCache(), MakeJSObject(), and OnDebugBreak().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Break()

void v8::internal::Debug::Break ( Arguments  args,
JavaScriptFrame frame 
)

Definition at line 866 of file debug.cc.

866  {
867  Heap* heap = isolate_->heap();
868  HandleScope scope(isolate_);
869  DCHECK(args.length() == 0);
870 
871  // Initialize LiveEdit.
873 
874  // Just continue if breaks are disabled or debugger cannot be loaded.
875  if (break_disabled_) return;
876 
877  // Enter the debugger.
878  DebugScope debug_scope(this);
879  if (debug_scope.failed()) return;
880 
881  // Postpone interrupt during breakpoint processing.
882  PostponeInterruptsScope postpone(isolate_);
883 
884  // Get the debug info (create it if it does not exist).
885  Handle<SharedFunctionInfo> shared =
886  Handle<SharedFunctionInfo>(frame->function()->shared());
887  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
888 
889  // Find the break point where execution has stopped.
890  BreakLocationIterator break_location_iterator(debug_info,
892  // pc points to the instruction after the current one, possibly a break
893  // location as well. So the "- 1" to exclude it from the search.
894  break_location_iterator.FindBreakLocationFromAddress(frame->pc() - 1);
895 
896  // Check whether step next reached a new statement.
897  if (!StepNextContinue(&break_location_iterator, frame)) {
898  // Decrease steps left if performing multiple steps.
899  if (thread_local_.step_count_ > 0) {
901  }
902  }
903 
904  // If there is one or more real break points check whether any of these are
905  // triggered.
906  Handle<Object> break_points_hit(heap->undefined_value(), isolate_);
907  if (break_location_iterator.HasBreakPoint()) {
908  Handle<Object> break_point_objects =
909  Handle<Object>(break_location_iterator.BreakPointObjects(), isolate_);
910  break_points_hit = CheckBreakPoints(break_point_objects);
911  }
912 
913  // If step out is active skip everything until the frame where we need to step
914  // out to is reached, unless real breakpoint is hit.
915  if (StepOutActive() &&
916  frame->fp() != thread_local_.step_out_fp_ &&
917  break_points_hit->IsUndefined() ) {
918  // Step count should always be 0 for StepOut.
920  } else if (!break_points_hit->IsUndefined() ||
922  thread_local_.step_count_ == 0)) {
923  // Notify debugger if a real break point is triggered or if performing
924  // single stepping with no more steps to perform. Otherwise do another step.
925 
926  // Clear all current stepping setup.
927  ClearStepping();
928 
930  // Perform queued steps
931  int step_count = thread_local_.queued_step_count_;
932 
933  // Clear queue
935 
936  PrepareStep(StepNext, step_count, StackFrame::NO_ID);
937  } else {
938  // Notify the debug event listeners.
939  OnDebugBreak(break_points_hit, false);
940  }
941  } else if (thread_local_.last_step_action_ != StepNone) {
942  // Hold on to last step action as it is cleared by the call to
943  // ClearStepping.
945  int step_count = thread_local_.step_count_;
946 
947  // If StepNext goes deeper in code, StepOut until original frame
948  // and keep step count queued up in the meantime.
949  if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) {
950  // Count frames until target frame
951  int count = 0;
952  JavaScriptFrameIterator it(isolate_);
953  while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) {
954  count++;
955  it.Advance();
956  }
957 
958  // Check that we indeed found the frame we are looking for.
959  CHECK(!it.done() && (it.frame()->fp() == thread_local_.last_fp_));
960  if (step_count > 1) {
961  // Save old count and action to continue stepping after StepOut.
962  thread_local_.queued_step_count_ = step_count - 1;
963  }
964 
965  // Set up for StepOut to reach target frame.
966  step_action = StepOut;
967  step_count = count;
968  }
969 
970  // Clear all current stepping setup.
971  ClearStepping();
972 
973  // Set up for the remaining steps.
974  PrepareStep(step_action, step_count, StackFrame::NO_ID);
975  }
976 }
friend class DebugScope
Definition: debug.h:647
static Handle< DebugInfo > GetDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1069
void OnDebugBreak(Handle< Object > break_points_hit, bool auto_continue)
Definition: debug.cc:2580
void PrepareStep(StepAction step_action, int step_count, StackFrame::Id frame_id)
Definition: debug.cc:1276
void ClearStepping()
Definition: debug.cc:1643
Handle< Object > CheckBreakPoints(Handle< Object > break_point)
Definition: debug.cc:991
bool StepNextContinue(BreakLocationIterator *break_location_iterator, JavaScriptFrame *frame)
Definition: debug.cc:1511
static void InitializeThreadLocal(Debug *debug)
Definition: liveedit.cc:808
#define CHECK(condition)
Definition: logging.h:36
@ StepNext
Definition: debug.h:35
@ StepNone
Definition: debug.h:33
@ StepOut
Definition: debug.h:34
@ ALL_BREAK_LOCATIONS
Definition: debug.h:53

References v8::internal::ALL_BREAK_LOCATIONS, break_disabled_, v8::internal::BreakLocationIterator::BreakPointObjects(), CHECK, CheckBreakPoints(), ClearStepping(), DCHECK, DebugScope, v8::internal::BreakLocationIterator::FindBreakLocationFromAddress(), v8::internal::JavaScriptFrame::function(), GetDebugInfo(), v8::internal::BreakLocationIterator::HasBreakPoint(), v8::internal::Isolate::heap(), v8::internal::LiveEdit::InitializeThreadLocal(), isolate_, v8::internal::Debug::ThreadLocal::last_fp_, v8::internal::Debug::ThreadLocal::last_step_action_, OnDebugBreak(), PrepareStep(), v8::internal::Debug::ThreadLocal::queued_step_count_, v8::internal::Debug::ThreadLocal::step_count_, v8::internal::Debug::ThreadLocal::step_out_fp_, v8::internal::StepNext, StepNextContinue(), v8::internal::StepNone, v8::internal::StepOut, StepOutActive(), and thread_local_.

+ Here is the call graph for this function:

◆ break_frame_id()

StackFrame::Id v8::internal::Debug::break_frame_id ( )
inline

Definition at line 473 of file debug.h.

473 { return thread_local_.break_frame_id_; }
StackFrame::Id break_frame_id_
Definition: debug.h:607

References v8::internal::Debug::ThreadLocal::break_frame_id_, and thread_local_.

Referenced by v8::internal::DropActivationsInActiveThreadImpl(), FloodHandlerWithOneShot(), and PrepareStep().

+ Here is the caller graph for this function:

◆ break_id()

int v8::internal::Debug::break_id ( )
inline

Definition at line 474 of file debug.h.

References v8::internal::Debug::ThreadLocal::break_id_, and thread_local_.

Referenced by CheckBreakPoint(), v8::internal::CheckExecutionState(), MakeBreakEvent(), MakeExceptionEvent(), and MakeExecutionState().

+ Here is the caller graph for this function:

◆ Call()

MaybeHandle< Object > v8::internal::Debug::Call ( Handle< JSFunction fun,
Handle< Object data 
)

Definition at line 3004 of file debug.cc.

3004  {
3005  DebugScope debug_scope(this);
3006  if (debug_scope.failed()) return isolate_->factory()->undefined_value();
3007 
3008  // Create the execution state.
3009  Handle<Object> exec_state;
3010  if (!MakeExecutionState().ToHandle(&exec_state)) {
3011  return isolate_->factory()->undefined_value();
3012  }
3013 
3014  Handle<Object> argv[] = { exec_state, data };
3015  return Execution::Call(
3016  isolate_,
3017  fun,
3018  Handle<Object>(debug_context()->global_proxy(), isolate_),
3019  arraysize(argv),
3020  argv);
3021 }
MUST_USE_RESULT MaybeHandle< Object > MakeExecutionState()
Definition: debug.cc:2453
Factory * factory()
Definition: isolate.h:982
#define arraysize(array)
Definition: macros.h:86

References arraysize, debug_context(), DebugScope, v8::internal::Isolate::factory(), isolate_, and MakeExecutionState().

Referenced by v8::Debug::Call().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CallEventCallback()

void v8::internal::Debug::CallEventCallback ( v8::DebugEvent  event,
Handle< Object exec_state,
Handle< Object event_data,
v8::Debug::ClientData client_data 
)
private

Definition at line 2748 of file debug.cc.

2751  {
2752  if (event_listener_->IsForeign()) {
2753  // Invoke the C debug event listener.
2754  v8::Debug::EventCallback callback =
2755  FUNCTION_CAST<v8::Debug::EventCallback>(
2756  Handle<Foreign>::cast(event_listener_)->foreign_address());
2757  EventDetailsImpl event_details(event,
2758  Handle<JSObject>::cast(exec_state),
2759  Handle<JSObject>::cast(event_data),
2761  client_data);
2762  callback(event_details);
2764  } else {
2765  // Invoke the JavaScript debug event listener.
2766  DCHECK(event_listener_->IsJSFunction());
2767  Handle<Object> argv[] = { Handle<Object>(Smi::FromInt(event), isolate_),
2768  exec_state,
2769  event_data,
2771  Handle<JSReceiver> global(isolate_->global_proxy());
2772  Execution::TryCall(Handle<JSFunction>::cast(event_listener_),
2773  global, arraysize(argv), argv);
2774  }
2775 }
void(* EventCallback)(const EventDetails &event_details)
Debug event callback function.
Definition: v8-debug.h:142
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
bool has_scheduled_exception()
Definition: isolate.h:627
JSObject * global_proxy()
Definition: isolate.h:675
static Smi * FromInt(int value)
Definition: objects-inl.h:1321

References arraysize, DCHECK, event_listener_, event_listener_data_, v8::internal::Smi::FromInt(), v8::internal::Isolate::global_proxy(), v8::internal::Isolate::has_scheduled_exception(), and isolate_.

Referenced by ProcessDebugEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeBreakOnException()

void v8::internal::Debug::ChangeBreakOnException ( ExceptionBreakType  type,
bool  enable 
)

Definition at line 1247 of file debug.cc.

1247  {
1248  if (type == BreakUncaughtException) {
1250  } else {
1251  break_on_exception_ = enable;
1252  }
1253 }
@ BreakUncaughtException
Definition: debug.h:47

References break_on_exception_, break_on_uncaught_exception_, and v8::internal::BreakUncaughtException.

◆ CheckBreakPoint()

bool v8::internal::Debug::CheckBreakPoint ( Handle< Object break_point_object)
private

Definition at line 1027 of file debug.cc.

1027  {
1028  Factory* factory = isolate_->factory();
1029  HandleScope scope(isolate_);
1030 
1031  // Ignore check if break point object is not a JSObject.
1032  if (!break_point_object->IsJSObject()) return true;
1033 
1034  // Get the function IsBreakPointTriggered (defined in debug-debugger.js).
1035  Handle<String> is_break_point_triggered_string =
1036  factory->InternalizeOneByteString(
1037  STATIC_CHAR_VECTOR("IsBreakPointTriggered"));
1038  Handle<GlobalObject> debug_global(debug_context()->global_object());
1039  Handle<JSFunction> check_break_point =
1041  debug_global, is_break_point_triggered_string).ToHandleChecked());
1042 
1043  // Get the break id as an object.
1044  Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id());
1045 
1046  // Call HandleBreakPointx.
1047  Handle<Object> argv[] = { break_id, break_point_object };
1048  Handle<Object> result;
1049  if (!Execution::TryCall(check_break_point,
1051  arraysize(argv),
1052  argv).ToHandle(&result)) {
1053  return false;
1054  }
1055 
1056  // Return whether the break point is triggered.
1057  return result->IsTrue();
1058 }
Handle< JSBuiltinsObject > js_builtins_object()
Definition: isolate.h:679
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109
#define STATIC_CHAR_VECTOR(x)
Definition: vector.h:154

References arraysize, break_id(), v8::internal::Handle< T >::cast(), debug_context(), v8::internal::Isolate::factory(), v8::internal::Object::GetProperty(), isolate_, v8::internal::Isolate::js_builtins_object(), and STATIC_CHAR_VECTOR.

Referenced by CheckBreakPoints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckBreakPoints()

Handle< Object > v8::internal::Debug::CheckBreakPoints ( Handle< Object break_point)
private

Definition at line 991 of file debug.cc.

991  {
992  Factory* factory = isolate_->factory();
993 
994  // Count the number of break points hit. If there are multiple break points
995  // they are in a FixedArray.
996  Handle<FixedArray> break_points_hit;
997  int break_points_hit_count = 0;
998  DCHECK(!break_point_objects->IsUndefined());
999  if (break_point_objects->IsFixedArray()) {
1000  Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
1001  break_points_hit = factory->NewFixedArray(array->length());
1002  for (int i = 0; i < array->length(); i++) {
1003  Handle<Object> o(array->get(i), isolate_);
1004  if (CheckBreakPoint(o)) {
1005  break_points_hit->set(break_points_hit_count++, *o);
1006  }
1007  }
1008  } else {
1009  break_points_hit = factory->NewFixedArray(1);
1010  if (CheckBreakPoint(break_point_objects)) {
1011  break_points_hit->set(break_points_hit_count++, *break_point_objects);
1012  }
1013  }
1014 
1015  // Return undefined if no break points were triggered.
1016  if (break_points_hit_count == 0) {
1017  return factory->undefined_value();
1018  }
1019  // Return break points hit as a JSArray.
1020  Handle<JSArray> result = factory->NewJSArrayWithElements(break_points_hit);
1021  result->set_length(Smi::FromInt(break_points_hit_count));
1022  return result;
1023 }
bool CheckBreakPoint(Handle< Object > break_point_object)
Definition: debug.cc:1027

References CheckBreakPoint(), DCHECK, v8::internal::Isolate::factory(), v8::internal::Smi::FromInt(), and isolate_.

Referenced by Break().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearAllBreakPoints()

void v8::internal::Debug::ClearAllBreakPoints ( )

Definition at line 1181 of file debug.cc.

1181  {
1182  DebugInfoListNode* node = debug_info_list_;
1183  while (node != NULL) {
1184  // Remove all debug break code.
1185  BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
1186  it.ClearAllDebugBreak();
1187  node = node->next();
1188  }
1189 
1190  // Remove all debug info.
1191  while (debug_info_list_ != NULL) {
1193  }
1194 }
Handle< DebugInfo > debug_info()
Definition: debug.h:188
void RemoveDebugInfo(Handle< DebugInfo > debug_info)
Definition: debug.cc:2208

References v8::internal::ALL_BREAK_LOCATIONS, v8::internal::BreakLocationIterator::ClearAllDebugBreak(), v8::internal::DebugInfoListNode::debug_info(), debug_info_list_, v8::internal::DebugInfoListNode::next(), NULL, and RemoveDebugInfo().

Referenced by Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearBreakPoint()

void v8::internal::Debug::ClearBreakPoint ( Handle< Object break_point_object)

Definition at line 1150 of file debug.cc.

1150  {
1151  HandleScope scope(isolate_);
1152 
1153  DebugInfoListNode* node = debug_info_list_;
1154  while (node != NULL) {
1155  Object* result = DebugInfo::FindBreakPointInfo(node->debug_info(),
1156  break_point_object);
1157  if (!result->IsUndefined()) {
1158  // Get information in the break point.
1159  BreakPointInfo* break_point_info = BreakPointInfo::cast(result);
1160  Handle<DebugInfo> debug_info = node->debug_info();
1161 
1162  // Find the break point and clear it.
1163  BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1164  it.FindBreakLocationFromAddress(debug_info->code()->entry() +
1165  break_point_info->code_position()->value());
1166  it.ClearBreakPoint(break_point_object);
1167 
1168  // If there are no more break points left remove the debug info for this
1169  // function.
1170  if (debug_info->GetBreakPointCount() == 0) {
1171  RemoveDebugInfo(debug_info);
1172  }
1173 
1174  return;
1175  }
1176  node = node->next();
1177  }
1178 }
static Object * FindBreakPointInfo(Handle< DebugInfo > debug_info, Handle< Object > break_point_object)
Definition: objects.cc:15983
kSerializedDataOffset Object
Definition: objects-inl.h:5322
@ SOURCE_BREAK_LOCATIONS
Definition: debug.h:54

References v8::internal::BreakLocationIterator::ClearBreakPoint(), v8::internal::DebugInfoListNode::debug_info(), debug_info_list_, v8::internal::BreakLocationIterator::FindBreakLocationFromAddress(), v8::internal::DebugInfo::FindBreakPointInfo(), isolate_, v8::internal::DebugInfoListNode::next(), NULL, RemoveDebugInfo(), and v8::internal::SOURCE_BREAK_LOCATIONS.

+ Here is the call graph for this function:

◆ ClearMirrorCache()

void v8::internal::Debug::ClearMirrorCache ( )
private

Definition at line 2389 of file debug.cc.

2389  {
2390  PostponeInterruptsScope postpone(isolate_);
2391  HandleScope scope(isolate_);
2393  Factory* factory = isolate_->factory();
2394  Handle<GlobalObject> global(isolate_->global_object());
2395  JSObject::SetProperty(global,
2396  factory->NewStringFromAsciiChecked("next_handle_"),
2397  handle(Smi::FromInt(0), isolate_), SLOPPY).Check();
2398  JSObject::SetProperty(global,
2399  factory->NewStringFromAsciiChecked("mirror_cache_"),
2400  factory->NewJSArray(0, FAST_ELEMENTS), SLOPPY).Check();
2401 }
void AssertDebugContext()
Definition: debug.h:559
Handle< GlobalObject > global_object()
Definition: isolate.h:670
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References AssertDebugContext(), v8::internal::Isolate::factory(), v8::internal::FAST_ELEMENTS, v8::internal::Smi::FromInt(), v8::internal::Isolate::global_object(), v8::internal::handle(), isolate_, v8::internal::Object::SetProperty(), and v8::internal::SLOPPY.

+ Here is the call graph for this function:

◆ ClearOneShot()

void v8::internal::Debug::ClearOneShot ( )
private

Definition at line 1658 of file debug.cc.

1658  {
1659  // The current implementation just runs through all the breakpoints. When the
1660  // last break point for a function is removed that function is automatically
1661  // removed from the list.
1662 
1663  DebugInfoListNode* node = debug_info_list_;
1664  while (node != NULL) {
1665  BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
1666  while (!it.Done()) {
1667  it.ClearOneShot();
1668  it.Next();
1669  }
1670  node = node->next();
1671  }
1672 }

References v8::internal::ALL_BREAK_LOCATIONS, v8::internal::BreakLocationIterator::ClearOneShot(), v8::internal::DebugInfoListNode::debug_info(), debug_info_list_, v8::internal::BreakLocationIterator::Done(), v8::internal::BreakLocationIterator::Next(), v8::internal::DebugInfoListNode::next(), and NULL.

Referenced by ClearStepping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearStepIn()

void v8::internal::Debug::ClearStepIn ( )
private

Definition at line 1681 of file debug.cc.

1681  {
1683 }

References v8::internal::Debug::ThreadLocal::step_into_fp_, and thread_local_.

Referenced by ClearStepping().

+ Here is the caller graph for this function:

◆ ClearStepNext()

void v8::internal::Debug::ClearStepNext ( )
private

Definition at line 1697 of file debug.cc.

References v8::internal::RelocInfo::kNoPosition, v8::internal::Debug::ThreadLocal::last_fp_, v8::internal::Debug::ThreadLocal::last_statement_position_, v8::internal::Debug::ThreadLocal::last_step_action_, v8::internal::StepNone, and thread_local_.

Referenced by ClearStepping().

+ Here is the caller graph for this function:

◆ ClearStepOut()

void v8::internal::Debug::ClearStepOut ( )

Definition at line 1692 of file debug.cc.

1692  {
1694 }

References v8::internal::Debug::ThreadLocal::step_out_fp_, and thread_local_.

Referenced by ClearStepping(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the caller graph for this function:

◆ ClearStepping()

void v8::internal::Debug::ClearStepping ( )

Definition at line 1643 of file debug.cc.

1643  {
1644  // Clear the various stepping setup.
1645  ClearOneShot();
1646  ClearStepIn();
1647  ClearStepOut();
1648  ClearStepNext();
1649 
1650  // Clear multiple step counter.
1652 }
void ClearStepNext()
Definition: debug.cc:1697
void ClearStepIn()
Definition: debug.cc:1681
void ClearOneShot()
Definition: debug.cc:1658
void ClearStepOut()
Definition: debug.cc:1692

References ClearOneShot(), ClearStepIn(), ClearStepNext(), ClearStepOut(), v8::internal::Debug::ThreadLocal::step_count_, and thread_local_.

Referenced by Break(), v8::internal::DebugEvaluate(), v8::internal::Invoke(), OnException(), and Unload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompileDebuggerScript()

bool v8::internal::Debug::CompileDebuggerScript ( Isolate isolate,
int  index 
)
staticprivate

Definition at line 728 of file debug.cc.

728  {
729  Factory* factory = isolate->factory();
730  HandleScope scope(isolate);
731 
732  // Bail out if the index is invalid.
733  if (index == -1) return false;
734 
735  // Find source and name for the requested script.
736  Handle<String> source_code =
737  isolate->bootstrapper()->NativesSourceLookup(index);
738  Vector<const char> name = Natives::GetScriptName(index);
739  Handle<String> script_name =
740  factory->NewStringFromAscii(name).ToHandleChecked();
741  Handle<Context> context = isolate->native_context();
742 
743  // Compile the script.
744  Handle<SharedFunctionInfo> function_info;
745  function_info = Compiler::CompileScript(
746  source_code, script_name, 0, 0, false, context, NULL, NULL,
748 
749  // Silently ignore stack overflows during compilation.
750  if (function_info.is_null()) {
751  DCHECK(isolate->has_pending_exception());
752  isolate->clear_pending_exception();
753  return false;
754  }
755 
756  // Execute the shared function in the debugger context.
757  Handle<JSFunction> function =
758  factory->NewFunctionFromSharedFunctionInfo(function_info, context);
759 
760  MaybeHandle<Object> maybe_exception;
761  MaybeHandle<Object> result = Execution::TryCall(
762  function, handle(context->global_proxy()), 0, NULL, &maybe_exception);
763 
764  // Check for caught exceptions.
765  if (result.is_null()) {
766  DCHECK(!isolate->has_pending_exception());
767  MessageLocation computed_location;
768  isolate->ComputeLocation(&computed_location);
769  Handle<Object> message = MessageHandler::MakeMessageObject(
770  isolate, "error_loading_debugger", &computed_location,
771  Vector<Handle<Object> >::empty(), Handle<JSArray>());
772  DCHECK(!isolate->has_pending_exception());
773  Handle<Object> exception;
774  if (maybe_exception.ToHandle(&exception)) {
775  isolate->set_pending_exception(*exception);
776  MessageHandler::ReportMessage(isolate, NULL, message);
777  isolate->clear_pending_exception();
778  }
779  return false;
780  }
781 
782  // Mark this script as native and return successfully.
783  Handle<Script> script(Script::cast(function->shared()->script()));
784  script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
785  return true;
786 }
@ kNoCompileOptions
Definition: v8.h:1160
static Handle< SharedFunctionInfo > CompileScript(Handle< String > source, Handle< Object > script_name, int line_offset, int column_offset, bool is_shared_cross_origin, Handle< Context > context, v8::Extension *extension, ScriptData **cached_data, ScriptCompiler::CompileOptions compile_options, NativesFlag is_natives_code)
Definition: compiler.cc:1134
static void ReportMessage(Isolate *isolate, MessageLocation *loc, Handle< Object > message)
Definition: messages.cc:77
static Handle< JSMessageObject > MakeMessageObject(Isolate *isolate, const char *type, MessageLocation *loc, Vector< Handle< Object > > args, Handle< JSArray > stack_frames)
Definition: messages.cc:36
static Vector< const char > GetScriptName(int index)
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 name
@ NATIVES_CODE
Definition: globals.h:401

References v8::internal::Isolate::bootstrapper(), v8::internal::Isolate::clear_pending_exception(), v8::internal::Compiler::CompileScript(), v8::internal::Isolate::ComputeLocation(), DCHECK, v8::internal::Isolate::factory(), v8::internal::Smi::FromInt(), v8::internal::NativesCollection< type >::GetScriptName(), v8::internal::handle(), v8::internal::Isolate::has_pending_exception(), v8::internal::MaybeHandle< T >::is_null(), v8::internal::Handle< T >::is_null(), v8::ScriptCompiler::kNoCompileOptions, v8::internal::MessageHandler::MakeMessageObject(), name, v8::internal::Isolate::native_context(), v8::internal::NATIVES_CODE, NULL, v8::internal::MessageHandler::ReportMessage(), v8::internal::Isolate::set_pending_exception(), and v8::internal::Script::TYPE_NATIVE.

Referenced by Load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debug_context()

Handle<Context> v8::internal::Debug::debug_context ( )
inline

Definition at line 459 of file debug.h.

459 { return debug_context_; }

References debug_context_.

Referenced by AssertDebugContext(), Call(), CheckBreakPoint(), v8::internal::CheckExecutionState(), v8::internal::Isolate::GetCallingNativeContext(), GetDebugContext(), v8::Debug::GetMirror(), v8::Shell::InstallUtilityScript(), IsDebugGlobal(), MakeJSObject(), and OnAfterCompile().

+ Here is the caller graph for this function:

◆ debugger_entry()

DebugScope* v8::internal::Debug::debugger_entry ( )
inline

Definition at line 458 of file debug.h.

DebugScope * current_debug_scope_
Definition: debug.h:598

References v8::internal::Debug::ThreadLocal::current_debug_scope_, and thread_local_.

Referenced by v8::internal::GetDebugEventContext().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::Debug::DISALLOW_COPY_AND_ASSIGN ( Debug  )
private

◆ EnqueueCommandMessage()

void v8::internal::Debug::EnqueueCommandMessage ( Vector< const uint16_t >  command,
v8::Debug::ClientData client_data = NULL 
)

Definition at line 2979 of file debug.cc.

2980  {
2981  // Need to cast away const.
2982  CommandMessage message = CommandMessage::New(
2983  Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
2984  command.length()),
2985  client_data);
2986  isolate_->logger()->DebugTag("Put command on command_queue.");
2987  command_queue_.Put(message);
2988  command_received_.Signal();
2989 
2990  // Set the debug command break flag to have the command processed.
2991  if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand();
2992 }
static CommandMessage New(const Vector< uint16_t > &command, v8::Debug::ClientData *data)
Definition: debug.cc:3300
StackGuard * stack_guard()
Definition: isolate.h:872
Logger * logger()
Definition: isolate.h:866
void DebugTag(const char *call_site_tag)
Definition: log.cc:1496
unsigned short uint16_t
Definition: unicode.cc:23

References command_queue_, command_received_, v8::internal::Logger::DebugTag(), in_debug_scope(), isolate_, v8::internal::Vector< T >::length(), v8::internal::Isolate::logger(), v8::internal::CommandMessage::New(), v8::internal::Isolate::stack_guard(), and v8::internal::Vector< T >::start().

Referenced by v8::Debug::SendCommand(), and SetMessageHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnqueueDebugCommand()

void v8::internal::Debug::EnqueueDebugCommand ( v8::Debug::ClientData client_data = NULL)

Definition at line 2995 of file debug.cc.

2995  {
2996  CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
2997  event_command_queue_.Put(message);
2998 
2999  // Set the debug command break flag to have the command processed.
3000  if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand();
3001 }

References event_command_queue_, in_debug_scope(), isolate_, v8::internal::CommandMessage::New(), and v8::internal::Isolate::stack_guard().

Referenced by v8::Debug::DebugBreakForCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureDebugInfo()

bool v8::internal::Debug::EnsureDebugInfo ( Handle< SharedFunctionInfo shared,
Handle< JSFunction function 
)

Definition at line 2177 of file debug.cc.

2178  {
2179  Isolate* isolate = shared->GetIsolate();
2180 
2181  // Return if we already have the debug info for shared.
2182  if (HasDebugInfo(shared)) {
2183  DCHECK(shared->is_compiled());
2184  return true;
2185  }
2186 
2187  // There will be at least one break point when we are done.
2188  has_break_points_ = true;
2189 
2190  // Ensure function is compiled. Return false if this failed.
2191  if (!function.is_null() &&
2193  return false;
2194  }
2195 
2196  // Create the debug info object.
2197  Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);
2198 
2199  // Add debug info to the list.
2200  DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
2201  node->set_next(debug_info_list_);
2202  debug_info_list_ = node;
2203 
2204  return true;
2205 }
static bool EnsureCompiled(Handle< JSFunction > function, ClearExceptionFlag flag)
Definition: compiler.cc:876
static bool HasDebugInfo(Handle< SharedFunctionInfo > shared)
Definition: debug.cc:1062
friend class Isolate
Definition: debug.h:646
@ CLEAR_EXCEPTION
Definition: globals.h:762

References v8::internal::CLEAR_EXCEPTION, DCHECK, debug_info_list_, v8::internal::Compiler::EnsureCompiled(), v8::internal::Isolate::factory(), has_break_points_, HasDebugInfo(), and v8::internal::DebugInfoListNode::set_next().

Referenced by FloodWithOneShot(), IsBreakAtReturn(), PrepareStep(), v8::internal::ScopeIterator::ScopeIterator(), SetAfterBreakTarget(), SetBreakPoint(), and SetBreakPointForScript().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindSharedFunctionInfoInScript()

Object * v8::internal::Debug::FindSharedFunctionInfoInScript ( Handle< Script script,
int  position 
)

Definition at line 2071 of file debug.cc.

2072  {
2073  // Iterate the heap looking for SharedFunctionInfo generated from the
2074  // script. The inner most SharedFunctionInfo containing the source position
2075  // for the requested break point is found.
2076  // NOTE: This might require several heap iterations. If the SharedFunctionInfo
2077  // which is found is not compiled it is compiled and the heap is iterated
2078  // again as the compilation might create inner functions from the newly
2079  // compiled function and the actual requested break point might be in one of
2080  // these functions.
2081  // NOTE: The below fix-point iteration depends on all functions that cannot be
2082  // compiled lazily without a context to not be compiled at all. Compilation
2083  // will be triggered at points where we do not need a context.
2084  bool done = false;
2085  // The current candidate for the source position:
2086  int target_start_position = RelocInfo::kNoPosition;
2087  Handle<JSFunction> target_function;
2088  Handle<SharedFunctionInfo> target;
2089  Heap* heap = isolate_->heap();
2090  while (!done) {
2091  { // Extra scope for iterator.
2092  HeapIterator iterator(heap);
2093  for (HeapObject* obj = iterator.next();
2094  obj != NULL; obj = iterator.next()) {
2095  bool found_next_candidate = false;
2096  Handle<JSFunction> function;
2097  Handle<SharedFunctionInfo> shared;
2098  if (obj->IsJSFunction()) {
2099  function = Handle<JSFunction>(JSFunction::cast(obj));
2100  shared = Handle<SharedFunctionInfo>(function->shared());
2101  DCHECK(shared->allows_lazy_compilation() || shared->is_compiled());
2102  found_next_candidate = true;
2103  } else if (obj->IsSharedFunctionInfo()) {
2104  shared = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(obj));
2105  // Skip functions that we cannot compile lazily without a context,
2106  // which is not available here, because there is no closure.
2107  found_next_candidate = shared->is_compiled() ||
2108  shared->allows_lazy_compilation_without_context();
2109  }
2110  if (!found_next_candidate) continue;
2111  if (shared->script() == *script) {
2112  // If the SharedFunctionInfo found has the requested script data and
2113  // contains the source position it is a candidate.
2114  int start_position = shared->function_token_position();
2115  if (start_position == RelocInfo::kNoPosition) {
2116  start_position = shared->start_position();
2117  }
2118  if (start_position <= position &&
2119  position <= shared->end_position()) {
2120  // If there is no candidate or this function is within the current
2121  // candidate this is the new candidate.
2122  if (target.is_null()) {
2123  target_start_position = start_position;
2124  target_function = function;
2125  target = shared;
2126  } else {
2127  if (target_start_position == start_position &&
2128  shared->end_position() == target->end_position()) {
2129  // If a top-level function contains only one function
2130  // declaration the source for the top-level and the function
2131  // is the same. In that case prefer the non top-level function.
2132  if (!shared->is_toplevel()) {
2133  target_start_position = start_position;
2134  target_function = function;
2135  target = shared;
2136  }
2137  } else if (target_start_position <= start_position &&
2138  shared->end_position() <= target->end_position()) {
2139  // This containment check includes equality as a function
2140  // inside a top-level function can share either start or end
2141  // position with the top-level function.
2142  target_start_position = start_position;
2143  target_function = function;
2144  target = shared;
2145  }
2146  }
2147  }
2148  }
2149  } // End for loop.
2150  } // End no-allocation scope.
2151 
2152  if (target.is_null()) return heap->undefined_value();
2153 
2154  // There will be at least one break point when we are done.
2155  has_break_points_ = true;
2156 
2157  // If the candidate found is compiled we are done.
2158  done = target->is_compiled();
2159  if (!done) {
2160  // If the candidate is not compiled, compile it to reveal any inner
2161  // functions which might contain the requested source position. This
2162  // will compile all inner functions that cannot be compiled without a
2163  // context, because Compiler::BuildFunctionInfo checks whether the
2164  // debugger is active.
2165  MaybeHandle<Code> maybe_result = target_function.is_null()
2167  : Compiler::GetUnoptimizedCode(target_function);
2168  if (maybe_result.is_null()) return isolate_->heap()->undefined_value();
2169  }
2170  } // End while loop.
2171 
2172  return *target;
2173 }
static MUST_USE_RESULT MaybeHandle< Code > GetUnoptimizedCode(Handle< JSFunction > function)
Definition: compiler.cc:805

References DCHECK, v8::internal::Compiler::GetUnoptimizedCode(), has_break_points_, v8::internal::Isolate::heap(), v8::internal::MaybeHandle< T >::is_null(), v8::internal::Handle< T >::is_null(), isolate_, v8::internal::RelocInfo::kNoPosition, and NULL.

Referenced by SetBreakPointForScript().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FloodBoundFunctionWithOneShot()

void v8::internal::Debug::FloodBoundFunctionWithOneShot ( Handle< JSFunction function)

Definition at line 1216 of file debug.cc.

1216  {
1217  Handle<FixedArray> new_bindings(function->function_bindings());
1218  Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex),
1219  isolate_);
1220 
1221  if (!bindee.is_null() && bindee->IsJSFunction() &&
1222  !JSFunction::cast(*bindee)->IsFromNativeScript()) {
1223  Handle<JSFunction> bindee_function(JSFunction::cast(*bindee));
1224  Debug::FloodWithOneShot(bindee_function);
1225  }
1226 }
void FloodWithOneShot(Handle< JSFunction > function)
Definition: debug.cc:1197
static const int kBoundFunctionIndex
Definition: objects.h:7392

References FloodWithOneShot(), v8::internal::Handle< T >::is_null(), isolate_, and v8::internal::JSFunction::kBoundFunctionIndex.

Referenced by HandleStepIn(), and PrepareStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FloodHandlerWithOneShot()

void v8::internal::Debug::FloodHandlerWithOneShot ( )

Definition at line 1229 of file debug.cc.

1229  {
1230  // Iterate through the JavaScript stack looking for handlers.
1231  StackFrame::Id id = break_frame_id();
1232  if (id == StackFrame::NO_ID) {
1233  // If there is no JavaScript stack don't do anything.
1234  return;
1235  }
1236  for (JavaScriptFrameIterator it(isolate_, id); !it.done(); it.Advance()) {
1237  JavaScriptFrame* frame = it.frame();
1238  if (frame->HasHandler()) {
1239  // Flood the function with the catch block with break points
1240  FloodWithOneShot(Handle<JSFunction>(frame->function()));
1241  return;
1242  }
1243  }
1244 }
StackFrame::Id break_frame_id()
Definition: debug.h:473

References break_frame_id(), FloodWithOneShot(), v8::internal::JavaScriptFrame::function(), and isolate_.

Referenced by PrepareStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FloodWithOneShot()

void v8::internal::Debug::FloodWithOneShot ( Handle< JSFunction function)

Definition at line 1197 of file debug.cc.

1197  {
1199 
1200  // Make sure the function is compiled and has set up the debug info.
1201  Handle<SharedFunctionInfo> shared(function->shared());
1202  if (!EnsureDebugInfo(shared, function)) {
1203  // Return if we failed to retrieve the debug info.
1204  return;
1205  }
1206 
1207  // Flood the function with break points.
1208  BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS);
1209  while (!it.Done()) {
1210  it.SetOneShot();
1211  it.Next();
1212  }
1213 }
bool EnsureDebugInfo(Handle< SharedFunctionInfo > shared, Handle< JSFunction > function)
Definition: debug.cc:2177
void PrepareForBreakPoints()
Definition: debug.cc:1907

References v8::internal::ALL_BREAK_LOCATIONS, v8::internal::BreakLocationIterator::Done(), EnsureDebugInfo(), GetDebugInfo(), v8::internal::BreakLocationIterator::Next(), PrepareForBreakPoints(), and v8::internal::BreakLocationIterator::SetOneShot().

Referenced by FloodBoundFunctionWithOneShot(), FloodHandlerWithOneShot(), HandleStepIn(), PrepareStep(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FramesHaveBeenDropped()

void v8::internal::Debug::FramesHaveBeenDropped ( StackFrame::Id  new_break_frame_id,
LiveEdit::FrameDropMode  mode,
Object **  restarter_frame_function_pointer 
)

Definition at line 2372 of file debug.cc.

2374  {
2377  }
2378  thread_local_.break_frame_id_ = new_break_frame_id;
2380  restarter_frame_function_pointer;
2381 }
Object ** restarter_frame_function_pointer_
Definition: debug.h:638
LiveEdit::FrameDropMode frame_drop_mode_
Definition: debug.h:633
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

References v8::internal::Debug::ThreadLocal::break_frame_id_, v8::internal::LiveEdit::CURRENTLY_SET_MODE, v8::internal::Debug::ThreadLocal::frame_drop_mode_, mode(), v8::internal::Debug::ThreadLocal::restarter_frame_function_pointer_, and thread_local_.

Referenced by v8::internal::DropActivationsInActiveThreadImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FreeThreadResources()

void v8::internal::Debug::FreeThreadResources ( )
inline

Definition at line 452 of file debug.h.

452 { }

Referenced by v8::internal::ThreadManager::FreeThreadResources().

+ Here is the caller graph for this function:

◆ GetDebugContext()

Handle< Context > v8::internal::Debug::GetDebugContext ( )

Definition at line 2778 of file debug.cc.

2778  {
2779  DebugScope debug_scope(this);
2780  // The global handle may be destroyed soon after. Return it reboxed.
2781  return handle(*debug_context(), isolate_);
2782 }

References debug_context(), DebugScope, v8::internal::handle(), and isolate_.

+ Here is the call graph for this function:

◆ GetDebugInfo()

Handle< DebugInfo > v8::internal::Debug::GetDebugInfo ( Handle< SharedFunctionInfo shared)
static

Definition at line 1069 of file debug.cc.

1069  {
1070  DCHECK(HasDebugInfo(shared));
1071  return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
1072 }

References DCHECK, and HasDebugInfo().

Referenced by Break(), FloodWithOneShot(), v8::internal::IC::GetOriginalCode(), GetSourceBreakLocations(), IsBreakAtReturn(), PrepareStep(), v8::internal::RUNTIME_FUNCTION(), v8::internal::ScopeIterator::ScopeIterator(), SetAfterBreakTarget(), SetBreakPoint(), and SetBreakPointForScript().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLoadedScripts()

Handle< FixedArray > v8::internal::Debug::GetLoadedScripts ( )

Definition at line 2404 of file debug.cc.

2404  {
2405  // Create and fill the script cache when the loaded scripts is requested for
2406  // the first time.
2407  if (script_cache_ == NULL) script_cache_ = new ScriptCache(isolate_);
2408 
2409  // Perform GC to get unreferenced scripts evicted from the cache before
2410  // returning the content.
2412  "Debug::GetLoadedScripts");
2413 
2414  // Get the scripts from the cache.
2415  return script_cache_->GetScripts();
2416 }
static const int kNoGCFlags
Definition: heap.h:716
void CollectAllGarbage(int flags, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
Definition: heap.cc:724
Handle< FixedArray > GetScripts()
Definition: debug.cc:642

References v8::internal::Heap::CollectAllGarbage(), v8::internal::ScriptCache::GetScripts(), v8::internal::Isolate::heap(), isolate_, v8::internal::Heap::kNoGCFlags, NULL, and script_cache_.

+ Here is the call graph for this function:

◆ GetSourceBreakLocations()

Handle< Object > v8::internal::Debug::GetSourceBreakLocations ( Handle< SharedFunctionInfo shared,
BreakPositionAlignment  position_aligment 
)
static

Definition at line 1551 of file debug.cc.

1553  {
1554  Isolate* isolate = shared->GetIsolate();
1555  Heap* heap = isolate->heap();
1556  if (!HasDebugInfo(shared)) {
1557  return Handle<Object>(heap->undefined_value(), isolate);
1558  }
1559  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1560  if (debug_info->GetBreakPointCount() == 0) {
1561  return Handle<Object>(heap->undefined_value(), isolate);
1562  }
1563  Handle<FixedArray> locations =
1564  isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
1565  int count = 0;
1566  for (int i = 0; i < debug_info->break_points()->length(); i++) {
1567  if (!debug_info->break_points()->get(i)->IsUndefined()) {
1568  BreakPointInfo* break_point_info =
1569  BreakPointInfo::cast(debug_info->break_points()->get(i));
1570  if (break_point_info->GetBreakPointCount() > 0) {
1571  Smi* position;
1572  switch (position_alignment) {
1573  case STATEMENT_ALIGNED:
1574  position = break_point_info->statement_position();
1575  break;
1577  position = break_point_info->source_position();
1578  break;
1579  default:
1580  UNREACHABLE();
1581  position = break_point_info->statement_position();
1582  }
1583 
1584  locations->set(count++, position);
1585  }
1586  }
1587  }
1588  return locations;
1589 }
#define UNREACHABLE()
Definition: logging.h:30
@ STATEMENT_ALIGNED
Definition: debug.h:61
@ BREAK_POSITION_ALIGNED
Definition: debug.h:62

References v8::internal::BREAK_POSITION_ALIGNED, v8::internal::Isolate::factory(), v8::internal::BreakPointInfo::GetBreakPointCount(), GetDebugInfo(), HasDebugInfo(), v8::internal::Isolate::heap(), v8::internal::STATEMENT_ALIGNED, and UNREACHABLE.

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleDebugBreak()

void v8::internal::Debug::HandleDebugBreak ( )

Definition at line 3024 of file debug.cc.

3024  {
3025  // Ignore debug break during bootstrapping.
3026  if (isolate_->bootstrapper()->IsActive()) return;
3027  // Just continue if breaks are disabled.
3028  if (break_disabled_) return;
3029  // Ignore debug break if debugger is not active.
3030  if (!is_active()) return;
3031 
3032  StackLimitCheck check(isolate_);
3033  if (check.HasOverflowed()) return;
3034 
3035  { JavaScriptFrameIterator it(isolate_);
3036  DCHECK(!it.done());
3037  Object* fun = it.frame()->function();
3038  if (fun && fun->IsJSFunction()) {
3039  // Don't stop in builtin functions.
3040  if (JSFunction::cast(fun)->IsBuiltin()) return;
3041  GlobalObject* global = JSFunction::cast(fun)->context()->global_object();
3042  // Don't stop in debugger functions.
3043  if (IsDebugGlobal(global)) return;
3044  }
3045  }
3046 
3047  // Collect the break state before clearing the flags.
3048  bool debug_command_only = isolate_->stack_guard()->CheckDebugCommand() &&
3049  !isolate_->stack_guard()->CheckDebugBreak();
3050 
3051  isolate_->stack_guard()->ClearDebugBreak();
3052 
3053  ProcessDebugMessages(debug_command_only);
3054 }
bool IsDebugGlobal(GlobalObject *global)
Definition: debug.cc:2384
void ProcessDebugMessages(bool debug_command_only)
Definition: debug.cc:3057
bool is_active() const
Definition: debug.h:465
Bootstrapper * bootstrapper()
Definition: isolate.h:856

References v8::internal::Isolate::bootstrapper(), break_disabled_, DCHECK, is_active(), IsDebugGlobal(), isolate_, ProcessDebugMessages(), and v8::internal::Isolate::stack_guard().

+ Here is the call graph for this function:

◆ HandleStepIn()

void v8::internal::Debug::HandleStepIn ( Handle< JSFunction function,
Handle< Object holder,
Address  fp,
bool  is_constructor 
)

Definition at line 1593 of file debug.cc.

1596  {
1597  Isolate* isolate = function->GetIsolate();
1598  // If the frame pointer is not supplied by the caller find it.
1599  if (fp == 0) {
1600  StackFrameIterator it(isolate);
1601  it.Advance();
1602  // For constructor functions skip another frame.
1603  if (is_constructor) {
1604  DCHECK(it.frame()->is_construct());
1605  it.Advance();
1606  }
1607  fp = it.frame()->fp();
1608  }
1609 
1610  // Flood the function with one-shot break points if it is called from where
1611  // step into was requested.
1612  if (fp == thread_local_.step_into_fp_) {
1613  if (function->shared()->bound()) {
1614  // Handle Function.prototype.bind
1616  } else if (!function->IsFromNativeScript()) {
1617  // Don't allow step into functions in the native context.
1618  if (function->shared()->code() ==
1619  isolate->builtins()->builtin(Builtins::kFunctionApply) ||
1620  function->shared()->code() ==
1621  isolate->builtins()->builtin(Builtins::kFunctionCall)) {
1622  // Handle function.apply and function.call separately to flood the
1623  // function to be called and not the code for Builtins::FunctionApply or
1624  // Builtins::FunctionCall. The receiver of call/apply is the target
1625  // function.
1626  if (!holder.is_null() && holder->IsJSFunction()) {
1627  Handle<JSFunction> js_function = Handle<JSFunction>::cast(holder);
1628  if (!js_function->IsFromNativeScript()) {
1629  Debug::FloodWithOneShot(js_function);
1630  } else if (js_function->shared()->bound()) {
1631  // Handle Function.prototype.bind
1633  }
1634  }
1635  } else {
1636  Debug::FloodWithOneShot(function);
1637  }
1638  }
1639  }
1640 }
void FloodBoundFunctionWithOneShot(Handle< JSFunction > function)
Definition: debug.cc:1216
const Register fp

References v8::internal::StackFrameIterator::Advance(), v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), v8::internal::Handle< T >::cast(), DCHECK, FloodBoundFunctionWithOneShot(), FloodWithOneShot(), v8::internal::fp, v8::internal::StackFrameIterator::frame(), v8::internal::Handle< T >::is_null(), v8::internal::Debug::ThreadLocal::step_into_fp_, and thread_local_.

Referenced by v8::internal::Object::GetPropertyWithDefinedGetter(), v8::internal::Runtime_NewObjectHelper(), and v8::internal::Object::SetPropertyWithDefinedSetter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleWeakDebugInfo()

void v8::internal::Debug::HandleWeakDebugInfo ( const v8::WeakCallbackData< v8::Value, void > &  data)
static

Definition at line 691 of file debug.cc.

692  {
693  Debug* debug = reinterpret_cast<Isolate*>(data.GetIsolate())->debug();
694  DebugInfoListNode* node =
695  reinterpret_cast<DebugInfoListNode*>(data.GetParameter());
696  // We need to clear all breakpoints associated with the function to restore
697  // original code and avoid patching the code twice later because
698  // the function will live in the heap until next gc, and can be found by
699  // Debug::FindSharedFunctionInfoInScript.
700  BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
701  it.ClearAllDebugBreak();
702  debug->RemoveDebugInfo(node->debug_info());
703 #ifdef DEBUG
704  for (DebugInfoListNode* n = debug->debug_info_list_;
705  n != NULL;
706  n = n->next()) {
707  DCHECK(n != node);
708  }
709 #endif
710 }
Isolate * GetIsolate() const
Definition: v8.h:421
P * GetParameter() const
Definition: v8.h:423
Debug(Isolate *isolate)
Definition: debug.cc:30

References v8::internal::ALL_BREAK_LOCATIONS, v8::internal::BreakLocationIterator::ClearAllDebugBreak(), DCHECK, v8::internal::DebugInfoListNode::debug_info(), debug_info_list_, v8::WeakCallbackData< T, P >::GetIsolate(), v8::WeakCallbackData< T, P >::GetParameter(), NULL, and RemoveDebugInfo().

Referenced by v8::internal::DebugInfoListNode::DebugInfoListNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_break_points()

bool v8::internal::Debug::has_break_points ( ) const
inline

Definition at line 467 of file debug.h.

467 { return has_break_points_; }

References has_break_points_.

Referenced by v8::internal::IC::address(), v8::internal::IC::constant_pool(), and v8::internal::RelocInfo::Visit().

+ Here is the caller graph for this function:

◆ has_commands()

bool v8::internal::Debug::has_commands ( ) const
inlineprivate

Definition at line 504 of file debug.h.

504 { return !command_queue_.IsEmpty(); }

References command_queue_.

Referenced by NotifyMessageHandler().

+ Here is the caller graph for this function:

◆ HasDebugInfo()

bool v8::internal::Debug::HasDebugInfo ( Handle< SharedFunctionInfo shared)
static

Definition at line 1062 of file debug.cc.

1062  {
1063  return !shared->debug_info()->IsUndefined();
1064 }

Referenced by EnsureDebugInfo(), GetDebugInfo(), v8::internal::IC::GetOriginalCode(), and GetSourceBreakLocations().

+ Here is the caller graph for this function:

◆ ignore_events()

bool v8::internal::Debug::ignore_events ( ) const
inlineprivate

Definition at line 505 of file debug.h.

505 { return is_suppressed_ || !is_active_; }

References is_active_, and is_suppressed_.

Referenced by OnAfterCompile(), OnAsyncTaskEvent(), OnBeforeCompile(), OnCompileError(), OnDebugBreak(), OnPromiseEvent(), OnPromiseReject(), and OnThrow().

+ Here is the caller graph for this function:

◆ in_debug_scope()

bool v8::internal::Debug::in_debug_scope ( ) const
inline

Definition at line 468 of file debug.h.

468  {
470  }

References v8::internal::Debug::ThreadLocal::current_debug_scope_, NULL, and thread_local_.

Referenced by AssertDebugContext(), EnqueueCommandMessage(), EnqueueDebugCommand(), v8::internal::Isolate::GetCallingNativeContext(), NotifyMessageHandler(), OnAfterCompile(), OnAsyncTaskEvent(), OnBeforeCompile(), OnCompileError(), OnPromiseEvent(), OnPromiseReject(), OnThrow(), PrepareStep(), SetMessageHandler(), and UpdateState().

+ Here is the caller graph for this function:

◆ InvokeMessageHandler()

void v8::internal::Debug::InvokeMessageHandler ( MessageImpl  message)
private

Definition at line 2970 of file debug.cc.

2970  {
2971  if (message_handler_ != NULL) message_handler_(message);
2972 }

References message_handler_, and NULL.

Referenced by NotifyMessageHandler().

+ Here is the caller graph for this function:

◆ is_active()

bool v8::internal::Debug::is_active ( ) const
inline

Definition at line 465 of file debug.h.

465 { return is_active_; }

References is_active_.

Referenced by HandleDebugBreak(), v8::internal::CompilationInfo::Initialize(), v8::internal::Invoke(), and NotifyMessageHandler().

+ Here is the caller graph for this function:

◆ is_active_address()

Address v8::internal::Debug::is_active_address ( )
inline

Definition at line 477 of file debug.h.

477  {
478  return reinterpret_cast<Address>(&is_active_);
479  }

References is_active_.

◆ is_loaded()

bool v8::internal::Debug::is_loaded ( ) const
inline

Definition at line 466 of file debug.h.

466 { return !debug_context_.is_null(); }

References debug_context_.

Referenced by v8::internal::Compiler::CompileScript(), IsDebugGlobal(), Load(), Unload(), and UpdateState().

+ Here is the caller graph for this function:

◆ IsBreakAtReturn()

bool v8::internal::Debug::IsBreakAtReturn ( JavaScriptFrame frame)

Definition at line 2329 of file debug.cc.

2329  {
2330  HandleScope scope(isolate_);
2331 
2332  // If there are no break points this cannot be break at return, as
2333  // the debugger statement and stack guard bebug break cannot be at
2334  // return.
2335  if (!has_break_points_) {
2336  return false;
2337  }
2338 
2340 
2341  // Get the executing function in which the debug break occurred.
2342  Handle<JSFunction> function(JSFunction::cast(frame->function()));
2343  Handle<SharedFunctionInfo> shared(function->shared());
2344  if (!EnsureDebugInfo(shared, function)) {
2345  // Return if we failed to retrieve the debug info.
2346  return false;
2347  }
2348  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
2349  Handle<Code> code(debug_info->code());
2350 #ifdef DEBUG
2351  // Get the code which is actually executing.
2352  Handle<Code> frame_code(frame->LookupCode());
2353  DCHECK(frame_code.is_identical_to(code));
2354 #endif
2355 
2356  // Find the call address in the running code.
2358 
2359  // Check if the location is at JS return.
2360  RelocIterator it(debug_info->code());
2361  while (!it.done()) {
2362  if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
2363  return (it.rinfo()->pc() ==
2365  }
2366  it.next();
2367  }
2368  return false;
2369 }
static Address break_address_from_return_address(Address pc)
static const int kPatchReturnSequenceAddressOffset
static bool IsJSReturn(Mode mode)
Definition: assembler.h:412

References v8::internal::Assembler::break_address_from_return_address(), DCHECK, v8::internal::RelocIterator::done(), EnsureDebugInfo(), v8::internal::JavaScriptFrame::function(), GetDebugInfo(), has_break_points_, v8::internal::RelocInfo::IsJSReturn(), isolate_, v8::internal::Assembler::kPatchReturnSequenceAddressOffset, v8::internal::RelocIterator::next(), v8::internal::RelocInfo::pc(), PrepareForBreakPoints(), v8::internal::RelocIterator::rinfo(), and v8::internal::RelocInfo::rmode().

+ Here is the call graph for this function:

◆ IsBreakOnException()

bool v8::internal::Debug::IsBreakOnException ( ExceptionBreakType  type)

Definition at line 1256 of file debug.cc.

1256  {
1257  if (type == BreakUncaughtException) {
1259  } else {
1260  return break_on_exception_;
1261  }
1262 }

References break_on_exception_, break_on_uncaught_exception_, and v8::internal::BreakUncaughtException.

◆ IsDebugBreak()

bool v8::internal::Debug::IsDebugBreak ( Address  addr)
static

Definition at line 1541 of file debug.cc.

1541  {
1542  Code* code = Code::GetCodeFromTargetAddress(addr);
1543  return code->is_debug_stub() && code->extra_ic_state() == DEBUG_BREAK;
1544 }
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:5018

References v8::internal::DEBUG_BREAK, v8::internal::Code::extra_ic_state(), v8::internal::Code::GetCodeFromTargetAddress(), and v8::internal::Code::is_debug_stub().

Referenced by v8::internal::IC::address(), v8::internal::IC::constant_pool(), v8::internal::BreakLocationIterator::IsDebugBreak(), and SetAfterBreakTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDebugBreakAtReturn()

static bool v8::internal::Debug::IsDebugBreakAtReturn ( RelocInfo rinfo)
static

◆ IsDebugGlobal()

bool v8::internal::Debug::IsDebugGlobal ( GlobalObject global)

Definition at line 2384 of file debug.cc.

2384  {
2385  return is_loaded() && global == debug_context()->global_object();
2386 }
bool is_loaded() const
Definition: debug.h:466

References debug_context(), and is_loaded().

Referenced by HandleDebugBreak(), and v8::internal::V8HeapExplorer::SetGcSubrootReference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsStepping()

bool v8::internal::Debug::IsStepping ( )
inline

Definition at line 399 of file debug.h.

399 { return thread_local_.step_count_ > 0; }

References v8::internal::Debug::ThreadLocal::step_count_, and thread_local_.

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the caller graph for this function:

◆ live_edit_enabled()

bool v8::internal::Debug::live_edit_enabled ( ) const
inline

Definition at line 461 of file debug.h.

461  {
462  return FLAG_enable_liveedit && live_edit_enabled_ ;
463  }

References live_edit_enabled_.

◆ Load()

bool v8::internal::Debug::Load ( )

Definition at line 789 of file debug.cc.

789  {
790  // Return if debugger is already loaded.
791  if (is_loaded()) return true;
792 
793  // Bail out if we're already in the process of compiling the native
794  // JavaScript source code for the debugger.
795  if (is_suppressed_) return false;
796  SuppressDebug while_loading(this);
797 
798  // Disable breakpoints and interrupts while compiling and running the
799  // debugger scripts including the context creation code.
800  DisableBreak disable(this, true);
801  PostponeInterruptsScope postpone(isolate_);
802 
803  // Create the debugger context.
804  HandleScope scope(isolate_);
805  ExtensionConfiguration no_extensions;
806  Handle<Context> context =
807  isolate_->bootstrapper()->CreateEnvironment(
808  MaybeHandle<JSGlobalProxy>(),
810  &no_extensions);
811 
812  // Fail if no context could be created.
813  if (context.is_null()) return false;
814 
815  // Use the debugger context.
816  SaveContext save(isolate_);
817  isolate_->set_context(*context);
818 
819  // Expose the builtins object in the debugger context.
820  Handle<String> key = isolate_->factory()->InternalizeOneByteString(
821  STATIC_CHAR_VECTOR("builtins"));
822  Handle<GlobalObject> global =
823  Handle<GlobalObject>(context->global_object(), isolate_);
824  Handle<JSBuiltinsObject> builtin =
825  Handle<JSBuiltinsObject>(global->builtins(), isolate_);
827  isolate_, Object::SetProperty(global, key, builtin, SLOPPY), false);
828 
829  // Compile the JavaScript for the debugger in the debugger context.
830  bool caught_exception =
833 
834  if (FLAG_enable_liveedit) {
835  caught_exception = caught_exception ||
837  }
838  // Check for caught exceptions.
839  if (caught_exception) return false;
840 
842  isolate_->global_handles()->Create(*context));
843  return true;
844 }
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
friend class SuppressDebug
Definition: debug.h:650
friend class DisableBreak
Definition: debug.h:648
static bool CompileDebuggerScript(Isolate *isolate, int index)
Definition: debug.cc:728
Handle< Object > Create(Object *value)
void set_context(Context *context)
Definition: isolate.h:549
GlobalHandles * global_handles()
Definition: isolate.h:917
static int GetIndex(const char *name)
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value)
Definition: isolate.h:154

References v8::internal::Isolate::bootstrapper(), v8::internal::Handle< T >::cast(), CompileDebuggerScript(), v8::internal::GlobalHandles::Create(), debug_context_, DisableBreak, v8::internal::Isolate::factory(), v8::internal::NativesCollection< type >::GetIndex(), v8::internal::Isolate::global_handles(), is_loaded(), v8::internal::Handle< T >::is_null(), is_suppressed_, isolate_, RETURN_ON_EXCEPTION_VALUE, v8::internal::Isolate::set_context(), v8::internal::Object::SetProperty(), v8::internal::SLOPPY, STATIC_CHAR_VECTOR, and SuppressDebug.

Referenced by v8::Debug::GetMirror(), v8::Shell::InstallUtilityScript(), and UpdateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeAsyncTaskEvent()

MaybeHandle< Object > v8::internal::Debug::MakeAsyncTaskEvent ( Handle< JSObject task_event)
private

Definition at line 2497 of file debug.cc.

2497  {
2498  // Create the async task event object.
2499  Handle<Object> argv[] = { task_event };
2500  return MakeJSObject("MakeAsyncTaskEvent", arraysize(argv), argv);
2501 }
MUST_USE_RESULT MaybeHandle< Object > MakeJSObject(const char *constructor_name, int argc, Handle< Object > argv[])
Definition: debug.cc:2434

References arraysize, and MakeJSObject().

Referenced by OnAsyncTaskEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeBreakEvent()

MaybeHandle< Object > v8::internal::Debug::MakeBreakEvent ( Handle< Object break_points_hit)
private

Definition at line 2460 of file debug.cc.

2460  {
2461  // Create the new break event object.
2462  Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()),
2463  break_points_hit };
2464  return MakeJSObject("MakeBreakEvent", arraysize(argv), argv);
2465 }

References arraysize, break_id(), v8::internal::Isolate::factory(), isolate_, and MakeJSObject().

Referenced by OnDebugBreak().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeCompileEvent()

MaybeHandle< Object > v8::internal::Debug::MakeCompileEvent ( Handle< Script script,
v8::DebugEvent  type 
)
private

Definition at line 2480 of file debug.cc.

2481  {
2482  // Create the compile event object.
2483  Handle<Object> script_wrapper = Script::GetWrapper(script);
2484  Handle<Object> argv[] = { script_wrapper,
2485  isolate_->factory()->NewNumberFromInt(type) };
2486  return MakeJSObject("MakeCompileEvent", arraysize(argv), argv);
2487 }
static Handle< JSObject > GetWrapper(Handle< Script > script)
Definition: objects.cc:9741

References arraysize, v8::internal::Isolate::factory(), v8::internal::Script::GetWrapper(), isolate_, and MakeJSObject().

Referenced by OnAfterCompile(), OnBeforeCompile(), and OnCompileError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeExceptionEvent()

MaybeHandle< Object > v8::internal::Debug::MakeExceptionEvent ( Handle< Object exception,
bool  uncaught,
Handle< Object promise 
)
private

Definition at line 2468 of file debug.cc.

2470  {
2471  // Create the new exception event object.
2472  Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()),
2473  exception,
2474  isolate_->factory()->ToBoolean(uncaught),
2475  promise };
2476  return MakeJSObject("MakeExceptionEvent", arraysize(argv), argv);
2477 }

References arraysize, break_id(), v8::internal::Isolate::factory(), isolate_, and MakeJSObject().

Referenced by OnException().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeExecutionState()

MaybeHandle< Object > v8::internal::Debug::MakeExecutionState ( )
private

Definition at line 2453 of file debug.cc.

2453  {
2454  // Create the execution state object.
2455  Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) };
2456  return MakeJSObject("MakeExecutionState", arraysize(argv), argv);
2457 }

References arraysize, break_id(), v8::internal::Isolate::factory(), isolate_, and MakeJSObject().

Referenced by Call(), and ProcessDebugEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeJSObject()

MaybeHandle< Object > v8::internal::Debug::MakeJSObject ( const char *  constructor_name,
int  argc,
Handle< Object argv[] 
)
private

Definition at line 2434 of file debug.cc.

2436  {
2438  // Create the execution state object.
2439  Handle<GlobalObject> global(isolate_->global_object());
2440  Handle<Object> constructor = Object::GetProperty(
2441  isolate_, global, constructor_name).ToHandleChecked();
2442  DCHECK(constructor->IsJSFunction());
2443  if (!constructor->IsJSFunction()) return MaybeHandle<Object>();
2444  // We do not handle interrupts here. In particular, termination interrupts.
2445  PostponeInterruptsScope no_interrupts(isolate_);
2446  return Execution::TryCall(Handle<JSFunction>::cast(constructor),
2447  handle(debug_context()->global_proxy()),
2448  argc,
2449  argv);
2450 }

References AssertDebugContext(), DCHECK, debug_context(), v8::internal::Object::GetProperty(), v8::internal::Isolate::global_object(), v8::internal::handle(), and isolate_.

Referenced by MakeAsyncTaskEvent(), MakeBreakEvent(), MakeCompileEvent(), MakeExceptionEvent(), MakeExecutionState(), and MakePromiseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakePromiseEvent()

MaybeHandle< Object > v8::internal::Debug::MakePromiseEvent ( Handle< JSObject promise_event)
private

Definition at line 2490 of file debug.cc.

2490  {
2491  // Create the promise event object.
2492  Handle<Object> argv[] = { event_data };
2493  return MakeJSObject("MakePromiseEvent", arraysize(argv), argv);
2494 }

References arraysize, and MakeJSObject().

Referenced by OnPromiseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyMessageHandler()

void v8::internal::Debug::NotifyMessageHandler ( v8::DebugEvent  event,
Handle< JSObject exec_state,
Handle< JSObject event_data,
bool  auto_continue 
)
private

Definition at line 2785 of file debug.cc.

2788  {
2789  // Prevent other interrupts from triggering, for example API callbacks,
2790  // while dispatching message handler callbacks.
2791  PostponeInterruptsScope no_interrupts(isolate_);
2792  DCHECK(is_active_);
2793  HandleScope scope(isolate_);
2794  // Process the individual events.
2795  bool sendEventMessage = false;
2796  switch (event) {
2797  case v8::Break:
2798  case v8::BreakForCommand:
2799  sendEventMessage = !auto_continue;
2800  break;
2801  case v8::Exception:
2802  sendEventMessage = true;
2803  break;
2804  case v8::BeforeCompile:
2805  break;
2806  case v8::AfterCompile:
2807  sendEventMessage = true;
2808  break;
2809  case v8::NewFunction:
2810  break;
2811  default:
2812  UNREACHABLE();
2813  }
2814 
2815  // The debug command interrupt flag might have been set when the command was
2816  // added. It should be enough to clear the flag only once while we are in the
2817  // debugger.
2819  isolate_->stack_guard()->ClearDebugCommand();
2820 
2821  // Notify the debugger that a debug event has occurred unless auto continue is
2822  // active in which case no event is send.
2823  if (sendEventMessage) {
2824  MessageImpl message = MessageImpl::NewEvent(
2825  event,
2826  auto_continue,
2827  Handle<JSObject>::cast(exec_state),
2828  Handle<JSObject>::cast(event_data));
2829  InvokeMessageHandler(message);
2830  }
2831 
2832  // If auto continue don't make the event cause a break, but process messages
2833  // in the queue if any. For script collected events don't even process
2834  // messages in the queue as the execution state might not be what is expected
2835  // by the client.
2836  if (auto_continue && !has_commands()) return;
2837 
2838  // DebugCommandProcessor goes here.
2839  bool running = auto_continue;
2840 
2841  Handle<Object> cmd_processor_ctor = Object::GetProperty(
2842  isolate_, exec_state, "debugCommandProcessor").ToHandleChecked();
2843  Handle<Object> ctor_args[] = { isolate_->factory()->ToBoolean(running) };
2844  Handle<Object> cmd_processor = Execution::Call(
2845  isolate_, cmd_processor_ctor, exec_state, 1, ctor_args).ToHandleChecked();
2846  Handle<JSFunction> process_debug_request = Handle<JSFunction>::cast(
2848  isolate_, cmd_processor, "processDebugRequest").ToHandleChecked());
2849  Handle<Object> is_running = Object::GetProperty(
2850  isolate_, cmd_processor, "isRunning").ToHandleChecked();
2851 
2852  // Process requests from the debugger.
2853  do {
2854  // Wait for new command in the queue.
2855  command_received_.Wait();
2856 
2857  // Get the command from the queue.
2858  CommandMessage command = command_queue_.Get();
2859  isolate_->logger()->DebugTag(
2860  "Got request from command queue, in interactive loop.");
2861  if (!is_active()) {
2862  // Delete command text and user data.
2863  command.Dispose();
2864  return;
2865  }
2866 
2867  Vector<const uc16> command_text(
2868  const_cast<const uc16*>(command.text().start()),
2869  command.text().length());
2870  Handle<String> request_text = isolate_->factory()->NewStringFromTwoByte(
2871  command_text).ToHandleChecked();
2872  Handle<Object> request_args[] = { request_text };
2873  Handle<Object> answer_value;
2874  Handle<String> answer;
2875  MaybeHandle<Object> maybe_exception;
2876  MaybeHandle<Object> maybe_result =
2877  Execution::TryCall(process_debug_request, cmd_processor, 1,
2878  request_args, &maybe_exception);
2879 
2880  if (maybe_result.ToHandle(&answer_value)) {
2881  if (answer_value->IsUndefined()) {
2882  answer = isolate_->factory()->empty_string();
2883  } else {
2884  answer = Handle<String>::cast(answer_value);
2885  }
2886 
2887  // Log the JSON request/response.
2888  if (FLAG_trace_debug_json) {
2889  PrintF("%s\n", request_text->ToCString().get());
2890  PrintF("%s\n", answer->ToCString().get());
2891  }
2892 
2893  Handle<Object> is_running_args[] = { answer };
2894  maybe_result = Execution::Call(
2895  isolate_, is_running, cmd_processor, 1, is_running_args);
2896  Handle<Object> result;
2897  if (!maybe_result.ToHandle(&result)) break;
2898  running = result->IsTrue();
2899  } else {
2900  Handle<Object> exception;
2901  if (!maybe_exception.ToHandle(&exception)) break;
2902  Handle<Object> result;
2903  if (!Execution::ToString(isolate_, exception).ToHandle(&result)) break;
2904  answer = Handle<String>::cast(result);
2905  }
2906 
2907  // Return the result.
2908  MessageImpl message = MessageImpl::NewResponse(
2909  event, running, exec_state, event_data, answer, command.client_data());
2910  InvokeMessageHandler(message);
2911  command.Dispose();
2912 
2913  // Return from debug event processing if either the VM is put into the
2914  // running state (through a continue command) or auto continue is active
2915  // and there are no more commands queued.
2916  } while (!running || has_commands());
2917  command_queue_.Clear();
2918 }
void InvokeMessageHandler(MessageImpl message)
Definition: debug.cc:2970
bool has_commands() const
Definition: debug.h:504
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
static MessageImpl NewEvent(DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data)
Definition: debug.cc:3127
void PrintF(const char *format,...)
Definition: utils.cc:80
uint16_t uc16
Definition: globals.h:184
@ BeforeCompile
Definition: v8-debug.h:20
@ AfterCompile
Definition: v8-debug.h:21
@ Exception
Definition: v8-debug.h:18
@ BreakForCommand
Definition: v8-debug.h:25
@ Break
Definition: v8-debug.h:17
@ NewFunction
Definition: v8-debug.h:19

References v8::AfterCompile, v8::BeforeCompile, v8::Break, v8::BreakForCommand, v8::internal::Handle< T >::cast(), v8::internal::CommandMessage::client_data(), command_queue_, command_received_, DCHECK, v8::internal::Logger::DebugTag(), v8::internal::CommandMessage::Dispose(), v8::Exception, v8::internal::Isolate::factory(), v8::internal::Object::GetProperty(), has_commands(), in_debug_scope(), InvokeMessageHandler(), is_active(), is_active_, isolate_, v8::internal::Vector< T >::length(), v8::internal::Isolate::logger(), v8::internal::MessageImpl::NewEvent(), v8::NewFunction, v8::internal::MessageImpl::NewResponse(), v8::internal::PrintF(), v8::internal::Isolate::stack_guard(), v8::internal::Vector< T >::start(), v8::internal::CommandMessage::text(), and UNREACHABLE.

Referenced by ProcessDebugEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnAfterCompile()

void v8::internal::Debug::OnAfterCompile ( Handle< Script script)

Definition at line 2621 of file debug.cc.

2621  {
2622  // Add the newly compiled script to the script cache.
2623  if (script_cache_ != NULL) script_cache_->Add(script);
2624 
2625  // No more to do if not debugging.
2626  if (in_debug_scope() || ignore_events()) return;
2627 
2628  HandleScope scope(isolate_);
2629  DebugScope debug_scope(this);
2630  if (debug_scope.failed()) return;
2631 
2632  // If debugging there might be script break points registered for this
2633  // script. Make sure that these break points are set.
2634 
2635  // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
2636  Handle<String> update_script_break_points_string =
2637  isolate_->factory()->InternalizeOneByteString(
2638  STATIC_CHAR_VECTOR("UpdateScriptBreakPoints"));
2639  Handle<GlobalObject> debug_global(debug_context()->global_object());
2640  Handle<Object> update_script_break_points =
2642  debug_global, update_script_break_points_string).ToHandleChecked();
2643  if (!update_script_break_points->IsJSFunction()) {
2644  return;
2645  }
2646  DCHECK(update_script_break_points->IsJSFunction());
2647 
2648  // Wrap the script object in a proper JS object before passing it
2649  // to JavaScript.
2650  Handle<Object> wrapper = Script::GetWrapper(script);
2651 
2652  // Call UpdateScriptBreakPoints expect no exceptions.
2653  Handle<Object> argv[] = { wrapper };
2654  if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points),
2656  arraysize(argv),
2657  argv).is_null()) {
2658  return;
2659  }
2660 
2661  // Create the compile state object.
2662  Handle<Object> event_data;
2663  // Bail out and don't call debugger if exception.
2664  if (!MakeCompileEvent(script, v8::AfterCompile).ToHandle(&event_data)) return;
2665 
2666  // Process debug event.
2668 }
bool ignore_events() const
Definition: debug.h:505
void ProcessDebugEvent(v8::DebugEvent event, Handle< JSObject > event_data, bool auto_continue)
Definition: debug.cc:2709
MUST_USE_RESULT MaybeHandle< Object > MakeCompileEvent(Handle< Script > script, v8::DebugEvent type)
Definition: debug.cc:2480
void Add(Handle< Script > script)
Definition: debug.cc:614

References v8::internal::ScriptCache::Add(), v8::AfterCompile, arraysize, DCHECK, debug_context(), DebugScope, v8::internal::Isolate::factory(), v8::internal::Object::GetProperty(), v8::internal::Script::GetWrapper(), ignore_events(), in_debug_scope(), isolate_, v8::internal::Isolate::js_builtins_object(), MakeCompileEvent(), NULL, ProcessDebugEvent(), script_cache_, and STATIC_CHAR_VECTOR.

Referenced by v8::internal::LiveEdit::ChangeScriptSource(), and v8::internal::CompileToplevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnAsyncTaskEvent()

void v8::internal::Debug::OnAsyncTaskEvent ( Handle< JSObject data)

Definition at line 2690 of file debug.cc.

2690  {
2691  if (in_debug_scope() || ignore_events()) return;
2692 
2693  HandleScope scope(isolate_);
2694  DebugScope debug_scope(this);
2695  if (debug_scope.failed()) return;
2696 
2697  // Create the script collected state object.
2698  Handle<Object> event_data;
2699  // Bail out and don't call debugger if exception.
2700  if (!MakeAsyncTaskEvent(data).ToHandle(&event_data)) return;
2701 
2702  // Process debug event.
2704  Handle<JSObject>::cast(event_data),
2705  true);
2706 }
MUST_USE_RESULT MaybeHandle< Object > MakeAsyncTaskEvent(Handle< JSObject > task_event)
Definition: debug.cc:2497
@ AsyncTaskEvent
Definition: v8-debug.h:24

References v8::AsyncTaskEvent, DebugScope, ignore_events(), in_debug_scope(), isolate_, MakeAsyncTaskEvent(), and ProcessDebugEvent().

+ Here is the call graph for this function:

◆ OnBeforeCompile()

void v8::internal::Debug::OnBeforeCompile ( Handle< Script script)

Definition at line 2600 of file debug.cc.

2600  {
2601  if (in_debug_scope() || ignore_events()) return;
2602 
2603  HandleScope scope(isolate_);
2604  DebugScope debug_scope(this);
2605  if (debug_scope.failed()) return;
2606 
2607  // Create the event data object.
2608  Handle<Object> event_data;
2609  // Bail out and don't call debugger if exception.
2610  if (!MakeCompileEvent(script, v8::BeforeCompile).ToHandle(&event_data))
2611  return;
2612 
2613  // Process debug event.
2615  Handle<JSObject>::cast(event_data),
2616  true);
2617 }

References v8::BeforeCompile, DebugScope, ignore_events(), in_debug_scope(), isolate_, MakeCompileEvent(), and ProcessDebugEvent().

Referenced by v8::internal::CompileToplevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnCompileError()

void v8::internal::Debug::OnCompileError ( Handle< Script script)

Definition at line 2562 of file debug.cc.

2562  {
2563  // No more to do if not debugging.
2564  if (in_debug_scope() || ignore_events()) return;
2565 
2566  HandleScope scope(isolate_);
2567  DebugScope debug_scope(this);
2568  if (debug_scope.failed()) return;
2569 
2570  // Create the compile state object.
2571  Handle<Object> event_data;
2572  // Bail out and don't call debugger if exception.
2573  if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return;
2574 
2575  // Process debug event.
2577 }
@ CompileError
Definition: v8-debug.h:22

References v8::CompileError, DebugScope, ignore_events(), in_debug_scope(), isolate_, MakeCompileEvent(), and ProcessDebugEvent().

Referenced by v8::internal::Parser::ThrowPendingError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnDebugBreak()

void v8::internal::Debug::OnDebugBreak ( Handle< Object break_points_hit,
bool  auto_continue 
)

Definition at line 2580 of file debug.cc.

2581  {
2582  // The caller provided for DebugScope.
2584  // Bail out if there is no listener for this event
2585  if (ignore_events()) return;
2586 
2587  HandleScope scope(isolate_);
2588  // Create the event data object.
2589  Handle<Object> event_data;
2590  // Bail out and don't call debugger if exception.
2591  if (!MakeBreakEvent(break_points_hit).ToHandle(&event_data)) return;
2592 
2593  // Process debug event.
2595  Handle<JSObject>::cast(event_data),
2596  auto_continue);
2597 }
MUST_USE_RESULT MaybeHandle< Object > MakeBreakEvent(Handle< Object > break_points_hit)
Definition: debug.cc:2460

References AssertDebugContext(), v8::Break, ignore_events(), isolate_, MakeBreakEvent(), and ProcessDebugEvent().

Referenced by Break(), and ProcessDebugMessages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnException()

void v8::internal::Debug::OnException ( Handle< Object exception,
bool  uncaught,
Handle< Object promise 
)
private

Definition at line 2528 of file debug.cc.

2529  {
2530  if (promise->IsJSObject()) {
2531  uncaught |= !PromiseHasRejectHandler(Handle<JSObject>::cast(promise));
2532  }
2533  // Bail out if exception breaks are not active
2534  if (uncaught) {
2535  // Uncaught exceptions are reported by either flags.
2537  } else {
2538  // Caught exceptions are reported is activated.
2539  if (!break_on_exception_) return;
2540  }
2541 
2542  DebugScope debug_scope(this);
2543  if (debug_scope.failed()) return;
2544 
2545  // Clear all current stepping setup.
2546  ClearStepping();
2547 
2548  // Create the event data object.
2549  Handle<Object> event_data;
2550  // Bail out and don't call debugger if exception.
2551  if (!MakeExceptionEvent(
2552  exception, uncaught, promise).ToHandle(&event_data)) {
2553  return;
2554  }
2555 
2556  // Process debug event.
2558  // Return to continue execution from where the exception was thrown.
2559 }
Create new error objects by calling the corresponding error object constructor with the message.
Definition: v8.h:4130
bool PromiseHasRejectHandler(Handle< JSObject > promise)
Definition: debug.cc:1265
MUST_USE_RESULT MaybeHandle< Object > MakeExceptionEvent(Handle< Object > exception, bool uncaught, Handle< Object > promise)
Definition: debug.cc:2468

References break_on_exception_, break_on_uncaught_exception_, ClearStepping(), DebugScope, MakeExceptionEvent(), ProcessDebugEvent(), and PromiseHasRejectHandler().

Referenced by OnPromiseReject(), and OnThrow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnPromiseEvent()

void v8::internal::Debug::OnPromiseEvent ( Handle< JSObject data)

Definition at line 2671 of file debug.cc.

2671  {
2672  if (in_debug_scope() || ignore_events()) return;
2673 
2674  HandleScope scope(isolate_);
2675  DebugScope debug_scope(this);
2676  if (debug_scope.failed()) return;
2677 
2678  // Create the script collected state object.
2679  Handle<Object> event_data;
2680  // Bail out and don't call debugger if exception.
2681  if (!MakePromiseEvent(data).ToHandle(&event_data)) return;
2682 
2683  // Process debug event.
2685  Handle<JSObject>::cast(event_data),
2686  true);
2687 }
MUST_USE_RESULT MaybeHandle< Object > MakePromiseEvent(Handle< JSObject > promise_event)
Definition: debug.cc:2490
@ PromiseEvent
Definition: v8-debug.h:23

References DebugScope, ignore_events(), in_debug_scope(), isolate_, MakePromiseEvent(), ProcessDebugEvent(), and v8::PromiseEvent.

+ Here is the call graph for this function:

◆ OnPromiseReject()

void v8::internal::Debug::OnPromiseReject ( Handle< JSObject promise,
Handle< Object value 
)

Definition at line 2521 of file debug.cc.

2521  {
2522  if (in_debug_scope() || ignore_events()) return;
2523  HandleScope scope(isolate_);
2524  OnException(value, false, promise);
2525 }
void OnException(Handle< Object > exception, bool uncaught, Handle< Object > promise)
Definition: debug.cc:2528

References ignore_events(), in_debug_scope(), isolate_, and OnException().

+ Here is the call graph for this function:

◆ OnThrow()

void v8::internal::Debug::OnThrow ( Handle< Object exception,
bool  uncaught 
)

Definition at line 2504 of file debug.cc.

2504  {
2505  if (in_debug_scope() || ignore_events()) return;
2506  // Temporarily clear any scheduled_exception to allow evaluating
2507  // JavaScript from the debug event handler.
2508  HandleScope scope(isolate_);
2509  Handle<Object> scheduled_exception;
2511  scheduled_exception = handle(isolate_->scheduled_exception(), isolate_);
2513  }
2514  OnException(exception, uncaught, isolate_->GetPromiseOnStackOnThrow());
2515  if (!scheduled_exception.is_null()) {
2516  isolate_->thread_local_top()->scheduled_exception_ = *scheduled_exception;
2517  }
2518 }
void clear_scheduled_exception()
Definition: isolate.h:631
Object * scheduled_exception()
Definition: isolate.h:622
ThreadLocalTop * thread_local_top()
Definition: isolate.h:878
Handle< Object > GetPromiseOnStackOnThrow()
Definition: isolate.cc:1308

References v8::internal::Isolate::clear_scheduled_exception(), v8::internal::Isolate::GetPromiseOnStackOnThrow(), v8::internal::handle(), v8::internal::Isolate::has_scheduled_exception(), ignore_events(), in_debug_scope(), v8::internal::Handle< T >::is_null(), isolate_, OnException(), v8::internal::Isolate::scheduled_exception(), and v8::internal::Isolate::thread_local_top().

Referenced by v8::internal::Isolate::DoThrow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrepareForBreakPoints()

void v8::internal::Debug::PrepareForBreakPoints ( )

Definition at line 1907 of file debug.cc.

1907  {
1908  // If preparing for the first break point make sure to deoptimize all
1909  // functions as debugging does not work with optimized code.
1910  if (!has_break_points_) {
1913  }
1914 
1916 
1917  Handle<Code> lazy_compile = isolate_->builtins()->CompileLazy();
1918 
1919  // There will be at least one break point when we are done.
1920  has_break_points_ = true;
1921 
1922  // Keep the list of activated functions in a handlified list as it
1923  // is used both in GC and non-GC code.
1924  List<Handle<JSFunction> > active_functions(100);
1925 
1926  // A list of all suspended generators.
1927  List<Handle<JSGeneratorObject> > suspended_generators;
1928 
1929  // A list of all generator functions. We need to recompile all functions,
1930  // but we don't know until after visiting the whole heap which generator
1931  // functions have suspended activations and which do not. As in the case of
1932  // functions with activations on the stack, we need to be careful with
1933  // generator functions with suspended activations because although they
1934  // should be recompiled, recompilation can fail, and we need to avoid
1935  // leaving the heap in an inconsistent state.
1936  //
1937  // We could perhaps avoid this list and instead re-use the GC metadata
1938  // links.
1939  List<Handle<JSFunction> > generator_functions;
1940 
1941  {
1942  // We are going to iterate heap to find all functions without
1943  // debug break slots.
1944  Heap* heap = isolate_->heap();
1946  "preparing for breakpoints");
1947  HeapIterator iterator(heap);
1948 
1949  // Ensure no GC in this scope as we are going to use gc_metadata
1950  // field in the Code object to mark active functions.
1951  DisallowHeapAllocation no_allocation;
1952 
1953  Object* active_code_marker = heap->the_hole_value();
1954 
1957  &active_functions,
1958  active_code_marker);
1959  ActiveFunctionsCollector active_functions_collector(&active_functions,
1960  active_code_marker);
1962  &active_functions_collector);
1963 
1964  // Scan the heap for all non-optimized functions which have no
1965  // debug break slots and are not active or inlined into an active
1966  // function and mark them for lazy compilation.
1967  HeapObject* obj = NULL;
1968  while (((obj = iterator.next()) != NULL)) {
1969  if (obj->IsJSFunction()) {
1970  JSFunction* function = JSFunction::cast(obj);
1971  SharedFunctionInfo* shared = function->shared();
1972 
1973  if (!shared->allows_lazy_compilation()) continue;
1974  if (!shared->script()->IsScript()) continue;
1975  if (function->IsFromNativeScript()) continue;
1976  if (shared->code()->gc_metadata() == active_code_marker) continue;
1977 
1978  if (shared->is_generator()) {
1979  generator_functions.Add(Handle<JSFunction>(function, isolate_));
1980  continue;
1981  }
1982 
1983  Code::Kind kind = function->code()->kind();
1984  if (kind == Code::FUNCTION &&
1985  !function->code()->has_debug_break_slots()) {
1986  function->ReplaceCode(*lazy_compile);
1987  function->shared()->ReplaceCode(*lazy_compile);
1988  } else if (kind == Code::BUILTIN &&
1989  (function->IsInOptimizationQueue() ||
1990  function->IsMarkedForOptimization() ||
1991  function->IsMarkedForConcurrentOptimization())) {
1992  // Abort in-flight compilation.
1993  Code* shared_code = function->shared()->code();
1994  if (shared_code->kind() == Code::FUNCTION &&
1995  shared_code->has_debug_break_slots()) {
1996  function->ReplaceCode(shared_code);
1997  } else {
1998  function->ReplaceCode(*lazy_compile);
1999  function->shared()->ReplaceCode(*lazy_compile);
2000  }
2001  }
2002  } else if (obj->IsJSGeneratorObject()) {
2003  JSGeneratorObject* gen = JSGeneratorObject::cast(obj);
2004  if (!gen->is_suspended()) continue;
2005 
2006  JSFunction* fun = gen->function();
2007  DCHECK_EQ(fun->code()->kind(), Code::FUNCTION);
2008  if (fun->code()->has_debug_break_slots()) continue;
2009 
2010  int pc_offset = gen->continuation();
2011  DCHECK_LT(0, pc_offset);
2012 
2013  int code_offset =
2014  ComputeCodeOffsetFromPcOffset(fun->code(), pc_offset);
2015 
2016  // This will be fixed after we recompile the functions.
2017  gen->set_continuation(code_offset);
2018 
2019  suspended_generators.Add(Handle<JSGeneratorObject>(gen, isolate_));
2020  }
2021  }
2022 
2023  // Clear gc_metadata field.
2024  for (int i = 0; i < active_functions.length(); i++) {
2025  Handle<JSFunction> function = active_functions[i];
2026  function->shared()->code()->set_gc_metadata(Smi::FromInt(0));
2027  }
2028  }
2029 
2030  // Recompile generator functions that have suspended activations, and
2031  // relocate those activations.
2032  RecompileAndRelocateSuspendedGenerators(suspended_generators);
2033 
2034  // Mark generator functions that didn't have suspended activations for lazy
2035  // recompilation. Note that this set does not include any active functions.
2036  for (int i = 0; i < generator_functions.length(); i++) {
2037  Handle<JSFunction> &function = generator_functions[i];
2038  if (function->code()->kind() != Code::FUNCTION) continue;
2039  if (function->code()->has_debug_break_slots()) continue;
2040  function->ReplaceCode(*lazy_compile);
2041  function->shared()->ReplaceCode(*lazy_compile);
2042  }
2043 
2044  // Now recompile all functions with activation frames and and
2045  // patch the return address to run in the new compiled code. It could be
2046  // that some active functions were recompiled already by the suspended
2047  // generator recompilation pass above; a generator with suspended
2048  // activations could also have active activations. That's fine.
2049  for (int i = 0; i < active_functions.length(); i++) {
2050  Handle<JSFunction> function = active_functions[i];
2051  Handle<SharedFunctionInfo> shared(function->shared());
2052 
2053  // If recompilation is not possible just skip it.
2054  if (shared->is_toplevel()) continue;
2055  if (!shared->allows_lazy_compilation()) continue;
2056  if (shared->code()->kind() == Code::BUILTIN) continue;
2057 
2059  }
2060 
2063 
2064  ActiveFunctionsRedirector active_functions_redirector;
2066  &active_functions_redirector);
2067  }
2068 }
#define BUILTIN(name)
Definition: builtins.cc:122
static void DeoptimizeAll(Isolate *isolate)
Definition: deoptimizer.cc:437
static const int kMakeHeapIterableMask
Definition: heap.h:721
Builtins * builtins()
Definition: isolate.h:947
OptimizingCompilerThread * optimizing_compiler_thread()
Definition: isolate.h:1059
ThreadManager * thread_manager()
Definition: isolate.h:921
bool concurrent_recompilation_enabled()
Definition: isolate.h:1045
void IterateArchivedThreads(ThreadVisitor *v)
Definition: v8threads.cc:342
#define DCHECK_LT(v1, v2)
Definition: logging.h:209
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110
static void RecompileAndRelocateSuspendedGenerators(const List< Handle< JSGeneratorObject > > &generators)
Definition: debug.cc:1893
static int ComputeCodeOffsetFromPcOffset(Code *code, int pc_offset)
Definition: debug.cc:1737
static void RedirectActivationsToRecompiledCodeOnThread(Isolate *isolate, ThreadLocalTop *top)
Definition: debug.cc:1786
static void CollectActiveFunctionsFromThread(Isolate *isolate, ThreadLocalTop *top, List< Handle< JSFunction > > *active_functions, Object *active_code_marker)
Definition: debug.cc:1704
static void EnsureFunctionHasDebugBreakSlots(Handle< JSFunction > function)
Definition: debug.cc:1874

References v8::internal::List< T, AllocationPolicy >::Add(), BUILTIN, v8::internal::Isolate::builtins(), v8::internal::JSFunction::code(), v8::internal::CollectActiveFunctionsFromThread(), v8::internal::Heap::CollectAllGarbage(), v8::internal::ComputeCodeOffsetFromPcOffset(), v8::internal::Isolate::concurrent_recompilation_enabled(), v8::internal::JSGeneratorObject::continuation(), DCHECK_EQ, DCHECK_LT, v8::internal::Deoptimizer::DeoptimizeAll(), v8::internal::EnsureFunctionHasDebugBreakSlots(), v8::internal::OptimizingCompilerThread::Flush(), v8::internal::Smi::FromInt(), has_break_points_, v8::internal::Code::has_debug_break_slots(), v8::internal::Isolate::heap(), v8::internal::JSGeneratorObject::is_suspended(), isolate_, v8::internal::ThreadManager::IterateArchivedThreads(), v8::internal::Code::kind(), v8::internal::Heap::kMakeHeapIterableMask, NULL, v8::internal::Isolate::optimizing_compiler_thread(), v8::internal::RecompileAndRelocateSuspendedGenerators(), v8::internal::RedirectActivationsToRecompiledCodeOnThread(), v8::internal::JSGeneratorObject::set_continuation(), v8::internal::Isolate::thread_local_top(), and v8::internal::Isolate::thread_manager().

Referenced by FloodWithOneShot(), IsBreakAtReturn(), PrepareStep(), SetAfterBreakTarget(), SetBreakPoint(), and SetBreakPointForScript().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrepareStep()

void v8::internal::Debug::PrepareStep ( StepAction  step_action,
int  step_count,
StackFrame::Id  frame_id 
)

Definition at line 1276 of file debug.cc.

1278  {
1279  HandleScope scope(isolate_);
1280 
1282 
1284 
1285  // Remember this step action and count.
1286  thread_local_.last_step_action_ = step_action;
1287  if (step_action == StepOut) {
1288  // For step out target frame will be found on the stack so there is no need
1289  // to set step counter for it. It's expected to always be 0 for StepOut.
1291  } else {
1292  thread_local_.step_count_ = step_count;
1293  }
1294 
1295  // Get the frame where the execution has stopped and skip the debug frame if
1296  // any. The debug frame will only be present if execution was stopped due to
1297  // hitting a break point. In other situations (e.g. unhandled exception) the
1298  // debug frame is not present.
1299  StackFrame::Id id = break_frame_id();
1300  if (id == StackFrame::NO_ID) {
1301  // If there is no JavaScript stack don't do anything.
1302  return;
1303  }
1304  if (frame_id != StackFrame::NO_ID) {
1305  id = frame_id;
1306  }
1307  JavaScriptFrameIterator frames_it(isolate_, id);
1308  JavaScriptFrame* frame = frames_it.frame();
1309 
1310  // First of all ensure there is one-shot break points in the top handler
1311  // if any.
1313 
1314  // If the function on the top frame is unresolved perform step out. This will
1315  // be the case when calling unknown functions and having the debugger stopped
1316  // in an unhandled exception.
1317  if (!frame->function()->IsJSFunction()) {
1318  // Step out: Find the calling JavaScript frame and flood it with
1319  // breakpoints.
1320  frames_it.Advance();
1321  // Fill the function to return to with one-shot break points.
1322  JSFunction* function = frames_it.frame()->function();
1323  FloodWithOneShot(Handle<JSFunction>(function));
1324  return;
1325  }
1326 
1327  // Get the debug info (create it if it does not exist).
1328  Handle<JSFunction> function(frame->function());
1329  Handle<SharedFunctionInfo> shared(function->shared());
1330  if (!EnsureDebugInfo(shared, function)) {
1331  // Return if ensuring debug info failed.
1332  return;
1333  }
1334  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1335 
1336  // Find the break location where execution has stopped.
1337  BreakLocationIterator it(debug_info, ALL_BREAK_LOCATIONS);
1338  // pc points to the instruction after the current one, possibly a break
1339  // location as well. So the "- 1" to exclude it from the search.
1340  it.FindBreakLocationFromAddress(frame->pc() - 1);
1341 
1342  // Compute whether or not the target is a call target.
1343  bool is_load_or_store = false;
1344  bool is_inline_cache_stub = false;
1345  bool is_at_restarted_function = false;
1346  Handle<Code> call_function_stub;
1347 
1349  if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
1350  bool is_call_target = false;
1351  Address target = it.rinfo()->target_address();
1352  Code* code = Code::GetCodeFromTargetAddress(target);
1353  if (code->is_call_stub()) {
1354  is_call_target = true;
1355  }
1356  if (code->is_inline_cache_stub()) {
1357  is_inline_cache_stub = true;
1358  is_load_or_store = !is_call_target;
1359  }
1360 
1361  // Check if target code is CallFunction stub.
1362  Code* maybe_call_function_stub = code;
1363  // If there is a breakpoint at this line look at the original code to
1364  // check if it is a CallFunction stub.
1365  if (it.IsDebugBreak()) {
1366  Address original_target = it.original_rinfo()->target_address();
1367  maybe_call_function_stub =
1368  Code::GetCodeFromTargetAddress(original_target);
1369  }
1370  if ((maybe_call_function_stub->kind() == Code::STUB &&
1371  CodeStub::GetMajorKey(maybe_call_function_stub) ==
1372  CodeStub::CallFunction) ||
1373  maybe_call_function_stub->kind() == Code::CALL_IC) {
1374  // Save reference to the code as we may need it to find out arguments
1375  // count for 'step in' later.
1376  call_function_stub = Handle<Code>(maybe_call_function_stub);
1377  }
1378  }
1379  } else {
1380  is_at_restarted_function = true;
1381  }
1382 
1383  // If this is the last break code target step out is the only possibility.
1384  if (it.IsExit() || step_action == StepOut) {
1385  if (step_action == StepOut) {
1386  // Skip step_count frames starting with the current one.
1387  while (step_count-- > 0 && !frames_it.done()) {
1388  frames_it.Advance();
1389  }
1390  } else {
1391  DCHECK(it.IsExit());
1392  frames_it.Advance();
1393  }
1394  // Skip builtin functions on the stack.
1395  while (!frames_it.done() &&
1396  frames_it.frame()->function()->IsFromNativeScript()) {
1397  frames_it.Advance();
1398  }
1399  // Step out: If there is a JavaScript caller frame, we need to
1400  // flood it with breakpoints.
1401  if (!frames_it.done()) {
1402  // Fill the function to return to with one-shot break points.
1403  JSFunction* function = frames_it.frame()->function();
1404  FloodWithOneShot(Handle<JSFunction>(function));
1405  // Set target frame pointer.
1406  ActivateStepOut(frames_it.frame());
1407  }
1408  } else if (!(is_inline_cache_stub || RelocInfo::IsConstructCall(it.rmode()) ||
1409  !call_function_stub.is_null() || is_at_restarted_function)
1410  || step_action == StepNext || step_action == StepMin) {
1411  // Step next or step min.
1412 
1413  // Fill the current function with one-shot break points.
1414  FloodWithOneShot(function);
1415 
1416  // Remember source position and frame to handle step next.
1418  debug_info->code()->SourceStatementPosition(frame->pc());
1419  thread_local_.last_fp_ = frame->UnpaddedFP();
1420  } else {
1421  // If there's restarter frame on top of the stack, just get the pointer
1422  // to function which is going to be restarted.
1423  if (is_at_restarted_function) {
1424  Handle<JSFunction> restarted_function(
1426  FloodWithOneShot(restarted_function);
1427  } else if (!call_function_stub.is_null()) {
1428  // If it's CallFunction stub ensure target function is compiled and flood
1429  // it with one shot breakpoints.
1430  bool is_call_ic = call_function_stub->kind() == Code::CALL_IC;
1431 
1432  // Find out number of arguments from the stub minor key.
1433  uint32_t key = call_function_stub->stub_key();
1434  // Argc in the stub is the number of arguments passed - not the
1435  // expected arguments of the called function.
1436  int call_function_arg_count = is_call_ic
1437  ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key))
1438  : CallFunctionStub::ExtractArgcFromMinorKey(
1439  CodeStub::MinorKeyFromKey(key));
1440 
1441  DCHECK(is_call_ic ||
1442  CodeStub::GetMajorKey(*call_function_stub) ==
1443  CodeStub::MajorKeyFromKey(key));
1444 
1445  // Find target function on the expression stack.
1446  // Expression stack looks like this (top to bottom):
1447  // argN
1448  // ...
1449  // arg0
1450  // Receiver
1451  // Function to call
1452  int expressions_count = frame->ComputeExpressionsCount();
1453  DCHECK(expressions_count - 2 - call_function_arg_count >= 0);
1454  Object* fun = frame->GetExpression(
1455  expressions_count - 2 - call_function_arg_count);
1456 
1457  // Flood the actual target of call/apply.
1458  if (fun->IsJSFunction()) {
1459  Isolate* isolate = JSFunction::cast(fun)->GetIsolate();
1460  Code* apply = isolate->builtins()->builtin(Builtins::kFunctionApply);
1461  Code* call = isolate->builtins()->builtin(Builtins::kFunctionCall);
1462  while (fun->IsJSFunction()) {
1463  Code* code = JSFunction::cast(fun)->shared()->code();
1464  if (code != apply && code != call) break;
1465  fun = frame->GetExpression(
1466  expressions_count - 1 - call_function_arg_count);
1467  }
1468  }
1469 
1470  if (fun->IsJSFunction()) {
1471  Handle<JSFunction> js_function(JSFunction::cast(fun));
1472  if (js_function->shared()->bound()) {
1474  } else if (!js_function->IsFromNativeScript()) {
1475  // Don't step into builtins.
1476  // It will also compile target function if it's not compiled yet.
1477  FloodWithOneShot(js_function);
1478  }
1479  }
1480  }
1481 
1482  // Fill the current function with one-shot break points even for step in on
1483  // a call target as the function called might be a native function for
1484  // which step in will not stop. It also prepares for stepping in
1485  // getters/setters.
1486  FloodWithOneShot(function);
1487 
1488  if (is_load_or_store) {
1489  // Remember source position and frame to handle step in getter/setter. If
1490  // there is a custom getter/setter it will be handled in
1491  // Object::Get/SetPropertyWithAccessor, otherwise the step action will be
1492  // propagated on the next Debug::Break.
1494  debug_info->code()->SourceStatementPosition(frame->pc());
1495  thread_local_.last_fp_ = frame->UnpaddedFP();
1496  }
1497 
1498  // Step in or Step in min
1499  it.PrepareStepIn(isolate_);
1500  ActivateStepIn(frame);
1501  }
1502 }
static int ExtractArgcFromMinorKey(int minor_key)
Definition: code-stubs.h:797
void ActivateStepIn(StackFrame *frame)
Definition: debug.cc:1675
void ActivateStepOut(StackFrame *frame)
Definition: debug.cc:1686
void FloodHandlerWithOneShot()
Definition: debug.cc:1229
static bool IsCodeTarget(Mode mode)
Definition: assembler.h:399
static bool IsConstructCall(Mode mode)
Definition: assembler.h:396
@ StepMin
Definition: debug.h:38

References ActivateStepIn(), ActivateStepOut(), v8::internal::ALL_BREAK_LOCATIONS, break_frame_id(), v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), v8::internal::StandardFrame::ComputeExpressionsCount(), DCHECK, EnsureDebugInfo(), v8::internal::CallICStub::ExtractArgcFromMinorKey(), v8::internal::CallFunctionStub::ExtractArgcFromMinorKey(), v8::internal::BreakLocationIterator::FindBreakLocationFromAddress(), FloodBoundFunctionWithOneShot(), FloodHandlerWithOneShot(), FloodWithOneShot(), v8::internal::JavaScriptFrame::function(), v8::internal::Code::GetCodeFromTargetAddress(), GetDebugInfo(), v8::internal::StandardFrame::GetExpression(), in_debug_scope(), v8::internal::Code::is_call_stub(), v8::internal::Code::is_inline_cache_stub(), v8::internal::Handle< T >::is_null(), v8::internal::RelocInfo::IsCodeTarget(), v8::internal::RelocInfo::IsConstructCall(), v8::internal::BreakLocationIterator::IsDebugBreak(), v8::internal::BreakLocationIterator::IsExit(), isolate_, v8::internal::Code::kind(), v8::internal::Debug::ThreadLocal::last_fp_, v8::internal::Debug::ThreadLocal::last_statement_position_, v8::internal::Debug::ThreadLocal::last_step_action_, NULL, v8::internal::BreakLocationIterator::original_rinfo(), PrepareForBreakPoints(), v8::internal::BreakLocationIterator::PrepareStepIn(), v8::internal::Debug::ThreadLocal::restarter_frame_function_pointer_, v8::internal::BreakLocationIterator::rinfo(), v8::internal::RelocInfo::rmode(), v8::internal::BreakLocationIterator::rmode(), v8::internal::Debug::ThreadLocal::step_count_, v8::internal::StepMin, v8::internal::StepNext, v8::internal::StepOut, v8::internal::STUB, and thread_local_.

Referenced by Break().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessDebugEvent()

void v8::internal::Debug::ProcessDebugEvent ( v8::DebugEvent  event,
Handle< JSObject event_data,
bool  auto_continue 
)
private

Definition at line 2709 of file debug.cc.

2711  {
2712  HandleScope scope(isolate_);
2713 
2714  // Create the execution state.
2715  Handle<Object> exec_state;
2716  // Bail out and don't call debugger if exception.
2717  if (!MakeExecutionState().ToHandle(&exec_state)) return;
2718 
2719  // First notify the message handler if any.
2720  if (message_handler_ != NULL) {
2721  NotifyMessageHandler(event,
2722  Handle<JSObject>::cast(exec_state),
2723  event_data,
2724  auto_continue);
2725  }
2726  // Notify registered debug event listener. This can be either a C or
2727  // a JavaScript function. Don't call event listener for v8::Break
2728  // here, if it's only a debug command -- they will be processed later.
2729  if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) {
2730  CallEventCallback(event, exec_state, event_data, NULL);
2731  }
2732  // Process pending debug commands.
2733  if (event == v8::Break) {
2734  while (!event_command_queue_.IsEmpty()) {
2735  CommandMessage command = event_command_queue_.Get();
2736  if (!event_listener_.is_null()) {
2738  exec_state,
2739  event_data,
2740  command.client_data());
2741  }
2742  command.Dispose();
2743  }
2744  }
2745 }
void NotifyMessageHandler(v8::DebugEvent event, Handle< JSObject > exec_state, Handle< JSObject > event_data, bool auto_continue)
Definition: debug.cc:2785
void CallEventCallback(v8::DebugEvent event, Handle< Object > exec_state, Handle< Object > event_data, v8::Debug::ClientData *client_data)
Definition: debug.cc:2748

References v8::Break, v8::BreakForCommand, CallEventCallback(), v8::internal::CommandMessage::client_data(), v8::internal::CommandMessage::Dispose(), event_command_queue_, event_listener_, isolate_, MakeExecutionState(), message_handler_, NotifyMessageHandler(), and NULL.

Referenced by OnAfterCompile(), OnAsyncTaskEvent(), OnBeforeCompile(), OnCompileError(), OnDebugBreak(), OnException(), and OnPromiseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessDebugMessages()

void v8::internal::Debug::ProcessDebugMessages ( bool  debug_command_only)

Definition at line 3057 of file debug.cc.

3057  {
3058  isolate_->stack_guard()->ClearDebugCommand();
3059 
3060  StackLimitCheck check(isolate_);
3061  if (check.HasOverflowed()) return;
3062 
3063  HandleScope scope(isolate_);
3064  DebugScope debug_scope(this);
3065  if (debug_scope.failed()) return;
3066 
3067  // Notify the debug event listeners. Indicate auto continue if the break was
3068  // a debug command break.
3069  OnDebugBreak(isolate_->factory()->undefined_value(), debug_command_only);
3070 }

References DebugScope, v8::internal::Isolate::factory(), isolate_, OnDebugBreak(), and v8::internal::Isolate::stack_guard().

Referenced by HandleDebugBreak().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PromiseHasRejectHandler()

bool v8::internal::Debug::PromiseHasRejectHandler ( Handle< JSObject promise)
private

Definition at line 1265 of file debug.cc.

1265  {
1266  Handle<JSFunction> fun = Handle<JSFunction>::cast(
1268  isolate_->factory()->NewStringFromStaticChars(
1269  "PromiseHasRejectHandler")));
1270  Handle<Object> result =
1271  Execution::Call(isolate_, fun, promise, 0, NULL).ToHandleChecked();
1272  return result->IsTrue();
1273 }
static Handle< Object > GetDataProperty(Handle< JSObject > object, Handle< Name > key)
Definition: objects.cc:140

References v8::internal::Handle< T >::cast(), v8::internal::Isolate::factory(), v8::internal::JSObject::GetDataProperty(), isolate_, v8::internal::Isolate::js_builtins_object(), and NULL.

Referenced by OnException().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RecordEvalCaller()

void v8::internal::Debug::RecordEvalCaller ( Handle< Script script)
static

Definition at line 2419 of file debug.cc.

2419  {
2420  script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
2421  // For eval scripts add information on the function from which eval was
2422  // called.
2423  StackTraceFrameIterator it(script->GetIsolate());
2424  if (!it.done()) {
2425  script->set_eval_from_shared(it.frame()->function()->shared());
2426  Code* code = it.frame()->LookupCode();
2427  int offset = static_cast<int>(
2428  it.frame()->pc() - code->instruction_start());
2429  script->set_eval_from_instructions_offset(Smi::FromInt(offset));
2430  }
2431 }

References v8::internal::Script::COMPILATION_TYPE_EVAL, v8::internal::Smi::FromInt(), and v8::internal::Code::instruction_start().

Referenced by v8::internal::Compiler::GetFunctionFromEval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveDebugInfo()

void v8::internal::Debug::RemoveDebugInfo ( Handle< DebugInfo debug_info)
private

Definition at line 2208 of file debug.cc.

2208  {
2210  // Run through the debug info objects to find this one and remove it.
2211  DebugInfoListNode* prev = NULL;
2212  DebugInfoListNode* current = debug_info_list_;
2213  while (current != NULL) {
2214  if (*current->debug_info() == *debug_info) {
2215  // Unlink from list. If prev is NULL we are looking at the first element.
2216  if (prev == NULL) {
2217  debug_info_list_ = current->next();
2218  } else {
2219  prev->set_next(current->next());
2220  }
2221  current->debug_info()->shared()->set_debug_info(
2222  isolate_->heap()->undefined_value());
2223  delete current;
2224 
2225  // If there are no more debug info objects there are not more break
2226  // points.
2228 
2229  return;
2230  }
2231  // Move to next in list.
2232  prev = current;
2233  current = current->next();
2234  }
2235  UNREACHABLE();
2236 }
void set_next(DebugInfoListNode *next)
Definition: debug.h:187
DebugInfoListNode * next()
Definition: debug.h:186

References DCHECK, v8::internal::DebugInfoListNode::debug_info(), debug_info_list_, has_break_points_, v8::internal::Isolate::heap(), isolate_, v8::internal::DebugInfoListNode::next(), NULL, v8::internal::DebugInfoListNode::set_next(), and UNREACHABLE.

Referenced by ClearAllBreakPoints(), ClearBreakPoint(), and HandleWeakDebugInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restarter_frame_function_pointer_address()

Address v8::internal::Debug::restarter_frame_function_pointer_address ( )
inline

Definition at line 485 of file debug.h.

485  {
487  return reinterpret_cast<Address>(address);
488  }

References v8::internal::Debug::ThreadLocal::restarter_frame_function_pointer_, and thread_local_.

◆ RestoreDebug()

char * v8::internal::Debug::RestoreDebug ( char *  from)

Definition at line 579 of file debug.cc.

579  {
580  char* from = storage;
581  MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
582  return storage + ArchiveSpacePerThread();
583 }

References ArchiveSpacePerThread(), v8::internal::MemCopy(), and thread_local_.

Referenced by v8::internal::ThreadManager::RestoreThread().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_disable_break()

void v8::internal::Debug::set_disable_break ( bool  v)
inline

Definition at line 471 of file debug.h.

471 { break_disabled_ = v; }

References break_disabled_.

◆ set_live_edit_enabled()

void v8::internal::Debug::set_live_edit_enabled ( bool  v)
inline

Definition at line 460 of file debug.h.

460 { live_edit_enabled_ = v; }

References live_edit_enabled_.

Referenced by v8::Debug::SetLiveEditEnabled().

+ Here is the caller graph for this function:

◆ SetAfterBreakTarget()

void v8::internal::Debug::SetAfterBreakTarget ( JavaScriptFrame frame)

Definition at line 2239 of file debug.cc.

2239  {
2241 
2242  if (LiveEdit::SetAfterBreakTarget(this)) return; // LiveEdit did the job.
2243 
2244  HandleScope scope(isolate_);
2246 
2247  // Get the executing function in which the debug break occurred.
2248  Handle<JSFunction> function(JSFunction::cast(frame->function()));
2249  Handle<SharedFunctionInfo> shared(function->shared());
2250  if (!EnsureDebugInfo(shared, function)) {
2251  // Return if we failed to retrieve the debug info.
2252  return;
2253  }
2254  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
2255  Handle<Code> code(debug_info->code());
2256  Handle<Code> original_code(debug_info->original_code());
2257 #ifdef DEBUG
2258  // Get the code which is actually executing.
2259  Handle<Code> frame_code(frame->LookupCode());
2260  DCHECK(frame_code.is_identical_to(code));
2261 #endif
2262 
2263  // Find the call address in the running code. This address holds the call to
2264  // either a DebugBreakXXX or to the debug break return entry code if the
2265  // break point is still active after processing the break point.
2267 
2268  // Check if the location is at JS exit or debug break slot.
2269  bool at_js_return = false;
2270  bool break_at_js_return_active = false;
2271  bool at_debug_break_slot = false;
2272  RelocIterator it(debug_info->code());
2273  while (!it.done() && !at_js_return && !at_debug_break_slot) {
2274  if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
2275  at_js_return = (it.rinfo()->pc() ==
2277  break_at_js_return_active = it.rinfo()->IsPatchedReturnSequence();
2278  }
2279  if (RelocInfo::IsDebugBreakSlot(it.rinfo()->rmode())) {
2280  at_debug_break_slot = (it.rinfo()->pc() ==
2282  }
2283  it.next();
2284  }
2285 
2286  // Handle the jump to continue execution after break point depending on the
2287  // break location.
2288  if (at_js_return) {
2289  // If the break point as return is still active jump to the corresponding
2290  // place in the original code. If not the break point was removed during
2291  // break point processing.
2292  if (break_at_js_return_active) {
2293  addr += original_code->instruction_start() - code->instruction_start();
2294  }
2295 
2296  // Move back to where the call instruction sequence started.
2298  } else if (at_debug_break_slot) {
2299  // Address of where the debug break slot starts.
2301 
2302  // Continue just after the slot.
2304  } else {
2306  if (IsDebugBreak(Assembler::target_address_at(addr, *code))) {
2307  // We now know that there is still a debug break call at the target
2308  // address, so the break point is still there and the original code will
2309  // hold the address to jump to in order to complete the call which is
2310  // replaced by a call to DebugBreakXXX.
2311 
2312  // Find the corresponding address in the original code.
2313  addr += original_code->instruction_start() - code->instruction_start();
2314 
2315  // Install jump to the call address in the original code. This will be the
2316  // call which was overwritten by the call to DebugBreakXXX.
2317  after_break_target_ = Assembler::target_address_at(addr, *original_code);
2318  } else {
2319  // There is no longer a break point present. Don't try to look in the
2320  // original code as the running code will have the right address. This
2321  // takes care of the case where the last break point is removed from the
2322  // function and therefore no "original code" is available.
2324  }
2325  }
2326 }
static Address target_address_at(Address pc, ConstantPoolArray *constant_pool)
static const int kPatchDebugBreakSlotAddressOffset
static Address target_address_from_return_address(Address pc)
static const int kDebugBreakSlotLength
static bool IsDebugBreak(Address addr)
Definition: debug.cc:1541
static bool SetAfterBreakTarget(Debug *debug)
Definition: liveedit.cc:813
static bool IsDebugBreakSlot(Mode mode)
Definition: assembler.h:436

References after_break_target_, v8::internal::Assembler::break_address_from_return_address(), DCHECK, v8::internal::RelocIterator::done(), EnsureDebugInfo(), v8::internal::JavaScriptFrame::function(), GetDebugInfo(), IsDebugBreak(), v8::internal::RelocInfo::IsDebugBreakSlot(), v8::internal::RelocInfo::IsJSReturn(), isolate_, v8::internal::Assembler::kDebugBreakSlotLength, v8::internal::Assembler::kPatchDebugBreakSlotAddressOffset, v8::internal::Assembler::kPatchReturnSequenceAddressOffset, v8::internal::RelocIterator::next(), NULL, v8::internal::RelocInfo::pc(), PrepareForBreakPoints(), v8::internal::RelocIterator::rinfo(), v8::internal::RelocInfo::rmode(), v8::internal::LiveEdit::SetAfterBreakTarget(), v8::internal::Assembler::target_address_at(), and v8::internal::Assembler::target_address_from_return_address().

+ Here is the call graph for this function:

◆ SetBreakPoint()

bool v8::internal::Debug::SetBreakPoint ( Handle< JSFunction function,
Handle< Object break_point_object,
int source_position 
)

Definition at line 1075 of file debug.cc.

1077  {
1078  HandleScope scope(isolate_);
1079 
1081 
1082  // Make sure the function is compiled and has set up the debug info.
1083  Handle<SharedFunctionInfo> shared(function->shared());
1084  if (!EnsureDebugInfo(shared, function)) {
1085  // Return if retrieving debug info failed.
1086  return true;
1087  }
1088 
1089  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1090  // Source positions starts with zero.
1091  DCHECK(*source_position >= 0);
1092 
1093  // Find the break point and change it.
1094  BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1095  it.FindBreakLocationFromPosition(*source_position, STATEMENT_ALIGNED);
1096  it.SetBreakPoint(break_point_object);
1097 
1098  *source_position = it.position();
1099 
1100  // At least one active break point now.
1101  return debug_info->GetBreakPointCount() > 0;
1102 }

References DCHECK, EnsureDebugInfo(), v8::internal::BreakLocationIterator::FindBreakLocationFromPosition(), GetDebugInfo(), isolate_, v8::internal::BreakLocationIterator::position(), PrepareForBreakPoints(), v8::internal::BreakLocationIterator::SetBreakPoint(), v8::internal::SOURCE_BREAK_LOCATIONS, and v8::internal::STATEMENT_ALIGNED.

+ Here is the call graph for this function:

◆ SetBreakPointForScript()

bool v8::internal::Debug::SetBreakPointForScript ( Handle< Script script,
Handle< Object break_point_object,
int source_position,
BreakPositionAlignment  alignment 
)

Definition at line 1105 of file debug.cc.

1108  {
1109  HandleScope scope(isolate_);
1110 
1112 
1113  // Obtain shared function info for the function.
1114  Object* result = FindSharedFunctionInfoInScript(script, *source_position);
1115  if (result->IsUndefined()) return false;
1116 
1117  // Make sure the function has set up the debug info.
1118  Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result));
1119  if (!EnsureDebugInfo(shared, Handle<JSFunction>::null())) {
1120  // Return if retrieving debug info failed.
1121  return false;
1122  }
1123 
1124  // Find position within function. The script position might be before the
1125  // source position of the first function.
1126  int position;
1127  if (shared->start_position() > *source_position) {
1128  position = 0;
1129  } else {
1130  position = *source_position - shared->start_position();
1131  }
1132 
1133  Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1134  // Source positions starts with zero.
1135  DCHECK(position >= 0);
1136 
1137  // Find the break point and change it.
1138  BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
1139  it.FindBreakLocationFromPosition(position, alignment);
1140  it.SetBreakPoint(break_point_object);
1141 
1142  *source_position = it.position() + shared->start_position();
1143 
1144  // At least one active break point now.
1145  DCHECK(debug_info->GetBreakPointCount() > 0);
1146  return true;
1147 }
Object * FindSharedFunctionInfoInScript(Handle< Script > script, int position)
Definition: debug.cc:2071
static Handle< T > null()
Definition: handles.h:123

References DCHECK, EnsureDebugInfo(), v8::internal::BreakLocationIterator::FindBreakLocationFromPosition(), FindSharedFunctionInfoInScript(), GetDebugInfo(), isolate_, v8::internal::BreakLocationIterator::position(), PrepareForBreakPoints(), v8::internal::BreakLocationIterator::SetBreakPoint(), and v8::internal::SOURCE_BREAK_LOCATIONS.

+ Here is the call graph for this function:

◆ SetEventListener()

void v8::internal::Debug::SetEventListener ( Handle< Object callback,
Handle< Object data 
)

Definition at line 2921 of file debug.cc.

2922  {
2923  GlobalHandles* global_handles = isolate_->global_handles();
2924 
2925  // Remove existing entry.
2927  event_listener_ = Handle<Object>();
2929  event_listener_data_ = Handle<Object>();
2930 
2931  // Set new entry.
2932  if (!callback->IsUndefined() && !callback->IsNull()) {
2933  event_listener_ = global_handles->Create(*callback);
2934  if (data.is_null()) data = isolate_->factory()->undefined_value();
2935  event_listener_data_ = global_handles->Create(*data);
2936  }
2937 
2938  UpdateState();
2939 }
void UpdateState()
Definition: debug.cc:2954
static void Destroy(Object **location)

References v8::internal::GlobalHandles::Create(), v8::internal::GlobalHandles::Destroy(), event_listener_, event_listener_data_, v8::internal::Isolate::factory(), v8::internal::Isolate::global_handles(), v8::internal::Handle< T >::is_null(), isolate_, and UpdateState().

Referenced by v8::Debug::SetDebugEventListener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMessageHandler()

void v8::internal::Debug::SetMessageHandler ( v8::Debug::MessageHandler  handler)

Definition at line 2942 of file debug.cc.

2942  {
2943  message_handler_ = handler;
2944  UpdateState();
2945  if (handler == NULL && in_debug_scope()) {
2946  // Send an empty command to the debugger if in a break to make JavaScript
2947  // run again if the debugger is closed.
2949  }
2950 }
void EnqueueCommandMessage(Vector< const uint16_t > command, v8::Debug::ClientData *client_data=NULL)
Definition: debug.cc:2979
static Vector< T > empty()
Definition: vector.h:95

References EnqueueCommandMessage(), in_debug_scope(), message_handler_, NULL, and UpdateState().

Referenced by v8::Debug::SetMessageHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextBreakId()

void v8::internal::Debug::SetNextBreakId ( )
inlineprivate

◆ step_in_fp_addr()

Address v8::internal::Debug::step_in_fp_addr ( )
inline

Definition at line 490 of file debug.h.

490  {
491  return reinterpret_cast<Address>(&thread_local_.step_into_fp_);
492  }

References v8::internal::Debug::ThreadLocal::step_into_fp_, and thread_local_.

◆ StepInActive()

bool v8::internal::Debug::StepInActive ( )
inline

Definition at line 402 of file debug.h.

402 { return thread_local_.step_into_fp_ != 0; }

References v8::internal::Debug::ThreadLocal::step_into_fp_, and thread_local_.

Referenced by ActivateStepOut(), v8::internal::Object::GetPropertyWithDefinedGetter(), v8::internal::Runtime_NewObjectHelper(), and v8::internal::Object::SetPropertyWithDefinedSetter().

+ Here is the caller graph for this function:

◆ StepNextContinue()

bool v8::internal::Debug::StepNextContinue ( BreakLocationIterator break_location_iterator,
JavaScriptFrame frame 
)

Definition at line 1511 of file debug.cc.

1512  {
1513  // StepNext and StepOut shouldn't bring us deeper in code, so last frame
1514  // shouldn't be a parent of current frame.
1517  if (frame->fp() < thread_local_.last_fp_) return true;
1518  }
1519 
1520  // If the step last action was step next or step in make sure that a new
1521  // statement is hit.
1524  // Never continue if returning from function.
1525  if (break_location_iterator->IsExit()) return false;
1526 
1527  // Continue if we are still on the same frame and in the same statement.
1528  int current_statement_position =
1529  break_location_iterator->code()->SourceStatementPosition(frame->pc());
1530  return thread_local_.last_fp_ == frame->UnpaddedFP() &&
1531  thread_local_.last_statement_position_ == current_statement_position;
1532  }
1533 
1534  // No step next action - don't continue.
1535  return false;
1536 }
@ StepIn
Definition: debug.h:36

References v8::internal::BreakLocationIterator::code(), v8::internal::BreakLocationIterator::IsExit(), v8::internal::Debug::ThreadLocal::last_fp_, v8::internal::Debug::ThreadLocal::last_statement_position_, v8::internal::Debug::ThreadLocal::last_step_action_, v8::internal::Code::SourceStatementPosition(), v8::internal::StepIn, v8::internal::StepNext, v8::internal::StepOut, and thread_local_.

Referenced by Break().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StepOutActive()

bool v8::internal::Debug::StepOutActive ( )
inline

Definition at line 407 of file debug.h.

407 { return thread_local_.step_out_fp_ != 0; }

References v8::internal::Debug::ThreadLocal::step_out_fp_, and thread_local_.

Referenced by ActivateStepIn(), and Break().

+ Here is the caller graph for this function:

◆ ThreadInit()

void v8::internal::Debug::ThreadInit ( )
private

Definition at line 554 of file debug.cc.

References v8::internal::Debug::ThreadLocal::break_count_, v8::internal::Debug::ThreadLocal::break_frame_id_, v8::internal::Debug::ThreadLocal::break_id_, v8::internal::Debug::ThreadLocal::current_debug_scope_, v8::internal::RelocInfo::kNoPosition, v8::internal::Debug::ThreadLocal::last_fp_, v8::internal::Debug::ThreadLocal::last_statement_position_, v8::internal::Debug::ThreadLocal::last_step_action_, NULL, v8::internal::Debug::ThreadLocal::queued_step_count_, v8::internal::Debug::ThreadLocal::restarter_frame_function_pointer_, v8::internal::Debug::ThreadLocal::step_count_, v8::internal::Debug::ThreadLocal::step_into_fp_, v8::internal::Debug::ThreadLocal::step_out_fp_, v8::internal::StepNone, and thread_local_.

Referenced by ArchiveDebug(), and Debug().

+ Here is the caller graph for this function:

◆ Unload()

void v8::internal::Debug::Unload ( )
private

Definition at line 847 of file debug.cc.

847  {
849  ClearStepping();
850 
851  // Return debugger is not loaded.
852  if (!is_loaded()) return;
853 
854  // Clear the script cache.
855  if (script_cache_ != NULL) {
856  delete script_cache_;
858  }
859 
860  // Clear debugger context global handle.
862  debug_context_ = Handle<Context>();
863 }
void ClearAllBreakPoints()
Definition: debug.cc:1181

References ClearAllBreakPoints(), ClearStepping(), debug_context_, v8::internal::GlobalHandles::Destroy(), is_loaded(), NULL, and script_cache_.

Referenced by v8::internal::Isolate::Deinit(), and UpdateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateState()

void v8::internal::Debug::UpdateState ( )
private

Definition at line 2954 of file debug.cc.

2954  {
2955  is_active_ = message_handler_ != NULL || !event_listener_.is_null();
2956  if (is_active_ || in_debug_scope()) {
2957  // Note that the debug context could have already been loaded to
2958  // bootstrap test cases.
2960  is_active_ = Load();
2961  } else if (is_loaded()) {
2963  Unload();
2964  }
2965 }
CompilationCache * compilation_cache()
Definition: isolate.h:865

References v8::internal::Isolate::compilation_cache(), v8::internal::CompilationCache::Disable(), v8::internal::CompilationCache::Enable(), event_listener_, in_debug_scope(), is_active_, is_loaded(), isolate_, Load(), message_handler_, NULL, and Unload().

Referenced by SetEventListener(), and SetMessageHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CheckDebuggerUnloaded

void CheckDebuggerUnloaded ( bool  check_functions)
friend

◆ DebugScope

◆ DisableBreak

friend class DisableBreak
friend

Definition at line 648 of file debug.h.

Referenced by Load().

◆ GetDebuggedFunctions

Handle<FixedArray> GetDebuggedFunctions ( )
friend

◆ Isolate

friend class Isolate
friend

Definition at line 646 of file debug.h.

◆ LiveEdit

friend class LiveEdit
friend

Definition at line 649 of file debug.h.

◆ SuppressDebug

friend class SuppressDebug
friend

Definition at line 650 of file debug.h.

Referenced by Load().

Member Data Documentation

◆ after_break_target_

Address v8::internal::Debug::after_break_target_
private

◆ break_disabled_

bool v8::internal::Debug::break_disabled_
private

Definition at line 582 of file debug.h.

Referenced by Break(), HandleDebugBreak(), and set_disable_break().

◆ break_on_exception_

bool v8::internal::Debug::break_on_exception_
private

Definition at line 583 of file debug.h.

Referenced by ChangeBreakOnException(), IsBreakOnException(), and OnException().

◆ break_on_uncaught_exception_

bool v8::internal::Debug::break_on_uncaught_exception_
private

Definition at line 584 of file debug.h.

Referenced by ChangeBreakOnException(), IsBreakOnException(), and OnException().

◆ command_queue_

LockingCommandMessageQueue v8::internal::Debug::command_queue_
private

Definition at line 575 of file debug.h.

Referenced by EnqueueCommandMessage(), has_commands(), and NotifyMessageHandler().

◆ command_received_

base::Semaphore v8::internal::Debug::command_received_
private

Definition at line 574 of file debug.h.

Referenced by EnqueueCommandMessage(), and NotifyMessageHandler().

◆ debug_context_

Handle<Context> v8::internal::Debug::debug_context_
private

Definition at line 567 of file debug.h.

Referenced by debug_context(), is_loaded(), Load(), and Unload().

◆ debug_info_list_

DebugInfoListNode* v8::internal::Debug::debug_info_list_
private

◆ event_command_queue_

LockingCommandMessageQueue v8::internal::Debug::event_command_queue_
private

Definition at line 576 of file debug.h.

Referenced by EnqueueDebugCommand(), and ProcessDebugEvent().

◆ event_listener_

Handle<Object> v8::internal::Debug::event_listener_
private

Definition at line 568 of file debug.h.

Referenced by CallEventCallback(), ProcessDebugEvent(), SetEventListener(), and UpdateState().

◆ event_listener_data_

Handle<Object> v8::internal::Debug::event_listener_data_
private

Definition at line 569 of file debug.h.

Referenced by CallEventCallback(), and SetEventListener().

◆ has_break_points_

bool v8::internal::Debug::has_break_points_
private

◆ is_active_

bool v8::internal::Debug::is_active_
private

◆ is_suppressed_

bool v8::internal::Debug::is_suppressed_
private

Definition at line 579 of file debug.h.

Referenced by ignore_events(), and Load().

◆ isolate_

◆ kQueueInitialSize

const int v8::internal::Debug::kQueueInitialSize = 4
staticprivate

Definition at line 573 of file debug.h.

◆ live_edit_enabled_

bool v8::internal::Debug::live_edit_enabled_
private

Definition at line 580 of file debug.h.

Referenced by live_edit_enabled(), and set_live_edit_enabled().

◆ message_handler_

v8::Debug::MessageHandler v8::internal::Debug::message_handler_
private

Definition at line 571 of file debug.h.

Referenced by InvokeMessageHandler(), ProcessDebugEvent(), SetMessageHandler(), and UpdateState().

◆ script_cache_

ScriptCache* v8::internal::Debug::script_cache_
private

Definition at line 586 of file debug.h.

Referenced by GetLoadedScripts(), OnAfterCompile(), and Unload().

◆ thread_local_


The documentation for this class was generated from the following files: