0

How can I get the `callstack of the program context that lead to error (not the unhandled exception callstack)

For example:

LONG WINAPI myUnhandledException(PEXCEPTION_POINTERS pExceptionPtrs)
{
    //Get the eip when the crash occur 
    DWORD eip = pExceptionPtrs->ContextRecord->Eip;
    //how  to get crash call stack??
    //0x123
    //0x896
    //Eip           
}

int main()
{   //Set the unhandledexceptionfilter
     SetUnhandledExceptionFilter(myUnhandledException);
}
Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
gedalia
  • 3
  • 3
  • 1
    Why do you think you need this instead of, say, passing the `PEXCEPTION_POINTERS` on to [MiniDumpWriteDump](https://msdn.microsoft.com/en-us/library/windows/desktop/ms680360.aspx)? – IInspectable Jan 15 '18 at 10:04

1 Answers1

0
  1. StackWalk64
  2. in low level- RtlCaptureStackBackTrace function need to save the ebp in exception time backup all the stack change ebp back to context time call RtlCaptureStackBackTrace save result in global recover the stack to the current time
gedalia
  • 3
  • 3