[0.2.x] fixed: getStackWow64

git-svn-id: https://pykd.svn.codeplex.com/svn@82004 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2012-12-24 14:59:56 +00:00 committed by Mikhail I. Izmestev
parent 20cefe3ecc
commit 98e69b389e
4 changed files with 26 additions and 46 deletions

View File

@ -101,47 +101,6 @@ SymbolSessionPtr& Module::getSymSession()
throw SymbolException( "failed to load symbol file" ); throw SymbolException( "failed to load symbol file" );
} }
/////////////////////////////////////////////////////////////////////////////////////
// std::string m_symfile;
//ULONG64 m_base;
//ULONG m_size;
//ULONG m_timeDataStamp;
//ULONG m_checkSum;
//try
//{
// m_symSession = loadSymbolFile(m_base, m_imageName, m_symfile);
//}
//catch(const SymbolException &e)
//{
// DBG_UNREFERENCED_LOCAL_VARIABLE(e);
//}
//if (m_symSession)
// return m_symSession;
//// TODO: read image file path and load using IDiaReadExeAtOffsetCallback
//m_symfile = getModuleSymbolFileName(m_base);
//if (!m_symfile.empty())
//{
// try
// {
// m_symSession = loadSymbolFile(m_symfile, m_base);
// }
// catch(const SymbolException &e)
// {
// DBG_UNREFERENCED_LOCAL_VARIABLE(e);
// }
// if (m_symSession)
// return m_symSession;
// m_symfile.clear();
//}
//throw SymbolException( "failed to load symbol file" );
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
SymbolPtr& Module::getSymScope() SymbolPtr& Module::getSymScope()

View File

@ -2,7 +2,7 @@
#define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MAJOR 0
#define PYKD_VERSION_MINOR 2 #define PYKD_VERSION_MINOR 2
#define PYKD_VERSION_SUBVERSION 0 #define PYKD_VERSION_SUBVERSION 0
#define PYKD_VERSION_BUILDNO 9 #define PYKD_VERSION_BUILDNO 10
#define __VER_STR2__(x) #x #define __VER_STR2__(x) #x

View File

@ -95,7 +95,7 @@ std::string TypeInfo::findSymbol( ULONG64 offset, bool safe)
catch( DbgException& ) catch( DbgException& )
{ {
std::stringstream sstr; std::stringstream sstr;
sstr << module->getName() << '!' << std::hex << ( offset - module->getBase() ); sstr << module->getName() << '+' << std::hex << ( offset - module->getBase() );
return sstr.str(); return sstr.str();
} }

View File

@ -1002,6 +1002,9 @@ void getStackTraceWow64(std::vector<STACK_FRAME_DESC> &frames)
if (S_OK != hres) if (S_OK != hres)
throw DbgException( "IDebugControl::GetEffectiveProcessorType", hres ); throw DbgException( "IDebugControl::GetEffectiveProcessorType", hres );
WOW64_CONTEXT Context;
ReadWow64Context(Context);
AutoRevertEffectiveProcessorType autoRevertEffectiveProcessorType; AutoRevertEffectiveProcessorType autoRevertEffectiveProcessorType;
if (IMAGE_FILE_MACHINE_I386 != processorType) if (IMAGE_FILE_MACHINE_I386 != processorType)
{ {
@ -1015,10 +1018,28 @@ void getStackTraceWow64(std::vector<STACK_FRAME_DESC> &frames)
autoRevertEffectiveProcessorType.to(IMAGE_FILE_MACHINE_AMD64); autoRevertEffectiveProcessorType.to(IMAGE_FILE_MACHINE_AMD64);
} }
WOW64_CONTEXT Context; ULONG filledFrames = 1024;
ReadWow64Context(Context); std::vector<DEBUG_STACK_FRAME> dbgFrames(filledFrames);
buildStacksFrames(frames, Context.Ebp, Context.Esp, Context.Eip); hres = g_dbgEng->control->GetContextStackTrace(
&Context,
sizeof(Context),
&dbgFrames[0],
filledFrames,
NULL,
filledFrames*sizeof(Context),
sizeof(Context),
&filledFrames );
frames.resize(filledFrames);
for ( ULONG i = 0; i < filledFrames; ++i )
{
frames[i].number = dbgFrames[i].FrameNumber;
frames[i].instructionOffset = dbgFrames[i].InstructionOffset;
frames[i].returnOffset = dbgFrames[i].ReturnOffset;
frames[i].frameOffset = dbgFrames[i].FrameOffset;
frames[i].stackOffset = dbgFrames[i].StackOffset;
}
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////