{"name":"resolve-jit-symbols","version":"0.4.3","description":"Resolves symbols for dynamic code generated by a JIT via a map file.","main":"index.js","bin":{"rjs":"bin/rjs"},"scripts":{"test":"tap test/*.js","watch":"watchify -d web/main.js -o web/bundle.js","bundle":"browserify web/main.js | uglifyjs > web/bundle.js"},"repository":{"type":"git","url":"git://github.com/thlorenz/resolve-jit-symbols.git"},"homepage":"https://github.com/thlorenz/resolve-jit-symbols","dependencies":{"pretty-trace":"~0.3.1"},"devDependencies":{"browserify":"~6.3.2","tap":"~0.4.3","uglify-js":"~2.4.15","watchify":"~2.1.1"},"keywords":["jit","debug","trace","resolve","symbol"],"author":{"name":"Thorsten Lorenz","email":"thlorenz@gmx.de","url":"http://thlorenz.com"},"license":{"type":"MIT","url":"https://github.com/thlorenz/resolve-jit-symbols/blob/master/LICENSE"},"engine":{"node":">=0.8"},"gitHead":"3872c0d5826ef22b907598d24b699350babefa8f","bugs":{"url":"https://github.com/thlorenz/resolve-jit-symbols/issues"},"_id":"resolve-jit-symbols@0.4.3","_shasum":"f812c98c09f416289557a40f900b8d81fe28556e","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"thlorenz","email":"thlorenz@gmx.de"},"maintainers":[{"name":"thlorenz","email":"thlorenz@gmx.de"}],"dist":{"shasum":"f812c98c09f416289557a40f900b8d81fe28556e","tarball":"http://registry-npm.ywwl.com/resolve-jit-symbols/download/resolve-jit-symbols-0.4.3.tgz","integrity":"sha512-pJ0Hcbz3HRUPrBvBHtBy4ntd8sGtlQwiARluoC5hM9By6I+OpvfzsByYxwCFJ0Rbi20z03xrMiHRtdbHb5HesA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvcSk9fF0cRXprJQHq0KX/rVnB8xIY/eaIWXiZjeWxFwIgceELCcQY9TorAIWJe+PpFjcws+h0FwDpV/9LqICpD2Y="}],"size":4729,"noattachment":false,"key":"/resolve-jit-symbols/-/resolve-jit-symbols-0.4.3.tgz"},"readme":"# resolve-jit-symbols [![build status](https://secure.travis-ci.org/thlorenz/resolve-jit-symbols.png)](http://travis-ci.org/thlorenz/resolve-jit-symbols)\n\nResolves symbols for dynamic code generated by a JIT via a map file.\n\n```js\nvar resolveJITSymbols = require('resolve-jit-symbols');\nvar map = fs.readFileSync(__dirname + '/test/fixtures/jit.map', 'utf8')\n  \nvar resolver = resolveJITSymbols(map);\nvar res = resolver.resolve('0x38852ffd485a');\nconsole.log(res);\n```\n\n```\n{ address        : '38852ffd4640',\n  size           : '54c',\n  decimalAddress : 62144686933568,\n  symbol         : 'LazyCompile    : *go' }\n```\n\n## Command Line\n\n```sh\ncat test/fixtures/callgraph.csv | rjs test/fixtures/jit.map\n```\n\n## Installation\n\n    npm install resolve-jit-symbols\n\n## Usage\n\n```\n# Supply path to map file\ncat callstack.csv | rjs /tmp/<perf-*.map>\n\n# Or pid of process whose map file to use (resolved from /tmp/perf-<pid>.map)\ncat callstack.csv | rjs <pid>\n```\n\n## How to Generate JIT Symbol Files\n\nAny tool that can generate [the format described\nhere](https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt) will work.\n\nWith Node.js `>=v0.11.15` do the following:\n\n```js\nnode --perf-basic-prof your-app.js\n```\n\nThis will create a map file at `/tmp/perf-<pid>.map`.\n\n## API\n\n<!-- START docme generated API please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN docme TO UPDATE -->\n\n<div>\n<div class=\"jsdoc-githubify\">\n<section>\n<article>\n<div class=\"container-overview\">\n<dl class=\"details\">\n</dl>\n</div>\n<dl>\n<dt>\n<h4 class=\"name\" id=\"JITResolver::hexAddressRegex\"><span class=\"type-signature\"></span>JITResolver::hexAddressRegex<span class=\"type-signature\"></span></h4>\n</dt>\n<dd>\n<div class=\"description\">\n<p>RegExp used to match memory addresses.</p>\n</div>\n<dl class=\"details\">\n<dt class=\"tag-source\">Source:</dt>\n<dd class=\"tag-source\"><ul class=\"dummy\">\n<li>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js\">index.js</a>\n<span>, </span>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js#L124\">lineno 124</a>\n</li>\n</ul></dd>\n</dl>\n</dd>\n<dt>\n<h4 class=\"name\" id=\"JITResolver::lldb_backtraceRegex\"><span class=\"type-signature\"></span>JITResolver::lldb_backtraceRegex<span class=\"type-signature\"></span></h4>\n</dt>\n<dd>\n<div class=\"description\">\n<p>RegExp used to match memory lldb backtraces of the form <code>#1 0x001 in 0x001 ()</code>\nWhen calling <code>var m = s.match(regex)</code>\n<code>m[1]</code> contains first matched address and <code>m[2]</code> contains second matched address.</p>\n</div>\n<dl class=\"details\">\n<dt class=\"tag-source\">Source:</dt>\n<dd class=\"tag-source\"><ul class=\"dummy\">\n<li>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js\">index.js</a>\n<span>, </span>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js#L131\">lineno 131</a>\n</li>\n</ul></dd>\n</dl>\n</dd>\n</dl>\n<dl>\n<dt>\n<h4 class=\"name\" id=\"JITResolver\"><span class=\"type-signature\"></span>JITResolver<span class=\"signature\">(map)</span><span class=\"type-signature\"> &rarr; {Object}</span></h4>\n</dt>\n<dd>\n<div class=\"description\">\n<p>Instantiates a JIT resolver for the given map.</p>\n</div>\n<h5>Parameters:</h5>\n<table class=\"params\">\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th class=\"last\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"name\"><code>map</code></td>\n<td class=\"type\">\n<span class=\"param-type\">String</span>\n|\n<span class=\"param-type\">Array.&lt;String></span>\n</td>\n<td class=\"description last\"><p>either a string or lines with space separated HexAddress, Size, Symbol on each line</p></td>\n</tr>\n</tbody>\n</table>\n<dl class=\"details\">\n<dt class=\"tag-source\">Source:</dt>\n<dd class=\"tag-source\"><ul class=\"dummy\">\n<li>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js\">index.js</a>\n<span>, </span>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js#L31\">lineno 31</a>\n</li>\n</ul></dd>\n</dl>\n<h5>Returns:</h5>\n<div class=\"param-desc\">\n<p>the initialized JIT resolver</p>\n</div>\n<dl>\n<dt>\nType\n</dt>\n<dd>\n<span class=\"param-type\">Object</span>\n</dd>\n</dl>\n</dd>\n<dt>\n<h4 class=\"name\" id=\"JITResolver::resolve\"><span class=\"type-signature\"></span>JITResolver::resolve<span class=\"signature\">(hexAddress)</span><span class=\"type-signature\"> &rarr; {Object}</span></h4>\n</dt>\n<dd>\n<div class=\"description\">\n<p>Matches the address of the symbol of which the given address is part of.</p>\n</div>\n<h5>Parameters:</h5>\n<table class=\"params\">\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th class=\"last\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"name\"><code>hexAddress</code></td>\n<td class=\"type\">\n<span class=\"param-type\">String</span>\n|\n<span class=\"param-type\">Number</span>\n</td>\n<td class=\"description last\"><p>the hexadecimal address of the address to check</p></td>\n</tr>\n</tbody>\n</table>\n<dl class=\"details\">\n<dt class=\"tag-source\">Source:</dt>\n<dd class=\"tag-source\"><ul class=\"dummy\">\n<li>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js\">index.js</a>\n<span>, </span>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js#L54\">lineno 54</a>\n</li>\n</ul></dd>\n</dl>\n<h5>Returns:</h5>\n<div class=\"param-desc\">\n<p>info of the matching symbol which includes address, size, symbol</p>\n</div>\n<dl>\n<dt>\nType\n</dt>\n<dd>\n<span class=\"param-type\">Object</span>\n</dd>\n</dl>\n</dd>\n<dt>\n<h4 class=\"name\" id=\"JITResolver::resolveMulti\"><span class=\"type-signature\"></span>JITResolver::resolveMulti<span class=\"signature\">(stack, <span class=\"optional\">getHexAddress</span>)</span><span class=\"type-signature\"> &rarr; {Array.&lt;String>|String}</span></h4>\n</dt>\n<dd>\n<div class=\"description\">\n<p>Resolves all symbols in a given stack and replaces them accordingly</p>\n</div>\n<h5>Parameters:</h5>\n<table class=\"params\">\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th>Argument</th>\n<th class=\"last\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"name\"><code>stack</code></td>\n<td class=\"type\">\n<span class=\"param-type\">Array.&lt;String></span>\n|\n<span class=\"param-type\">String</span>\n</td>\n<td class=\"attributes\">\n</td>\n<td class=\"description last\"><p>string of stack or lines of stack</p></td>\n</tr>\n<tr>\n<td class=\"name\"><code>getHexAddress</code></td>\n<td class=\"type\">\n<span class=\"param-type\">function</span>\n</td>\n<td class=\"attributes\">\n&lt;optional><br>\n</td>\n<td class=\"description last\"><p>allows overriding the function used to find a hex address on each line, returns <code>{ address: 0x000, include: true|false }</code></p></td>\n</tr>\n</tbody>\n</table>\n<dl class=\"details\">\n<dt class=\"tag-source\">Source:</dt>\n<dd class=\"tag-source\"><ul class=\"dummy\">\n<li>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js\">index.js</a>\n<span>, </span>\n<a href=\"https://github.com/thlorenz/resolve-jit-symbols/blob/master/index.js#L92\">lineno 92</a>\n</li>\n</ul></dd>\n</dl>\n<h5>Returns:</h5>\n<div class=\"param-desc\">\n<p>the stack with symbols resolved in the same format that the stack was given, either as lines or one string</p>\n</div>\n<dl>\n<dt>\nType\n</dt>\n<dd>\n<span class=\"param-type\">Array.&lt;String></span>\n|\n<span class=\"param-type\">String</span>\n</dd>\n</dl>\n</dd>\n</dl>\n</article>\n</section>\n</div>\n\n*generated with [docme](https://github.com/thlorenz/docme)*\n</div>\n<!-- END docme generated API please keep comment here to allow auto update -->\n\n## License\n\nMIT\n","publish_time":1421260226339,"_cnpm_publish_time":1421260226339,"dist-tags":{"latest":"0.5.0"}}