[No] Print a stack trace on the console

Moderators: Developers, ZDoom.org Team

Print a stack trace on the console

Postby argv » Mon Oct 23, 2017 10:57 pm

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.
argv
 
Joined: 30 Aug 2016

Re: Print a stack trace on the console

Postby Graf Zahl » Tue Oct 24, 2017 1:33 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Print a stack trace on the console

Postby _mental_ » Tue Oct 24, 2017 3:35 am

Using linked list of VMFrame objects from GlobalVMStack I was able to collect the following:
Code: Select allExpand view
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.
_mental_
 
 
 
Joined: 07 Aug 2011


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests