Print a stack trace on the console

Moderator: GZDoom Developers

Post Reply
argv
Posts: 184
Joined: Tue Aug 30, 2016 4:47 pm

Print a stack trace on the console

Post by argv »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Print a stack trace on the console

Post by Graf Zahl »

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.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Print a stack trace on the console

Post by _mental_ »

Using linked list of VMFrame objects from GlobalVMStack I was able to collect the following:

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
This is the best output we can offer without altering the VM. For example, call stack traversal stops on the first native function.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”