Missing Frame in call stack

Apr 28, 2016 at 3:12 PM
Edited Apr 28, 2016 at 3:19 PM
I would like to use StackWalker to find the reason of crashes in an very old C++ application.
To catch the crash I installed my own signal handler for SIGSEGV. Within the signal handler I am creating a StackWalker object and call the ShowCallstack member. Everything works fine so far but within the stack trace the frame of the erronous function is missing. Every other frame is there. But especially this information is most useful for me. What am I doing wrong?

In the pictures below you see that LMainWindow::EvTimer() is shown in the debugger stack trace
but not in the StackWalker output.

This is the code to create a segementation violation:
void LMainWindow::EvTimer ( UINT timer_ID )
        unsigned long *pL = (unsigned long *)0xBAADF00DL;
        *pL = 1;
This is what my debugger shows:

This is what StackWalker outputs:
17:00:02.370 L1: d:\dev\vs2012\source\dll_base\stackwalker.cpp (1044): StackWalker::ShowCallstack
17:00:02.375 L1: d:\dev\vs2012\source\project\project.cpp (2807): signalHandler
17:00:02.376 L1: f:\dd\vctools\crt_bld\self_x86\crt\src\winxfltr.c (366): _XcptFilter
17:00:02.377 L1: f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (553): __tmainCRTStartup
17:00:02.377 L1: f:\dd\vctools\crt_bld\SELF_X86\crt\prebuild\misc\i386\exsup4.asm (394): _EH4_CallFilterFunc
17:00:02.378 L1: f:\dd\vctools\crt_bld\self_x86\crt\prebuild\misc\i386\chandler4.c (369): _except_handler4_common
17:00:02.379 L1: f:\dd\vctools\crt_bld\self_x86\crt\prebuild\misc\i386\chandler4gs.c (94): _except_handler4
17:00:02.379 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 774534C9)
17:00:02.380 L1: 774534C9 (ntdll): (filename not available): RtlDestroyEnvironment
17:00:02.380 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 7745349B)
17:00:02.381 L1: 7745349B (ntdll): (filename not available): RtlDestroyEnvironment
17:00:02.388 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 77400143)
17:00:02.389 L1: 77400143 (ntdll): (filename not available): KiUserExceptionDispatcher
17:00:02.390 L1: d:\dev\owlnext\630\source\owlcore\dispatch.cpp (483): v_WPARAM_Dispatch
17:00:02.391 L1: d:\dev\owlnext\630\source\owlcore\eventhan.cpp (390): OWL::TEventHandler::Dispatch
17:00:02.392 L1: d:\dev\owlnext\630\source\owlcore\window.cpp (470): OWL::TWindow::Dispatch
17:00:02.393 L1: d:\dev\owlnext\630\source\owlcore\window.cpp (1216): OWL::TWindow::WindowProc
17:00:02.394 L1: d:\dev\owlnext\630\source\owlcore\window.cpp (1256): OWL::TWindow::HandleMessage
17:00:02.395 L1: d:\dev\owlnext\630\source\owlcore\window.cpp (1276): OWL::TWindow::ReceiveMessage
17:00:02.396 L1: d:\dev\owlnext\630\source\owlcore\owl.cpp (547): OWL::TWindow::StdWndProc
17:00:02.397 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 753362FA)
17:00:02.397 L1: 753362FA (USER32): (filename not available): gapfnScSendMessage
17:00:02.398 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 75336D3A)
17:00:02.398 L1: 75336D3A (USER32): (filename not available): GetThreadDesktop
17:00:02.399 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 753377D3)
17:00:02.399 L1: 753377D3 (USER32): (filename not available): CharPrevW
17:00:02.400 L1: ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 75337BDA)
17:00:02.400 L1: 75337BDA (USER32): (filename not available): DispatchMessageA
17:00:02.401 L1: d:\dev\owlnext\630\source\owlcore\applicat.cpp (941): OWL::TApplication::ProcessMsg
17:00:02.402 L1: d:\dev\owlnext\630\source\owlcore\msgthred.cpp (144): OWL::TMsgThread::PumpWaitingMessages
17:00:02.403 L1: d:\dev\owlnext\630\source\owlcore\applicat.cpp (823): OWL::TApplication::MessageLoop
17:00:02.404 L1: d:\dev\owlnext\630\source\owlcore\applicat.cpp (689): OWL::TApplication::Run
May 5, 2016 at 7:02 AM
Sorry for the late reply...
  1. I do not recommend to use the stackwalker for finding crashes in your application. The recommended way is to use WER or MiniDump!
    See also:
  2. If you really want to use the StackWalker, you should use it as suggested! Either set the "UnhandledExceptionFilter" or use "__try __except" and pass the correct exception Information into the stackwalker!
    See also the example in the source Code...