From 60d3b958b88b6fe7da01b18e1ec299d2bf293a0a Mon Sep 17 00:00:00 2001 From: "SND\\EreTIk_cp" <SND\EreTIk_cp@9b283d60-5439-405e-af05-b73fd8c4d996> Date: Thu, 23 Apr 2015 10:25:16 +0000 Subject: [PATCH] [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 --- pykd/pydbgeng.cpp | 28 ++++++++++++++++++++++++++++ pykd/pydbgeng.h | 4 ++++ pykd/pymod.cpp | 19 ++++++++++++++++--- 3 files changed, 48 insertions(+), 3 deletions(-) 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_<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(); }