Skip to content

Instantly share code, notes, and snippets.

@dktapps
Last active August 13, 2021 20:36
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dktapps/ffd9bb07b3be0abe5bca43bf479339ae to your computer and use it in GitHub Desktop.
Save dktapps/ffd9bb07b3be0abe5bca43bf479339ae 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"
@VixikHD
Copy link

VixikHD commented Oct 22, 2020

obrazek
How to add those two missing commands? Although I have installed depot tools, it does not work... The output file is empty.

@dktapps
Copy link
Author

dktapps commented Oct 22, 2020

You might need to add them to your path manually.

You should also be aware that the crashdump won't give you any useful information if symbols are not available.

@VixikHD
Copy link

VixikHD commented Oct 22, 2020

Everything from the depot tools repository is available in the path... but those commands are missing here.

obrazek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment