v8  7.9.317 (node 13.2.0)
V8 is Google's open source JavaScript engine
Unwinder Class Reference

#include <v8.h>

Static Public Member Functions

static bool TryUnwindV8Frames (const UnwindState &unwind_state, RegisterState *register_state, const void *stack_base)
 
static bool PCIsInV8 (const UnwindState &unwind_state, void *pc)
 

Detailed Description

Various helpers for skipping over V8 frames in a given stack.

The unwinder API is only supported on the x64 architecture.

Definition at line 10129 of file v8.h.

Member Function Documentation

◆ PCIsInV8()

static bool PCIsInV8 ( const UnwindState unwind_state,
void *  pc 
)
static

Whether the PC is within the V8 code range represented by code_range or embedded_code_range in |unwind_state|.

If this returns false, then calling UnwindV8Frames() with the same PC and unwind_state will always fail. If it returns true, then unwinding may (but not necessarily) be successful.

◆ TryUnwindV8Frames()

static bool TryUnwindV8Frames ( const UnwindState unwind_state,
RegisterState register_state,
const void *  stack_base 
)
static

Attempt to unwind the stack to the most recent C++ frame. This function is signal-safe and does not access any V8 state and thus doesn't require an Isolate.

The unwinder needs to know the location of the JS Entry Stub (a piece of code that is run when C++ code calls into generated JS code). This is used for edge cases where the current frame is being constructed or torn down when the stack sample occurs.

The unwinder also needs the virtual memory range of all possible V8 code objects. There are two ranges required - the heap code range and the range for code embedded in the binary. The V8 API provides all required inputs via an UnwindState object through the Isolate::GetUnwindState() API. These values will not change after Isolate initialization, so the same |unwind_state| can be used for multiple calls.

Parameters
unwind_stateInput state for the Isolate that the stack comes from.
register_stateThe current registers. This is an in-out param that will be overwritten with the register values after unwinding, on success.
stack_baseThe resulting stack pointer and frame pointer values are bounds-checked against the stack_base and the original stack pointer value to ensure that they are valid locations in the given stack. If these values or any intermediate frame pointer values used during unwinding are ever out of these bounds, unwinding will fail.
Returns
True on success.

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