From 5025a7c05bd709d8ef6a1c623447aa732dc21edf Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Mon, 8 Jun 2015 14:16:33 +0000 Subject: [PATCH] [0.3.x] added : getSourceFileFromSrcSrv ( load and return source file from source server by the specified offset ) [0.3.x] added : getSrcPath ( return current source server path ) [0.3.x] added : setSrcPath ( set source path ) [0.3.x] added : appendSrcPath ( append current source path ) git-svn-id: https://pykd.svn.codeplex.com/svn@90664 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pydbgeng.h | 6 ++++++ pykd/pymod.cpp | 12 ++++++++++++ pykd/pysymengine.h | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h index 064da4a..f883b1c 100644 --- a/pykd/pydbgeng.h +++ b/pykd/pydbgeng.h @@ -421,6 +421,12 @@ inline std::wstring getSourceFile(kdlib::MEMOFFSET_64 offset = 0) return kdlib::getSourceFile(offset); } +inline std::wstring getSourceFileFromSrcSrv(kdlib::MEMOFFSET_64 offset = 0) +{ + AutoRestorePyState pystate; + return kdlib::getSourceFileFromSrcSrv(offset); +} + kdlib::SystemInfo getSystemVersion(); std::wstring printSystemVersion( kdlib::SystemInfo& sysInfo ); diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 746af7a..217e237 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -62,6 +62,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( loadDoubles_, pykd::loadDoubles, 2, 3 ); BOOST_PYTHON_FUNCTION_OVERLOADS( compareMemory_, pykd::compareMemory, 3, 4 ); BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFile_, pykd::getSourceFile, 0, 1 ); +BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceFileFromSrcSrv_, pykd::getSourceFileFromSrcSrv, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS( getSourceLine_, pykd::getSourceLine, 0, 1 ); BOOST_PYTHON_FUNCTION_OVERLOADS( findSymbol_, pykd::findSymbol, 1, 2 ); @@ -306,8 +307,11 @@ BOOST_PYTHON_MODULE( pykd ) // types and vaiables python::def( "getSourceFile", pykd::getSourceFile, getSourceFile_( python::args( "offset"), "Return source file by the specified offset" ) ); + python::def("getSourceFileFromSrcSrv", pykd::getSourceFileFromSrcSrv, getSourceFileFromSrcSrv_(python::args("offset"), + "Load and return source file from source server by the specified offset") ); python::def( "getSourceLine", pykd::getSourceLine, getSourceLine_( python::args( "offset"), "Return source file name, line and displacement by the specified offset" ) ); + python::def( "getOffset", pykd::getSymbolOffset, "Return traget virtual address for specified symbol" ); python::def( "findSymbol", pykd::findSymbol, findSymbol_( python::args( "offset", "showDisplacement"), @@ -456,6 +460,14 @@ BOOST_PYTHON_MODULE( pykd ) python::def("appendSymbolPath", pykd::appendSymbolPath, "Append current symbol path"); + python::def("getSrcPath", pykd::getSrcPath, + "Return current source server path"); + python::def("setSrcPath", pykd::setSrcPath, + "Set source path"); + 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" diff --git a/pykd/pysymengine.h b/pykd/pysymengine.h index 064f2de..0f9f674 100644 --- a/pykd/pysymengine.h +++ b/pykd/pysymengine.h @@ -34,4 +34,25 @@ void appendSymbolPath(const std::wstring &symPath) kdlib::appendSymbolPath(symPath); } +inline +std::wstring getSrcPath() +{ + AutoRestorePyState pystate; + return kdlib::getSrcPath(); +} + +inline +void setSrcPath(const std::wstring &srcPath) +{ + AutoRestorePyState pystate; + kdlib::setSrcPath(srcPath); +} + +inline +void appendSrcPath(const std::wstring &srcPath) +{ + AutoRestorePyState pystate; + kdlib::appendSrcPath(srcPath); +} + } // namespace pykd