v8  10.1.124 (node 18.2.0)
V8 is Google's open source JavaScript engine
StackTrace Class Reference

#include <v8-debug.h>

Public Types

enum  StackTraceOptions {
  kLineNumber = 1 , kColumnOffset = 1 << 1 | kLineNumber , kScriptName = 1 << 2 , kFunctionName = 1 << 3 ,
  kIsEval = 1 << 4 , kIsConstructor = 1 << 5 , kScriptNameOrSourceURL = 1 << 6 , kScriptId = 1 << 7 ,
  kExposeFramesAcrossSecurityOrigins = 1 << 8 , kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName , kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
}
 

Public Member Functions

Local< StackFrameGetFrame (Isolate *isolate, uint32_t index) const
 
int GetFrameCount () const
 

Static Public Member Functions

static Local< StackTraceCurrentStackTrace (Isolate *isolate, int frame_limit, StackTraceOptions options=kDetailed)
 
static Local< StringCurrentScriptNameOrSourceURL (Isolate *isolate)
 

Detailed Description

Representation of a JavaScript stack trace. The information collected is a snapshot of the execution stack and the information remains valid after execution continues.

Definition at line 111 of file v8-debug.h.

Member Enumeration Documentation

◆ StackTraceOptions

Flags that determine what information is placed captured for each StackFrame when grabbing the current stack trace. Note: these options are deprecated and we always collect all available information (kDetailed).

Enumerator
kLineNumber 
kColumnOffset 
kScriptName 
kFunctionName 
kIsEval 
kIsConstructor 
kScriptNameOrSourceURL 
kScriptId 
kExposeFramesAcrossSecurityOrigins 
kOverview 
kDetailed 

Definition at line 119 of file v8-debug.h.

Member Function Documentation

◆ CurrentScriptNameOrSourceURL()

static Local<String> CurrentScriptNameOrSourceURL ( Isolate isolate)
static

Returns the first valid script name or source URL starting at the top of the JS stack. The returned string is either an empty handle if no script name/url was found or a non-zero-length string.

This method is equivalent to calling StackTrace::CurrentStackTrace and walking the resulting frames from the beginning until a non-empty script name/url is found. The difference is that this method won't allocate a stack trace.

◆ CurrentStackTrace()

static Local<StackTrace> CurrentStackTrace ( Isolate isolate,
int  frame_limit,
StackTraceOptions  options = kDetailed 
)
static

Grab a snapshot of the current JavaScript execution stack.

Parameters
frame_limitThe maximum number of stack frames we want to capture.
optionsEnumerates the set of things we will capture for each StackFrame.

◆ GetFrame()

Local<StackFrame> GetFrame ( Isolate isolate,
uint32_t  index 
) const

Returns a StackFrame at a particular index.

◆ GetFrameCount()

int GetFrameCount ( ) const

Returns the number of StackFrames.


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