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.
Minecraft PE Android crashdump decoder script

Minecraft PE crashdump decoder

Setting up environment

Install depot_tools 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.
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment