Commit 3ab64bdc authored by ussrhero's avatar ussrhero
Browse files

added : module.hasSymbol method (check if a module has the specified symbol)

parent 5d5e634a
......@@ -886,6 +886,8 @@ void pykd_init()
"Return tuple of the module's file version")
.def("getFixedFileInfo", ModuleAdapter::getFixedFileInfo,
"Return FixedFileInfo" )
.def("hasSymbol", ModuleAdapter::isContainedSymbol,
"Check if module has the specified symbol")
.def("__getattr__", ModuleAdapter::getAttrByName,
"Return symbol offset or type as attribute" )
.def("__getitem__", ModuleAdapter::getItemByKey,
......
......@@ -145,12 +145,6 @@ class ModuleTest( unittest.TestCase ):
self.assertFalse("NotExist" in target.module)
self.assertRaises(Exception, lambda md : 2 in md, target.module)
def testHasAttr(self):
self.assertTrue(hasattr(target.module, "voidPtr"))
self.assertTrue(hasattr(target.module, "structTest"))
self.assertFalse(hasattr(target.module, "NotExist"))
self.assertRaises(Exception, lambda md : hasattr(2, target.module), target.module)
def testGetByKey(self):
self.assertFalse(None == target.module["voidPtr"])
self.assertFalse(None == target.module["structTest"] )
......@@ -159,6 +153,11 @@ class ModuleTest( unittest.TestCase ):
def testEvalInModuleScope(self):
self.assertEqual( target.module.rva('voidPtr'), eval("voidPtr - %#x" % target.module.begin(), globals(), target.module) )
def testHasSymbol(self):
self.assertTrue(target.module.hasSymbol("voidPtr"))
self.assertTrue(target.module.hasSymbol("structTest"))
self.assertFalse(target.module.hasSymbol("notExists"))
def testPrint(self):
modAsStr = str(target.module)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment