My application is developed with Electron(v11.1.1), and it uses crashpad to catch all crash dmp files from every processes. How can I get crashed process id or other meta data from a minidump file
Asked
Active
Viewed 213 times
1 Answers
0
I found that we can parse some field directly from the dmp file
async function parseProcessDetailFromDump(dumpPath) {
return new Promise((ok, fail) => {
const readStream = fs.createReadStream(dumpPath)
let ptype = null
let pid = null
readStream.on("data", (chunk) => {
const text = chunk.toString(`utf-8`)
const lines = text.split(path.sep)
for (const line of lines) {
const found = line.match(/ptype/)
if (found != null && found.length > 0) {
const regPtype = /(?<=ptype[^0-9a-zA-Z]+)[0-9a-zA-Z]+/gu
const regPid = /(?<=pid[^0-9a-zA-Z]+)[0-9a-zA-Z]+/gu
ptype = line.match(regPtype)[0]
pid = line.match(regPid)[0]
}
}
})
readStream.on("error" , () => {
rejects()
})
readStream.on("end", () => {
ok({pid, ptype})
})
})
}

QuinnChen
- 670
- 1
- 8
- 29