diff --git a/index.js b/index.js index 36287bb..239564a 100644 --- a/index.js +++ b/index.js @@ -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) diff --git a/spec/__snapshots__/symbolication.spec.js.snap b/spec/__snapshots__/symbolication.spec.js.snap index 80bcc1c..c284c54 100644 --- a/spec/__snapshots__/symbolication.spec.js.snap +++ b/spec/__snapshots__/symbolication.spec.js.snap @@ -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 +" +`; diff --git a/spec/fixtures/win-crash.txt b/spec/fixtures/win-crash.txt new file mode 100644 index 0000000..4fdd422 --- /dev/null +++ b/spec/fixtures/win-crash.txt @@ -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 diff --git a/spec/symbolication.spec.js b/spec/symbolication.spec.js index 31dcdf1..0cb4725 100644 --- a/spec/symbolication.spec.js +++ b/spec/symbolication.spec.js @@ -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) })