Print a stack trace on the console

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Print a stack trace on the console

Re: Print a stack trace on the console

by _mental_ » Tue Oct 24, 2017 2:35 am

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.

Re: Print a stack trace on the console

by Graf Zahl » Tue Oct 24, 2017 12: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.

Print a stack trace on the console

by argv » Mon Oct 23, 2017 9: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.

Top