Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/resolve-jit-symbols
Resolves symbols for dynamic code generated by a JIT via a map file.
https://github.com/thlorenz/resolve-jit-symbols
Last synced: 2 months ago
JSON representation
Resolves symbols for dynamic code generated by a JIT via a map file.
- Host: GitHub
- URL: https://github.com/thlorenz/resolve-jit-symbols
- Owner: thlorenz
- License: mit
- Created: 2014-11-22T04:53:48.000Z (about 10 years ago)
- Default Branch: gh-pages
- Last Pushed: 2016-02-29T21:33:05.000Z (almost 9 years ago)
- Last Synced: 2024-10-18T00:43:03.445Z (3 months ago)
- Language: JavaScript
- Homepage: http://thlorenz.github.io/resolve-jit-symbols/web/
- Size: 550 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# resolve-jit-symbols [![build status](https://secure.travis-ci.org/thlorenz/resolve-jit-symbols.png)](http://travis-ci.org/thlorenz/resolve-jit-symbols)
Resolves symbols for dynamic code generated by a JIT via a map file.
```js
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
```sh
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/# Or pid of process whose map file to use (resolved from /tmp/perf-.map)
cat callstack.csv | rjs
```## How to Generate JIT Symbol Files
Any tool that can generate [the format described
here](https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt) will work.With Node.js `>=v0.11.15` do the following:
```js
node --perf-basic-prof your-app.js
```This will create a map file at `/tmp/perf-.map`.
## API
JITResolver::hexAddressRegexRegExp used to match memory addresses.
- Source:
JITResolver::lldb_backtraceRegexRegExp used to match memory lldb backtraces of the form
#1 0x001 in 0x001 ()
When callingvar m = s.match(regex)
m[1]
contains first matched address andm[2]
contains second matched address.
- Source:
JITResolver(map) → {Object}Instantiates a JIT resolver for the given map.
Parameters:
Name
Type
Description
map
String
|
Array.<String>either a string or lines with space separated HexAddress, Size, Symbol on each line
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:
Name
Type
Description
hexAddress
String
|
Numberthe hexadecimal address of the address to check
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:
Name
Type
Argument
Description
stack
Array.<String>
|
Stringstring 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 }
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](https://github.com/thlorenz/docme)*
## License
MIT