.ecxr memcopies context record
to set the scope you can use
EXT_COMMAND( setscope, "setscope", "{;e, d=@ $ip;!setscope;}" ) { m_Symbols3->SetScopeFromStoredEvent(); }
after this call, if you do k, etc., it will be for the last specified context
:\>cdb -z oktest.dmp Microsoft (R) Windows Debugger Version 10.0.10586.567 X86 This dump file has a breakpoint exception stored in it. The stored exception information can be accessed via .ecxr. 0:000> k ChildEBP RetAddr 0007fb1c 7c940442 ntdll!DbgBreakPoint 0007fc94 7c9210af ntdll!LdrpInitializeProcess+0xffa 0007fd1c 7c90e457 ntdll!_LdrpInitialize+0x183 00000000 00000000 ntdll!KiUserApcDispatcher+0x7 0:000> .load setscope 0:000> !setscope 0:000> k *** Stack trace for last set context - .thread/.cxr resets it ChildEBP RetAddr 0007fb1c 7c940442 ntdll!DbgBreakPoint 0007fc94 7c9210af ntdll!LdrpInitializeProcess+0xffa 0007fd1c 7c90e457 ntdll!_LdrpInitialize+0x183 00000000 00000000 ntdll!KiUserApcDispatcher+0x7 0:000>
full extension code including getstacktrace and outputstacktrace
#include <codeanalysis\warnings.h> #pragma warning( push ) #pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS ) #include <engextcpp.cpp> #pragma warning( pop ) class EXT_CLASS : public ExtExtension { public: EXT_COMMAND_METHOD(setscope); }; EXT_DECLARE_GLOBALS(); EXT_COMMAND( setscope, "setscope", "{;e, d=@ $ip;!setscope;}" ) { m_Symbols3->SetScopeFromStoredEvent(); DEBUG_STACK_FRAME Frames[0x20] = {0}; ULONG FramesFilled = NULL; m_Control->GetStackTrace(0,0,0,Frames,0x20,&FramesFilled); m_Control->OutputStackTrace(DEBUG_OUTCTL_THIS_CLIENT,Frames,FramesFilled,0x1fff); }
done by kvf and setscope
0:000> kVf *** Stack trace for last set context - .thread/.cxr resets it
blabb source share