mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:24:52 +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 )" )
|
"Retrun system thread ID ( TID )" )
|
||||||
.add_property("teb", TargetThreadAdapter::getTebOffset,
|
.add_property("teb", TargetThreadAdapter::getTebOffset,
|
||||||
"Return TEB address" )
|
"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,
|
.def("setCurrent", TargetThreadAdapter::setCurrent,
|
||||||
"Set this thread current")
|
"Set this thread current")
|
||||||
.def("isCurrent", TargetThreadAdapter::isCurrent,
|
.def("isCurrent", TargetThreadAdapter::isCurrent,
|
||||||
|
@ -272,6 +272,25 @@ struct TargetThreadAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static python::list getStack(kdlib::TargetThread& thread);
|
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
|
} // pykd namespace
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "pytypedvar.h"
|
#include "pytypedvar.h"
|
||||||
|
#include "kdlib/exceptions.h"
|
||||||
|
|
||||||
namespace pykd {
|
namespace pykd {
|
||||||
|
|
||||||
@ -100,8 +101,9 @@ python::list TypedVarAdapter::getFields( kdlib::TypedVar& typedVar )
|
|||||||
python::list TypedVarAdapter::getElementsDir(kdlib::TypedVar& typedVar)
|
python::list TypedVarAdapter::getElementsDir(kdlib::TypedVar& typedVar)
|
||||||
{
|
{
|
||||||
std::list<std::wstring> lst;
|
std::list<std::wstring> lst;
|
||||||
|
python::list pylst;
|
||||||
|
|
||||||
do {
|
try {
|
||||||
|
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
|
|
||||||
@ -111,9 +113,10 @@ python::list TypedVarAdapter::getElementsDir(kdlib::TypedVar& typedVar)
|
|||||||
lst.push_back(name);
|
lst.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (false);
|
} catch(kdlib::DbgException&)
|
||||||
|
{
|
||||||
python::list pylst;
|
return pylst;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
||||||
pylst.append(*it);
|
pylst.append(*it);
|
||||||
|
@ -108,7 +108,9 @@ python::list TypeInfoAdapter::getElementDir(kdlib::TypeInfo &typeInfo)
|
|||||||
{
|
{
|
||||||
std::list<std::wstring> lst;
|
std::list<std::wstring> lst;
|
||||||
|
|
||||||
do {
|
python::list pylst;
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
|
|
||||||
@ -118,9 +120,10 @@ python::list TypeInfoAdapter::getElementDir(kdlib::TypeInfo &typeInfo)
|
|||||||
lst.push_back(name);
|
lst.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (false);
|
} catch(kdlib::DbgException&)
|
||||||
|
{
|
||||||
python::list pylst;
|
return pylst;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
for (std::list<std::wstring>::const_iterator it = lst.begin(); it != lst.end(); ++it)
|
||||||
pylst.append(*it);
|
pylst.append(*it);
|
||||||
|
Loading…
Reference in New Issue
Block a user