v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
Unwinder Class Reference

#include <v8-unwinder.h>

Static Public Member Functions

static bool TryUnwindV8Frames (const JSEntryStubs &entry_stubs, size_t code_pages_length, const MemoryRange *code_pages, RegisterState *register_state, const void *stack_base)
 
static bool PCIsInV8 (size_t code_pages_length, const MemoryRange *code_pages, void *pc)
 

Detailed Description

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

The unwinder API is only supported on the x64, ARM64 and ARM32 architectures.

Definition at line 79 of file v8-unwinder.h.

Member Function Documentation

◆ PCIsInV8()

static bool PCIsInV8 ( size_t  code_pages_length,
const MemoryRange code_pages,
void *  pc 
)
static

Whether the PC is within the V8 code range represented by code_pages.

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.

Available on x64, ARM64 and ARM32

◆ TryUnwindV8Frames()

static bool TryUnwindV8Frames ( const JSEntryStubs entry_stubs,
size_t  code_pages_length,
const MemoryRange code_pages,
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.

Available on x64, ARM64 and ARM32.

Parameters
code_pagesA list of all of the ranges in which V8 has allocated executable code. The caller should obtain this list by calling Isolate::CopyCodePages() during the same interrupt/thread suspension that captures the stack.
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: