Commit 5f0d7125 authored by Aleksey R.'s avatar Aleksey R.

add: addSyntheticModule, removeSyntheticModule

parent 99b48ad0
Subproject commit 9126f4406b47281a331c3022c24eb5de73ca828c
Subproject commit 7c3fcfbf80300cf100b6fe98d40662a1c56041b4
......@@ -213,4 +213,20 @@ std::wstring printSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol)
///////////////////////////////////////////////////////////////////////////////
void addSyntheticModule(kdlib::MEMOFFSET_64 base, unsigned long size, const std::wstring &name, const std::wstring &path /*= std::wstring{}*/)
{
AutoRestorePyState pystate;
return kdlib::addSyntheticModule(base, size, name, path);
}
///////////////////////////////////////////////////////////////////////////////
void removeSyntheticModule(kdlib::MEMOFFSET_64 base)
{
AutoRestorePyState pystate;
return kdlib::removeSyntheticModule(base);
}
///////////////////////////////////////////////////////////////////////////////
} //end namespace pykd
......@@ -456,6 +456,9 @@ kdlib::SyntheticSymbol addSyntheticSymbol( kdlib::MEMOFFSET_64 offset, unsigned
void removeSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol);
std::wstring printSyntheticSymbol(const kdlib::SyntheticSymbol& syntheticSymbol);
void addSyntheticModule(kdlib::MEMOFFSET_64 base, unsigned long size, const std::wstring &name, const std::wstring &path = std::wstring{});
void removeSyntheticModule(kdlib::MEMOFFSET_64 base);
///////////////////////////////////////////////////////////////////////////////
} //end namespace pykd
......@@ -106,6 +106,8 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( getTypeInfoProviderFromPdb_, pykd::getTypeInfoP
BOOST_PYTHON_FUNCTION_OVERLOADS( getTypeInfoProviderFromSource_, pykd::getTypeInfoProviderFromSource, 1, 2);
BOOST_PYTHON_FUNCTION_OVERLOADS(evalExpr_, pykd::evalExpr, 1, 3);
BOOST_PYTHON_FUNCTION_OVERLOADS( addSyntheticModule_, pykd::addSyntheticModule, 3, 4 );
namespace pykd {
void initialize()
......@@ -599,7 +601,6 @@ void pykd_init()
python::def("appendSrcPath", pykd::appendSrcPath,
"Append current source path");
// synthetic symbol
python::def("addSyntheticSymbol", pykd::addSyntheticSymbol,
"The addSyntheticSymbol function adds a synthetic symbol to a module in the current process\n"
......@@ -607,6 +608,12 @@ void pykd_init()
python::def( "removeSyntheticSymbol", pykd::removeSyntheticSymbol,
"The removeSyntheticSymbol function removes a synthetic symbol from a module in the current proces" );
// synthetic module
python::def("addSyntheticModule", pykd::addSyntheticModule, addSyntheticModule_(python::args("base", "size", "name", "path"),
"The addSyntheticModule function adds a synthetic module to the module list the debugger maintains for the current process"));
python::def("removeSyntheticModule", pykd::removeSyntheticModule,
"The removeSyntheticModule function removes a synthetic module from the module list the debugger maintains for the current process");
// secondary callback data
python::def("enumTagged", pykd::enumTagged,
"Return the list of secondary callback data IDs (as a strings)" );
......
......@@ -28,3 +28,15 @@ class SynSymTest(unittest.TestCase):
self.assertRaises( pykd.DbgException, target.module.offset, "synSym2" )
self.assertRaises( pykd.DbgException, pykd.removeSyntheticSymbol, _synsym )
def testModule(self):
"""Add and remove synthetic module"""
base = 64 * 1024
pykd.addSyntheticModule(base, 1024, "artificial_module1")
pykd.addSyntheticModule(base + 1024, 1024, "artificial_module2", "artificial_module2_path")
pykd.removeSyntheticSymbol( pykd.addSyntheticSymbol(base, 1, "artificial_symbol") )
pykd.removeSyntheticModule(base + 1024)
pykd.removeSyntheticModule(base)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment