[0.3.x] workitem/13549: addSynSymbol is not defined. addSyntheticSymbol and removeSyntheticSymbol functions added

git-svn-id: https://pykd.svn.codeplex.com/svn@90464 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2015-04-23 10:25:16 +00:00 committed by Mikhail I. Izmestev
parent 516095649c
commit 60d3b958b8
3 changed files with 48 additions and 3 deletions

View File

@ -165,4 +165,32 @@ python::tuple getBugCheckData()
///////////////////////////////////////////////////////////////////////////////
kdlib::SyntheticSymbol addSyntheticSymbol( kdlib::MEMOFFSET_64 offset, unsigned long size, const std::wstring &name )
{
AutoRestorePyState pystate;
return kdlib::addSyntheticSymbol(offset, size, name);
}
///////////////////////////////////////////////////////////////////////////////
void removeSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol)
{
AutoRestorePyState pystate;
return kdlib::removeSyntheticSymbol(syntheticSymbol);
}
///////////////////////////////////////////////////////////////////////////////
std::wstring printSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol)
{
std::wstringstream sstream;
sstream << L"moduleBase=0x" << std::hex << syntheticSymbol.moduleBase << std::endl;
sstream << L"symbolId= 0x" << std::hex << syntheticSymbol.symbolId << std::endl;
return sstream.str();
}
///////////////////////////////////////////////////////////////////////////////
} //end namespace pykd

View File

@ -431,6 +431,10 @@ std::wstring printExceptionInfo( kdlib::ExceptionInfo& exceptionInfo );
python::tuple getBugCheckData();
kdlib::SyntheticSymbol addSyntheticSymbol( kdlib::MEMOFFSET_64 offset, unsigned long size, const std::wstring &name );
void removeSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol);
std::wstring printSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol);
///////////////////////////////////////////////////////////////////////////////
} //end namespace pykd

View File

@ -456,6 +456,13 @@ BOOST_PYTHON_MODULE( pykd )
python::def("appendSymbolPath", pykd::appendSymbolPath,
"Append current symbol path");
// synthetic symbol
python::def("addSyntheticSymbol", pykd::addSyntheticSymbol,
"The addSyntheticSymbol function adds a synthetic symbol to a module in the current process\n"
"Note: reloading the symbols for the module deletes all synthetic symbols associated with that module.");
python::def( "removeSyntheticSymbol", pykd::removeSyntheticSymbol,
"The removeSyntheticSymbol function removes a synthetic symbol from a module in the current proces" );
python::class_<kdlib::NumBehavior, boost::noncopyable>( "numVariant", "numVariant", python::no_init )
.def("__init__", python::make_constructor(&NumVariantAdaptor::getVariant) )
.def( "__eq__", &NumVariantAdaptor::eq )
@ -821,9 +828,6 @@ BOOST_PYTHON_MODULE( pykd )
"Build number for the target's operating system")
.def_readonly( "buildString", &kdlib::SystemInfo::buildDescription,
"String that identifies the build of the system")
//.def_readonly( "servicePackString", &SystemVersion::servicePackString,
// "String for the service pack level of the target computer")
//.def_readonly( "isCheckedBuild", &SystemVersion::isCheckedBuild,
@ -1051,6 +1055,15 @@ BOOST_PYTHON_MODULE( pykd )
"Breakpoint hit callback")
;
python::class_<kdlib::SyntheticSymbol>(
"syntheticSymbol", "Structure describes a synthetic symbol within a module", python::no_init)
.def_readonly( "moduleBase", &kdlib::SyntheticSymbol::moduleBase,
"The location in the target's virtual address space of the module's base address")
.def_readonly( "symbolId", &kdlib::SyntheticSymbol::symbolId,
"The symbol ID of the symbol within the module")
.def("__str__", pykd::printSyntheticSymbol,
"Return object as a string");
// C++ exception translation to python
pykd::registerExceptions();
}