diff --git a/pykd/pydbgeng.cpp b/pykd/pydbgeng.cpp index 40358b8..cf6ba02 100644 --- a/pykd/pydbgeng.cpp +++ b/pykd/pydbgeng.cpp @@ -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 diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h index df670f6..064da4a 100644 --- a/pykd/pydbgeng.h +++ b/pykd/pydbgeng.h @@ -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 diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 103851a..f26870e 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -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_( "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_( + "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(); }