Can bmx app generate crash report?

Started by wookie22, November 12, 2020, 14:10:51

Previous topic - Next topic

wookie22

If yes, how? I mean if I give my app to someone and he got crash.
Hidden Deep - 2D Action & Exploration Sci-Fi Thriller for PC/Mac/Linux
http://www.hiddendeepgame.com

Matty

Almost every command that can be responsible for a crash can be caught before it does so with good design.

If an image handle fails to load for example you can catch this at the point of load.

If a division by zero error can occur then its possible to test the denominator first.

If an array index goes out of bounds you can test the value of the index first.

If an object is null unexpectedly you can check for that too.

In theory crashes should never happen with good design.  And areas where failure might occur can be tested and dealt with.


wookie22

It is not that simple. The game code is quite big, it would be hard to add try/catch to every part of it. Thing is that 99% don't have a problem but that 1% have and I cannot reproduce it.
Hidden Deep - 2D Action & Exploration Sci-Fi Thriller for PC/Mac/Linux
http://www.hiddendeepgame.com

Matty

Well the next best thing if you can't do that is this:

In a separate thread do the following:
Open a file for appending.
Every key block of code in your main loop send a signal to the other thread to write a comment to the text file.
When the user's game crashes ask for the text file back.
Note you have to open close and reopen the file to ensure it exists on crash.
Potentially write key debug info to the file about the current game state.
When you get the text file back you will see the last state before crash.

It might help locate the error and conditions.

wookie22

Hidden Deep - 2D Action & Exploration Sci-Fi Thriller for PC/Mac/Linux
http://www.hiddendeepgame.com

Derron

Compile with "gdb" information ... and run the exe through "gdb" (provided by MinGW packages)

For linux I have this shell script which I let bmk execute (modified bmk) when I experience random segfaults the blitzmax debugger does not catch (so something in the C code):

Code (Blitzmax) Select

#!/bin/bash
ulimit -c unlimited
"$@"
if [[ $? -eq 139 ]]; then
BASEDIR=$(dirname "$0")
    gdb -q $1 core -x "$BASEDIR/segfaultwrapper_gdbcommands.txt"
fi


Code (txt) Select

backtrace
quit


Maybe you could simply provide something similar as "debug.bat" together with a "gdb.exe" (dunno if it has any dependencies ...).


You might be able to output the backtrace into a file.

bye
Ron