How to use StackWalker?


I have a release only crash that i want to use StackWalker to catch. If i could get the last 10 functions called in my app i would have a much better time understand why it crashes.

Is it designed for this purpose? If not is there another backtrace tool in cinder or any resources on how to write one myself. (my first thought was to open a file on startup of my app and write a functions name to it when that functions is called, maybe wrap it in some macro)

I don’t know about StackWalker but if you’re using Visual Studio, you can set in Release mode the Linker->Debugging->“Generate Debug Info” flag , disable Optimization and then debug your app in Release mode and you should be able to get a stack trace on crashing.

You could also try g3log, which will output a human readable stack trace when your app crashes

You don’t have to disable optimization, just generate debug info. Note that, with optimization enabled, you may experience weird jumps when stepping through your code. This is normal, because the optimizations may cause code to be inlined or ignored. Just keep stepping through until you find the bug.

Its a crash that happens sporadically on one of my app users machines.
So i am trying to figure out what causes the crash.
I have a crash dump and have used windbg to debug it, it is seems to be something to do with opengl nvoglv32.DLL and DrvPresentBuffers().
I have narrowed it down to my threading code but wanted to get the last few functions called in my app code to help give some context.
I will send my user a release with debug info as you suggest Paul(and remember to hold on to the exact .pdb that it generated!! ).
The g3log tool looks interesting too Steve, it would give me the last few functions as i need.

A note on StackWalker, it is actually an MSW-only implementation of retrieving runtime stacktraces. If that’s what you like, you should instead use the cross-platfrom method ci::stackTrace(). I find this useful when I want to log, for instance, where a caught exception is coming from, but the app doesn’t actually crash (ex. assets failing to load in production).


Thanks for explaining the intended use-case. Will check out ci::stackTrace.