mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[+] added : __getattribute__ method for dbgModuleClass class to simplify access to module symbols's offsets
git-svn-id: https://pykd.svn.codeplex.com/svn@60262 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
efdf59111b
commit
b4898cff7e
@ -153,7 +153,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def("begin", &dbgModuleClass::getBegin )
|
.def("begin", &dbgModuleClass::getBegin )
|
||||||
.def("end", &dbgModuleClass::getEnd )
|
.def("end", &dbgModuleClass::getEnd )
|
||||||
.def("name", &dbgModuleClass::getName )
|
.def("name", &dbgModuleClass::getName )
|
||||||
.def("contain", &dbgModuleClass::contain );
|
.def("contain", &dbgModuleClass::contain )
|
||||||
|
.def("__getattribute__", &dbgModuleClass::getOffset );
|
||||||
boost::python::class_<dbgExtensionClass>(
|
boost::python::class_<dbgExtensionClass>(
|
||||||
"ext",
|
"ext",
|
||||||
"windbg extension",
|
"windbg extension",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "dbgmodule.h"
|
#include "dbgmodule.h"
|
||||||
#include "dbgexcept.h"
|
#include "dbgexcept.h"
|
||||||
#include "dbgmem.h"
|
#include "dbgmem.h"
|
||||||
|
#include "dbgsym.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -127,3 +128,23 @@ dbgModuleClass::reloadSymbols()
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ULONG64
|
||||||
|
dbgModuleClass::getOffset( const std::string &symName )
|
||||||
|
{
|
||||||
|
OffsetMap::iterator offset = m_offsets.find( symName );
|
||||||
|
if ( offset != m_offsets.end() )
|
||||||
|
{
|
||||||
|
return offset->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG64 offsetVal = findAddressForSymbol( m_name, symName );
|
||||||
|
if ( (ULONG64)~0 == offsetVal )
|
||||||
|
return offsetVal;
|
||||||
|
|
||||||
|
m_offsets.insert( std::make_pair( symName, offsetVal ) );
|
||||||
|
|
||||||
|
return offsetVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include <boost/python/object.hpp>
|
#include <boost/python/object.hpp>
|
||||||
@ -48,6 +49,10 @@ public:
|
|||||||
void
|
void
|
||||||
reloadSymbols();
|
reloadSymbols();
|
||||||
|
|
||||||
|
ULONG64
|
||||||
|
getOffset( const std::string &symName );
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ULONG64 m_base;
|
ULONG64 m_base;
|
||||||
@ -55,6 +60,9 @@ private:
|
|||||||
ULONG64 m_end;
|
ULONG64 m_end;
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
|
typedef std::map<std::string, ULONG64> OffsetMap;
|
||||||
|
OffsetMap m_offsets;
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7,7 +7,6 @@ def loadSymbols():
|
|||||||
|
|
||||||
global nt
|
global nt
|
||||||
nt = loadModule( "nt" )
|
nt = loadModule( "nt" )
|
||||||
nt.PsActiveProcessHead = getOffset( "nt", "PsActiveProcessHead" )
|
|
||||||
|
|
||||||
|
|
||||||
def processInfo():
|
def processInfo():
|
||||||
|
Loading…
Reference in New Issue
Block a user