Socket
Socket
Sign inDemoInstall

resolve-jit-symbols

Package Overview
Dependencies
10
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    resolve-jit-symbols

Resolves symbols for dynamic code generated by a JIT via a map file.


Version published
Weekly downloads
5K
decreased by-13.6%
Maintainers
1
Install size
415 kB
Created
Weekly downloads
 

Readme

Source

resolve-jit-symbols build status

Resolves symbols for dynamic code generated by a JIT via a map file.

var resolveJITSymbols = require('resolve-jit-symbols');
var map = fs.readFileSync(__dirname + '/test/fixtures/jit.map', 'utf8')
  
var resolver = resolveJITSymbols(map);
var res = resolver.resolve('0x38852ffd485a');
console.log(res);
{ address        : '38852ffd4640',
  size           : '54c',
  decimalAddress : 62144686933568,
  symbol         : 'LazyCompile    : *go' }

Command Line

cat test/fixtures/callgraph.csv | rjs test/fixtures/jit.map

Installation

npm install resolve-jit-symbols

Usage

# Supply path to map file
cat callstack.csv | rjs /tmp/<perf-*.map>

# Or pid of process whose map file to use (resolved from /tmp/perf-<pid>.map)
cat callstack.csv | rjs <pid>

How to Generate JIT Symbol Files

Any tool that can generate the format described here will work.

With Node.js >=v0.11.15 do the following:

node --perf-basic-prof your-app.js

This will create a map file at /tmp/perf-<pid>.map.

API

JITResolver::hexAddressRegex

RegExp used to match memory addresses.

Source:
JITResolver::lldb_backtraceRegex

RegExp used to match memory lldb backtraces of the form #1 0x001 in 0x001 () When calling var m = s.match(regex) m[1] contains first matched address and m[2] contains second matched address.

Source:
JITResolver(map) → {Object}

Instantiates a JIT resolver for the given map.

Parameters:
NameTypeDescription
map String | Array.<String>

either a string or lines with space separated HexAddress, Size, Symbol on each line

Source:
Returns:

the initialized JIT resolver

Type
Object
JITResolver::resolve(hexAddress) → {Object}

Matches the address of the symbol of which the given address is part of.

Parameters:
NameTypeDescription
hexAddress String | Number

the hexadecimal address of the address to check

Source:
Returns:

info of the matching symbol which includes address, size, symbol

Type
Object
JITResolver::resolveMulti(stack, getHexAddress) → {Array.<String>|String}

Resolves all symbols in a given stack and replaces them accordingly

Parameters:
NameTypeArgumentDescription
stack Array.<String> | String

string of stack or lines of stack

getHexAddress function <optional>

allows overriding the function used to find a hex address on each line, returns { address: 0x000, include: true|false }

Source:
Returns:

the stack with symbols resolved in the same format that the stack was given, either as lines or one string

Type
Array.<String> | String

generated with docme

License

MIT

Keywords

FAQs

Last updated on 09 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc