mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-22 05:13:22 +08:00
[0.3.x] added : targetThread.instructionOffset property (return an instruction pointer)
[0.3.x] added : targetThread.frameOffset property (return a frame pointer) [0.3.x] added : targetThread.stackOffset property (return a stack pointer) git-svn-id: https://pykd.svn.codeplex.com/svn@90895 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
52f7dfd24b
commit
181f1d82f6
@ -621,6 +621,18 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Retrun system thread ID ( TID )" )
|
||||
.add_property("teb", TargetThreadAdapter::getTebOffset,
|
||||
"Return TEB address" )
|
||||
.add_property( "ip", TargetThreadAdapter::getIP,
|
||||
"instruction pointer" )
|
||||
.add_property( "instructionOffset", TargetThreadAdapter::getIP,
|
||||
"Return an instruction offset" )
|
||||
.add_property( "fp", TargetThreadAdapter::getFP,
|
||||
"frame pointer" )
|
||||
.add_property( "frameOffset",TargetThreadAdapter::getFP,
|
||||
"Return a frame's offset" )
|
||||
.add_property( "sp", TargetThreadAdapter::getSP,
|
||||
"stack pointer" )
|
||||
.add_property( "stackOffset", TargetThreadAdapter::getSP,
|
||||
"Return a stack pointer" )
|
||||
.def("setCurrent", TargetThreadAdapter::setCurrent,
|
||||
"Set this thread current")
|
||||
.def("isCurrent", TargetThreadAdapter::isCurrent,
|
||||
|
@ -272,6 +272,25 @@ struct TargetThreadAdapter {
|
||||
}
|
||||
|
||||
static python::list getStack(kdlib::TargetThread& thread);
|
||||
|
||||
static kdlib::MEMOFFSET_64 getIP(kdlib::TargetThread& thread)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return thread.getInstructionOffset();
|
||||
}
|
||||
|
||||
static kdlib::MEMOFFSET_64 getSP(kdlib::TargetThread& thread)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return thread.getStackOffset();
|
||||
}
|
||||
|
||||
static kdlib::MEMOFFSET_64 getFP(kdlib::TargetThread& thread)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return thread.getFrameOffset();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // pykd namespace
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "pytypedvar.h"
|
||||
#include "kdlib/exceptions.h"
|
||||
|
||||
namespace pykd {
|
||||
|
||||
@ -100,8 +101,9 @@ python::list TypedVarAdapter::getFields( kdlib::TypedVar& typedVar )
|
||||
python::list TypedVarAdapter::getElementsDir(kdlib::TypedVar& typedVar)
|
||||
{
|
||||
std::list<std::wstring> lst;
|
||||
python::list pylst;
|
||||
|
||||
do {
|
||||
try {
|
||||
|
||||
AutoRestorePyState pystate;
|
||||
|
||||
@ -111,9 +113,10 @@ python::list TypedVarAdapter::getElementsDir(kdlib::TypedVar& typedVar)
|
||||
lst.push_back(name);
|
||||
}
|
||||
|
||||
} while (false);
|
||||
|
||||
python::list pylst;
|
||||
} catch(kdlib::DbgException&)
|
||||
{
|
||||
return pylst;
|
||||
}
|
||||
|
||||
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
||||
pylst.append(*it);
|
||||
|
@ -108,7 +108,9 @@ python::list TypeInfoAdapter::getElementDir(kdlib::TypeInfo &typeInfo)
|
||||
{
|
||||
std::list<std::wstring> lst;
|
||||
|
||||
do {
|
||||
python::list pylst;
|
||||
|
||||
try{
|
||||
|
||||
AutoRestorePyState pystate;
|
||||
|
||||
@ -118,9 +120,10 @@ python::list TypeInfoAdapter::getElementDir(kdlib::TypeInfo &typeInfo)
|
||||
lst.push_back(name);
|
||||
}
|
||||
|
||||
} while (false);
|
||||
|
||||
python::list pylst;
|
||||
} catch(kdlib::DbgException&)
|
||||
{
|
||||
return pylst;
|
||||
}
|
||||
|
||||
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
||||
pylst.append(*it);
|
||||
|
Loading…
Reference in New Issue
Block a user