Print a stack trace on the console
Moderator: GZDoom Developers
Print a stack trace on the console
When the game is aborted from ZScript (divide by zero, ThrowAbortException, etc), the current ZScript call stack is (sometimes?) shown on the console. This aids debugging, but only if the error is fatal. It would be helpful to be able to emit a stack trace for non-fatal errors too.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Print a stack trace on the console
Cannot be done. To print a stack trace you have to unwind the stack which automatically makes it fatal. The stack we are talking here is not some VM construct, but the actual CPU stack.
Re: Print a stack trace on the console
Using linked list of VMFrame objects from GlobalVMStack I was able to collect the following:
This is the best output we can offer without altering the VM. For example, call stack traversal stops on the first native function.
Code: Select all
StateProvider.A_FirePistol at gzdoom.pk3:zscript/doom/weaponpistol.txt, line 78
PSprite.Tick at gzdoom.pk3:zscript/shared/player.txt, line 1345
PlayerPawn.TickPSprites at gzdoom.pk3:zscript/shared/player.txt, line 399
PlayerPawn.PlayerThink at gzdoom.pk3:zscript/shared/player.txt, line 1194