pykd/pykd/stkframe.cpp
SND\EreTIk_cp b7addbf064 [0.1.x]
~ bind stack frame to debug client
 + get local vars from stack frame

git-svn-id: https://pykd.svn.codeplex.com/svn@73631 9b283d60-5439-405e-af05-b73fd8c4d996
2017-11-08 17:27:51 +04:00

56 lines
1.6 KiB
C++

//
// Stack frame: DEBUG_STACK_FRAME wrapper
//
#include "stdafx.h"
#include "stkframe.h"
////////////////////////////////////////////////////////////////////////////////
namespace pykd {
////////////////////////////////////////////////////////////////////////////////
StackFrame::StackFrame(DebugClientPtr client, const DEBUG_STACK_FRAME &frame)
: m_client(client)
, m_frameNumber(frame.FrameNumber)
, m_instructionOffset(frame.InstructionOffset)
, m_returnOffset(frame.ReturnOffset)
, m_frameOffset(frame.FrameOffset)
, m_stackOffset(frame.StackOffset)
{
}
////////////////////////////////////////////////////////////////////////////////
std::string StackFrame::print() const
{
std::stringstream sstream;
sstream << std::dec << "(" << m_frameNumber << ")";
sstream << " ip= 0x" << std::hex << m_instructionOffset;
sstream << ", ret= 0x" << std::hex << m_returnOffset;
sstream << ", frame= 0x" << std::hex << m_frameOffset;
sstream << ", stack= 0x" << std::hex << m_stackOffset;
return sstream.str();
}
////////////////////////////////////////////////////////////////////////////////
python::dict StackFrame::getLocals(ContextPtr ctx /*= ContextPtr()*/)
{
ctx = ctx ? ctx->forkByStackFrame(*this)
: m_client->getThreadContext()->forkByStackFrame(*this);
return m_client->getLocals(ctx);
}
////////////////////////////////////////////////////////////////////////////////
} // namespace pykd
////////////////////////////////////////////////////////////////////////////////