Skip to content

Instantly share code, notes, and snippets.

@IceCruelStuff
Forked from dktapps/README.md
Created May 13, 2021 05:29
Show Gist options
  • Save IceCruelStuff/aabc7d65189b9b1503e8fa25733d97ab to your computer and use it in GitHub Desktop.
Save IceCruelStuff/aabc7d65189b9b1503e8fa25733d97ab to your computer and use it in GitHub Desktop.

Revisions

  1. @dktapps dktapps revised this gist Jan 2, 2019. 1 changed file with 21 additions and 0 deletions.
    21 changes: 21 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # Minecraft PE crashdump decoder
    ## Setting up environment
    [Install depot_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html) and make sure the tools are available in your `PATH` variable. You might need to add them to your path manually.


    ## Getting a crashdump file
    Requirements:
    - A **rooted** Android device with MCPE installed.

    1. Trigger the crash you want to debug. **When your game crashes, DON'T RESTART IT**.
    2. Copy the crash `.dmp` file from your device. Usually it'll be located in `/data/data/com.mojang.minecraftpe/files/` on the device. The crashdump will have a `.dmp` file extension. Example: `1a1b1707-81e5-8dcb-5d9760be-6ff89af9.dmp`
    3. Copy the `.apk` file for the MCPE version that produced the crashdump. You can find this in a directory with a name **something like** `/data/app/com.mojang.minecraftpe/`.

    ## Decoding the crashdump file
    Run the above script: `./read_crashdump.sh <path to apk> <path to dmp file>`
    Example: `./read_crashdump.sh minecraftpe.apk my_crashdump_file.dmp`

    If successful, the decoded crashdump will be written to `<dmp file path>.decoded.txt`, for example: `my_crashdump_file.dmp.decoded.txt`.

    ## Pitfalls
    - When your game crashes, **DO NOT RESTART IT**. When you next launch the game, it will send the crashdump to Mojang, and then delete it. Once this happens, you can't get the crashdump back to debug.
  2. @dktapps dktapps created this gist Jan 2, 2019.
    41 changes: 41 additions & 0 deletions read_crashdump.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/bin/bash

    # This script requires Google's depot_tools for Breakpad, a Minecraft PE APK and a crash .DMP file

    if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <apk file> <crashdump file>"
    exit 1
    fi

    APK_FILE="$1"
    if [ ! -f "$APK_FILE" ]; then
    echo "$APK_FILE does not exist"
    echo "Usage: $0 <apk file> <crashdump file>"
    exit 1
    fi
    CRASH_FILE="$2"
    if [ ! -f "$CRASH_FILE" ]; then
    echo "$CRASH_FILE does not exist"
    echo "Usage: $0 <apk file> <crashdump file>"
    exit 1
    fi

    rm -rf .apk
    mkdir .apk
    unzip "$APK_FILE" -d .apk

    SO_FILE=libminecraftpe.so
    SO_PATH=./.apk/lib/armeabi-v7a/"$SO_FILE"

    dump_syms "$SO_PATH" > ./"$SO_FILE.sym"

    HEX_PATH=$(head -n1 "$SO_FILE.sym" | cut -f4 -d" ")
    MODULE_NAME=$(head -n1 "$SO_FILE.sym" | cut -f5 -d" ")

    mkdir -p ./symbols/"$MODULE_NAME"/"$HEX_PATH"
    mv ./"$SO_FILE.sym" ./symbols/"$MODULE_NAME"/"$HEX_PATH"/

    OUTPUT_FILE="$CRASH_FILE.decoded.txt"
    minidump_stackwalk "$CRASH_FILE" ./symbols > "$OUTPUT_FILE"

    echo "Wrote decoded crashdump to $OUTPUT_FILE"