“This is the first day of my participation in the First Challenge 2022. For details: First Challenge 2022.”

The front information

This machine (MacBook Pro) Electron path: / usr/local/lib/node_modules/Electron/dist/Electron. App/Contents/MacOS/Electron

The machine Electron data file path: / Users/bianchengsanmei/Library/Application Support/Electron

Local path to dump_sysm: /Users/bianchengsanmei/Library/Developer/Xcode/DerivedData/Breakpad-ebqwamwdejfpicartmwratdgdbnc/Build/Products/Release/ dump_syms

Minidumps_stackwalk path/Users/bianchengsanmei/Public/CODE/google_breakpad breakpad/SRC/processor/minidump_stackwalk

Build google_breakpad

  1. downloadgoogle_breakpadThe source code.
    git clone https://github.com/google/breakpad.git
    Copy the code
  2. Compile google_breakpad
    ./configure && make
    Copy the code
  3. Install the built libraries
    make install
    Copy the code

Generate the Electron crash log

// main.js
import { app, crashReporter } from "electron";
import * as path from "path";
crashReporter.start({
    uploadToServer: false
});
app.setPath("crashDumps", process.cwd() + "/crash");
Copy the code

So when the renderer crashes, we can find a dump file in the crash folder of the installation directory. This is the crash log file.

Note that the crashDumps path does not exist in [email protected], but in the temp path.

Parsing dump files

Dump file (hexadecimal data)

To convert this file to a readable, analyzable file, use the tool minidumps_stackwalk in Google_breakpad:

$ /Users/bianchengsanmei/Public/CODE/google_breakpad/breakpad/src/processor/minidump_stackwalk ./crash/test.dump > ./crash/test.info
Copy the code

Open to view test.info:

The Crash reason is the description of the cause of the Crash.

Learn interesting knowledge, meet interesting friends, shape interesting soul!

Hello everyone, I am the author of “programming Samadhi”, I am king Yi, my public account is “programming Samadhi”, welcome to pay attention, I hope you can give me more advice!

You come, with expectations, I have ink to welcome! You return, no matter gain or loss, only to yu Yun give each other!

Knowledge and skills should be paid equal attention to, internal force and external power should be repaired simultaneously, theory and practice should grasp both hands, both hands should be hard!