@licq/nwjs-minidump
Version:
decode a nwjs crashed dump file
163 lines (123 loc) • 4.33 kB
Markdown
# @licq/nwjs-minidump
decode a nwjs crashed dump file
[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url]
[npm-image]: http://img.shields.io/npm/v/@licq/nwjs-minidump.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@licq/nwjs-minidump
[download-image]: https://img.shields.io/npm/dm/@licq/nwjs-minidump.svg?style=flat-square
[download-url]: https://npmjs.org/package/@licq/nwjs-minidump
## Install
```sh
npm add @licq/nwjs-minidump
```
## Usage
```js
const minidump = require("@licq/nwjs-minidump");
const testCases = [
["./dump-examples/0.57.1-osx64.dmp", "0.57.1-sdk"],
["./dump-examples/0.57.1-win64.dmp", "0.57.1-sdk"],
["./dump-examples/0.54.1-arm64.dmp", "0.54.1-sdk"],
];
```
### getSymbols
```js
(async function () {
await minidump.getSymbols({
dumpFile: testCases[0][0],
nwVersion: testCases[0][1],
});
})();
```
### decodeDmp
```js
(async function () {
const res = await main.decodeDmp({
dumpFile: testCases[0][0],
nwVersion: testCases[0][1],
symbolsPath: 'path/to/symbols', // optional
tagetDumpTxtPath: 'path/to/dumpTxt' // optional
});
console.log(res);
})();
```
### CLI
- dmp -f [dumpFilePath] -v [nwjsVersion] -o [outputPath] -s [symbolsPath]
- `-f` required
- `-v` required
- `-o` optional
- help
```sh
$ dmp -h
Usage: dmp [options] [command]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
decode [options] decode a nwjs dump file
help [command] display help for command
$ dmp decode -h
Usage: dmp decode [options]
decode a nwjs dump file
Options:
-f, --dumpFile <path> path of the .dmp file, eg: /path/to/demo.dmp or https://cos.xxx.com/path/to/demo.dmp
-v, --nwVersion <semver> nwjs version eg: 0.57.1|0.57.1-sdk. see <https://dl.nwjs.io/>
-s, --symbolsPath <path> path of the symbols. If this parameter is not specified, it will be downloaded by default
-o, --output <path> path of the output. The default value is the same as the .dmp file
-h, --help display help for command
```
- example
```sh
$ npm i -g @licq/nwjs-minidump
$ dmp decode -f path/to/xxx.dmp -v 0.57.1 # support url: dmp decode -f https://miniapp.gtimg.cn/qqdevtools/crash_dump_files/cc25ec86-5346-4a4d-b442-74a3de9fd4ee.dmp -v 0.57.1-sdk
# output example:
Operating system: Mac OS X
12.3.1 21E258
CPU: amd64
family 6 model 165 stepping 5
16 CPUs
GPU: UNKNOWN
Crash reason: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS
Crash address: 0x0
Process uptime: 1063 seconds
Thread 0 (crashed)
0 nwjs Framework!GetRenderWidgetHost [render_frame_host_impl.cc : 10935 + 0x0]
rax = 0x0000000119b067a8 rdx = 0x00000000000c81b0
rcx = 0x00000000430254d1 rbx = 0x00007fe040073e00
rsi = 0x00007fdfeeff84b8 rdi = 0x0000000000000000
rbp = 0x00007ff7bf664f40 rsp = 0x00007ff7bf664f30
r8 = 0x0000000000000427 r9 = 0x0000000000000029
r10 = 0x00007fdfcff00000 r11 = 0x0000000000000000
r12 = 0x00007fdfcf16e720 r13 = 0x00007fe040880438
r14 = 0x0000000000000000 r15 = 0x00007ff7bf664f78
rip = 0x0000000110d288e7
Found by: given as instruction pointer in context
1 nwjs Framework!GetView [render_frame_host_impl.cc : 4171 + 0x9]
rbp = 0x00007ff7bf664f50 rsp = 0x00007ff7bf664f50
rip = 0x0000000110d2894d
Found by: previous frame's frame pointer
```
## References
- [https://dl.nwjs.io/](https://dl.nwjs.io/)
- [Understanding Crash Dump](http://docs.nwjs.io/en/latest/For%20Developers/Understanding%20Crash%20Dump/#organize-symbol-files)
- [node-minidump](https://github.com/electron/node-minidump)
- [symbolicate-mac](https://github.com/electron/symbolicate-mac)
- [electron-minidump](https://github.com/nornagon/electron-minidump)
- [nw-minidump](https://github.com/surunzi/nw-minidump)
## Note
On linux system, May report this error:
```sh
libstdc++.so.6: version `GLIBCXX_3.4.20’ not found
```
### Solution
```sh
# find / -name "libstdc++.so.6*"
wget http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip
unzip libstdc.so_.6.0.26.zip
cp libstdc.so_.6.0.26 /usr/lib64
cd /usr/lib64
rm -f libstdc.so_.6
ln -f libstdc.so_.6.0.26 libstdc.so_.6
```
### Verify
```sh
strings libstdc++.so.6.0 | grep GLIBCXX_*
```