mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x] + find DIA-symbol by VA
git-svn-id: https://pykd.svn.codeplex.com/svn@75587 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
b9b8e855b1
commit
80acef377a
@ -450,6 +450,29 @@ SymbolPtr GlobalScope::findByRvaImpl(
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
SymbolPtr GlobalScope::findByVaImpl(
|
||||||
|
__in ULONGLONG va,
|
||||||
|
__in ULONG symTag,
|
||||||
|
__out LONG &displacement
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DiaSymbolPtr child;
|
||||||
|
HRESULT hres =
|
||||||
|
m_session->findSymbolByVAEx(
|
||||||
|
va,
|
||||||
|
static_cast<enum SymTagEnum>(symTag),
|
||||||
|
&child,
|
||||||
|
&displacement);
|
||||||
|
if (S_OK != hres)
|
||||||
|
throw Exception("Call IDiaSession::findSymbolByVAEx", hres);
|
||||||
|
if (!child)
|
||||||
|
throw Exception("Call IDiaSession::findSymbolByVAEx", E_UNEXPECTED);
|
||||||
|
|
||||||
|
return SymbolPtr( new Symbol(child, m_machineType) );
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SymbolPtr GlobalScope::getSymbolById(ULONG symId)
|
SymbolPtr GlobalScope::getSymbolById(ULONG symId)
|
||||||
{
|
{
|
||||||
DiaSymbolPtr _symbol;
|
DiaSymbolPtr _symbol;
|
||||||
|
@ -265,6 +265,22 @@ public:
|
|||||||
__out LONG &displacement
|
__out LONG &displacement
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// VA -> Symbol
|
||||||
|
python::tuple findByVa(
|
||||||
|
ULONG va,
|
||||||
|
ULONG symTag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LONG displacement;
|
||||||
|
SymbolPtr child = findByVaImpl(va, symTag, displacement);
|
||||||
|
return python::make_tuple(child, displacement);
|
||||||
|
}
|
||||||
|
SymbolPtr findByVaImpl(
|
||||||
|
__in ULONGLONG va,
|
||||||
|
__in ULONG symTag,
|
||||||
|
__out LONG &displacement
|
||||||
|
);
|
||||||
|
|
||||||
// get symbol by unique index
|
// get symbol by unique index
|
||||||
SymbolPtr getSymbolById(ULONG symId);
|
SymbolPtr getSymbolById(ULONG symId);
|
||||||
|
|
||||||
|
@ -757,6 +757,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"DiaScope", "class wrapper for MS DIA global scope", python::no_init )
|
"DiaScope", "class wrapper for MS DIA global scope", python::no_init )
|
||||||
.def("findByRva", &pyDia::GlobalScope::findByRva,
|
.def("findByRva", &pyDia::GlobalScope::findByRva,
|
||||||
"Find symbol by RVA. Return tuple: (DiaSymbol, offset)")
|
"Find symbol by RVA. Return tuple: (DiaSymbol, offset)")
|
||||||
|
.def("findByVa", &pyDia::GlobalScope::findByVa,
|
||||||
|
"Find symbol by VA. Return tuple: (DiaSymbol, offset)")
|
||||||
.def("symbolById", &pyDia::GlobalScope::getSymbolById,
|
.def("symbolById", &pyDia::GlobalScope::getSymbolById,
|
||||||
"Retrieves a symbol by its unique identifier: DiaSymbol::indexId()")
|
"Retrieves a symbol by its unique identifier: DiaSymbol::indexId()")
|
||||||
.def("loadAddress", &pyDia::GlobalScope::getLoadAddress,
|
.def("loadAddress", &pyDia::GlobalScope::getLoadAddress,
|
||||||
@ -764,7 +766,6 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def("setLoadAddress", &pyDia::GlobalScope::setLoadAddress,
|
.def("setLoadAddress", &pyDia::GlobalScope::setLoadAddress,
|
||||||
"Sets the load address for the executable file that corresponds to the symbols in this symbol store");
|
"Sets the load address for the executable file that corresponds to the symbols in this symbol store");
|
||||||
|
|
||||||
|
|
||||||
// CPU type:
|
// CPU type:
|
||||||
DEF_PY_CONST_ULONG(IMAGE_FILE_MACHINE_I386);
|
DEF_PY_CONST_ULONG(IMAGE_FILE_MACHINE_I386);
|
||||||
DEF_PY_CONST_ULONG(IMAGE_FILE_MACHINE_IA64);
|
DEF_PY_CONST_ULONG(IMAGE_FILE_MACHINE_IA64);
|
||||||
|
Loading…
Reference in New Issue
Block a user