Skip to content

Commit

Permalink
feat: support symbolicating windows crashes (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored May 8, 2024
1 parent c2d7642 commit d95e311
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ const symbolicate = async (options) => {
async function symbolicateOne({image, offset}) {
const { debugId, path: modulePath } = image
if (!symbolCache.has(debugId)) {
const parsed = await getSymbolFile(debugId.replace(/-/g, '') + '0', path.basename(modulePath))
const suffix = path.extname(modulePath) === '.pdb' ? '1' : '0';
const parsed = await getSymbolFile(debugId.replace(/-/g, '') + suffix, path.basename(modulePath))
symbolCache.set(debugId, parsed)
}
const parsed = symbolCache.get(debugId)
Expand Down
15 changes: 15 additions & 0 deletions spec/__snapshots__/symbolication.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2039,3 +2039,18 @@ Note: 1 idle work queue thread omitted
*0xffffff8000200000 - 0xffffff8000bfffff kernel (6153.141.28.1) <BB1171FD-A9E3-3D24-92F7-F4DD45974EFD> /System/Library/Kernels/kernel
"
`;

exports[`symbolication symbolicates a windows crash 1`] = `
"0 electron.exe.pdb 0x00007ff68e2d395b v8::base::OS::Abort()
1 electron.exe.pdb 0x00007ff691a5711f _tailMerge_winusb.dll
2 electron.exe.pdb 0x00007ff691a570c7 _tailMerge_winusb.dll
3 electron.exe.pdb 0x00007ff6908090f3 _tailMerge_winusb.dll
4 electron.exe.pdb 0x00007ff68e2d57d1 V8_Fatal(char const *,...)
5 electron.exe.pdb 0x00007ff691a5711f _tailMerge_winusb.dll

0x00007ff687850000 - 0x00007ff692487000 electron.exe.pdb (7.5.0.0) <2F7747B60BAA52C84C4C44205044422E> electron.exe.pdb
0x00007ffab94b0000 - 0x00007ffab96a8000 ntdll.dll (10.0.19041.4239) <1669C503FDE3540E0A2FBE91C8120436> ntdll.dll
0x00007ffab86e0000 - 0x00007ffab879d000 KERNEL32.DLL (10.0.19041.3636) <B07C97792B439ABC0DF83499536C7AE5> KERNEL32.DLL
0x00007ffab6e40000 - 0x00007ffab7136000 KERNELBASE.dll (10.0.19041.4291) <DFC28314D88FE97BC24F88F5A77E9F73> KERNELBASE.dll
"
`;
11 changes: 11 additions & 0 deletions spec/fixtures/win-crash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0 electron.exe.pdb 0x00007ff68e2d395b () + 0
1 electron.exe.pdb 0x00007ff691a5711f () + 0
2 electron.exe.pdb 0x00007ff691a570c7 () + 0
3 electron.exe.pdb 0x00007ff6908090f3 () + 0
4 electron.exe.pdb 0x00007ff68e2d57d1 () + 0
5 electron.exe.pdb 0x00007ff691a5711f () + 0

0x00007ff687850000 - 0x00007ff692487000 electron.exe.pdb (7.5.0.0) <2F7747B60BAA52C84C4C44205044422E> electron.exe.pdb
0x00007ffab94b0000 - 0x00007ffab96a8000 ntdll.dll (10.0.19041.4239) <1669C503FDE3540E0A2FBE91C8120436> ntdll.dll
0x00007ffab86e0000 - 0x00007ffab879d000 KERNEL32.DLL (10.0.19041.3636) <B07C97792B439ABC0DF83499536C7AE5> KERNEL32.DLL
0x00007ffab6e40000 - 0x00007ffab7136000 KERNELBASE.dll (10.0.19041.4291) <DFC28314D88FE97BC24F88F5A77E9F73> KERNELBASE.dll
4 changes: 4 additions & 0 deletions spec/symbolication.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ describe('symbolication', function () {
it('symbolicates a sampling report', async () => {
expect(await symbolicate({ file: __dirname + '/fixtures/sampling.txt' })).toMatchSnapshot()
}, TIMEOUT)

it('symbolicates a windows crash', async () => {
expect(await symbolicate({ file: __dirname + '/fixtures/win-crash.txt' })).toMatchSnapshot()
}, TIMEOUT)
})

0 comments on commit d95e311

Please sign in to comment.