revert changes for #50
This commit is contained in:
parent
c8d153a1d4
commit
a447202c6a
@ -91,7 +91,16 @@ struct ModuleAdapter : public kdlib::Module
|
||||
catch (kdlib::DbgException&)
|
||||
{ }
|
||||
|
||||
return python::object(module.getTypeByName(symbolName));
|
||||
|
||||
try {
|
||||
return python::object(module.getTypeByName(symbolName));
|
||||
}
|
||||
catch (kdlib::DbgException&)
|
||||
{ }
|
||||
|
||||
std::wstringstream sstr;
|
||||
sstr << L'\'' << module.getName() << L'\'' << L" module has not a symbol " << L'\'' << symbolName << L'\'';
|
||||
throw AttributeException(std::string(_bstr_t(sstr.str().c_str())).c_str());
|
||||
}
|
||||
|
||||
static python::object getItemByKey(kdlib::Module& module, const std::wstring &symbolName)
|
||||
@ -113,7 +122,7 @@ struct ModuleAdapter : public kdlib::Module
|
||||
}
|
||||
|
||||
std::wstringstream sstr;
|
||||
sstr << L"module hase symbol " << L'\'' << symbolName << L'\'';
|
||||
sstr << L"module has not a symbol " << L'\'' << symbolName << L'\'';
|
||||
throw KeyException(std::string(_bstr_t(sstr.str().c_str())).c_str());
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,19 @@ kdlib::TypedVarPtr TypedVarAdapter::getFieldAttr(kdlib::TypedVar& typedVar, cons
|
||||
catch (kdlib::TypeException&)
|
||||
{}
|
||||
|
||||
return typedVar.getMethod(name);
|
||||
|
||||
try
|
||||
{
|
||||
return typedVar.getMethod(name);
|
||||
}
|
||||
catch (kdlib::TypeException&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::stringstream sstr;
|
||||
sstr << "typed var has no field " << '\'' << _bstr_t(name.c_str()) << '\'';
|
||||
throw AttributeException(sstr.str().c_str());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -273,7 +273,19 @@ kdlib::TypeInfoPtr TypeInfoAdapter::getElementAttr(kdlib::TypeInfo &typeInfo, co
|
||||
catch (kdlib::TypeException&)
|
||||
{}
|
||||
|
||||
return typeInfo.getMethod(name);
|
||||
try
|
||||
{
|
||||
return typeInfo.getMethod(name);
|
||||
}
|
||||
catch (kdlib::TypeException&)
|
||||
{
|
||||
}
|
||||
|
||||
std::stringstream sstr;
|
||||
sstr << '\'' << _bstr_t(typeInfo.getName().c_str()) << '\''
|
||||
<< " type has no field " << '\'' << _bstr_t(name.c_str()) << '\'';
|
||||
throw AttributeException(sstr.str().c_str());
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -87,7 +87,7 @@ class TypedVarTest( unittest.TestCase ):
|
||||
self.assertEqual( True, tv1.m_field2 )
|
||||
self.assertEqual( 1, tv1.m_field3 )
|
||||
self.assertEqual( 1, tv1["m_field3"] )
|
||||
self.assertRaises( pykd.SymbolException, lambda t: t.not_exists, tv1) # non-exsisting field
|
||||
self.assertRaises( AttributeError, lambda t: t.not_exists, tv1) # non-exsisting field
|
||||
self.assertRaises( KeyError, lambda t: t["not_exists"], tv1) # non-exsisting field
|
||||
|
||||
def testPtrField(self):
|
||||
@ -439,7 +439,7 @@ class TypedVarTest( unittest.TestCase ):
|
||||
var = target.module.typedVar("structTest", [0x55] * 20 )
|
||||
setattr(var, "m_field1", 11)
|
||||
self.assertEqual(11, getattr(var, "m_field1"))
|
||||
self.assertRaises(pykd.SymbolException, lambda x: getattr(x, "noexists"), var)
|
||||
self.assertRaises(AttributeError, lambda x: getattr(x, "noexists"), var)
|
||||
|
||||
def testEvalPyScope(self):
|
||||
var = target.module.typedVar("structTest", [0x55] * 20 )
|
||||
|
@ -42,7 +42,7 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
self.assertTrue( "UInt4B", ti1.m_field0.name() )
|
||||
self.assertTrue( "m_field0" in ti1 )
|
||||
self.assertFalse( "not_exist" in ti1) # non-exsisting field
|
||||
self.assertRaises( pykd.SymbolException, lambda t: t.not_exists, ti1) # non-exsisting field
|
||||
self.assertRaises( AttributeError, lambda t: t.not_exists, ti1) # non-exsisting field
|
||||
|
||||
|
||||
def testBaseTypes( self ):
|
||||
@ -354,7 +354,7 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
typeProvider = pykd.getTypeInfoProviderFromPdb(pdb)
|
||||
self.assertEqual("structTest", typeProvider.getTypeByName("structTest").name())
|
||||
self.assertEqual("structTest", typeProvider.structTest.name())
|
||||
self.assertEqual(16, len(list(typeProvider.typeIterator("*struct*"))))
|
||||
self.assertEqual(15, len(list(typeProvider.typeIterator("*struct*"))))
|
||||
|
||||
def testScopeName(self):
|
||||
self.assertEqual( target.module.name(), pykd.typeInfo( "structTest" ).scopeName() )
|
||||
|
Loading…
Reference in New Issue
Block a user