npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

frida-itrace

v6.0.0

Published

Instruction tracer powered by Frida

Readme

frida-itrace

Instruction tracer powered by Frida.

Example

import {
    TraceBuffer,
    TraceBufferReader,
    TraceSession,
} from "frida-itrace";

const strategy = {
    type: "thread",
    threadId: Process.enumerateThreads()[0].id,
};

const buffer = TraceBuffer.create();

const session = new TraceSession(strategy, buffer);
session.events.on("end", () => {
    send({ type: "itrace:end" });
});
session.open();

const reader = new TraceBufferReader(buffer);
setInterval(() => {
    const chunk = reader.read();
    if (chunk.byteLength === 0) return;
    send({ type: "itrace:chunk" }, chunk);
}, 10);

Buffer format

All data — both trace records and metadata events — is delivered through the ringbuffer. This means the buffer can be drained out-of-process (e.g. via shared memory on Darwin), and no data is lost if the target crashes.

Ringbuffer layout

offset 0:   uint64  head        (read cursor, owned by consumer)
offset 8:   uint64  tail        (write cursor, owned by producer)
offset 16:  uint64  lost        (records dropped due to full buffer)
offset 24:  uint64  capacity
offset 32:  uint8[] data

Trace records

Written at the end of each executed basic block. The first 8 bytes are the block's virtual address (always non-zero):

uint64_t block_address          (non-zero)
<register writes>               (layout defined by the compile event)

The total size of each trace record is given by the record_size field in the corresponding compile event.

Events

Events are distinguished from trace records by a zero sentinel in the first 8 bytes. All events share a common 16-byte header:

uint64_t sentinel = 0
uint32_t type
uint32_t payload_size           (bytes after header)

Event types:

| Type | Value | Description | |------|-------|-------------------------| | compile | 1 | Basic block compiled | | start | 2 | Tracing started | | end | 3 | Tracing ended | | panic | 4 | Fatal instrumentation error |

compile (type=1)

Emitted each time Stalker compiles a new basic block. Provides the metadata needed to parse subsequent trace records for that block.

uint64_t block_address
uint32_t block_size
uint32_t record_size            (trace record size for this block)
uint16_t num_writes
uint16_t name_size
uint64_t compiled_address
uint32_t compiled_size
uint64_t module_base            (0 if no module)
uint16_t module_path_size       (0 if no module)
uint16_t reserved
write[num_writes]:
    uint32_t block_offset
    uint32_t reg_index
char     name[name_size]
char     module_path[module_path_size]
uint8_t  code[block_size]

start (type=2)

Emitted once when the first block executes. Contains the register schema and initial CPU context.

uint32_t num_regs
uint32_t context_size
reg_spec[num_regs]:             (8 bytes each)
    uint8_t  name_size
    char     name[6]            (zero-padded)
    uint8_t  reg_size
uint8_t  context[context_size]  (raw GumCpuContext)

end (type=3)

Emitted when the end address is reached (range-based tracing). Empty payload.

panic (type=4)

Emitted on fatal instrumentation errors (e.g. unhandled register). Payload is the raw message bytes; length equals payload_size.

Out-of-process reading

The ringbuffer can be read from another process using TraceBuffer.open(), which remaps the buffer's memory via Mach VM APIs (Darwin only for now):

const buffer = TraceBuffer.open(location);
const reader = new TraceBufferReader(buffer);

Where location is the string returned by buffer.location in the target process.