mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.1.x]
+ AddSynSymbolException: different exception for addSynSymbols + Test adding a two synthetic symbols with equal address git-svn-id: https://pykd.svn.codeplex.com/svn@73137 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e69047ac19
commit
fc9014b440
@ -10,6 +10,7 @@ PyObject *ExceptionTranslator<DbgException>::exceptTypeObject = NULL;
|
||||
PyObject *ExceptionTranslator<MemoryException>::exceptTypeObject = NULL;
|
||||
PyObject *ExceptionTranslator<WaitEventException>::exceptTypeObject = NULL;
|
||||
PyObject *ExceptionTranslator<pyDia::Exception>::exceptTypeObject = NULL;
|
||||
PyObject *ExceptionTranslator<AddSyntheticSymbolException>::exceptTypeObject = NULL;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -127,5 +127,25 @@ private:
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AddSyntheticSymbolException : public DbgException
|
||||
{
|
||||
public:
|
||||
|
||||
AddSyntheticSymbolException(HRESULT hres)
|
||||
: DbgException( buildDesc(hres) )
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
std::string buildDesc(HRESULT hres) {
|
||||
std::stringstream sstream;
|
||||
sstream << "Add synthetic symbol faield\n";
|
||||
sstream << "HRESULT 0x" << std::hex << hres;
|
||||
return sstream.str();
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}; // namespace pykd
|
||||
|
||||
|
@ -829,8 +829,12 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.ptr()
|
||||
);
|
||||
|
||||
|
||||
|
||||
// AddSyntheticSymbolException
|
||||
ExceptionTranslator<AddSyntheticSymbolException>::setTypeObject(
|
||||
python::class_<AddSyntheticSymbolException, python::bases<DbgException> >(
|
||||
"AddSynSymbolException", "Add new synthetic symbol exception", python::no_init)
|
||||
.ptr()
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
|
@ -42,7 +42,7 @@ void SyntheticSymbols::add(
|
||||
DEBUG_ADDSYNTHSYM_DEFAULT,
|
||||
&dbgModuleAndId);
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException("IDebugSymbols3::AddSyntheticSymbol", hres);
|
||||
throw AddSyntheticSymbolException( hres );
|
||||
|
||||
// add/update symbol for target module (in internal map)
|
||||
SymbolsScopedLock lock(*m_allSymbolsLock);
|
||||
|
@ -66,3 +66,16 @@ class SynSymTest(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
target.module.offset("FuncWithName0")-5,
|
||||
target.module.offset("synSym5"))
|
||||
|
||||
def testAddSynSymbolException(self):
|
||||
"""Test of AddSynSymbolException"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-6, 1, "synSym6")
|
||||
|
||||
exceptionOccurred = False
|
||||
try:
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-6, 1, "synSym7")
|
||||
except pykd.AddSynSymbolException:
|
||||
exceptionOccurred = True
|
||||
self.assertTrue(exceptionOccurred)
|
||||
|
Loading…
Reference in New Issue
Block a user