diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index a24d8ed..a56f96e 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -91,5 +91,10 @@ ULONG64 getImplicitThread(); void setCurrentProcess( ULONG64 processAddr ); void setImplicitThread( ULONG64 threadAddr ); +// Symbol patch +std::string getSymbolPath(); +void setSymbolPath(const std::string &symPath); +void appendSymbolPath(const std::string &symPath); + }; diff --git a/pykd/pykd_2008.vcproj b/pykd/pykd_2008.vcproj index 5ccd555..480f8e5 100644 --- a/pykd/pykd_2008.vcproj +++ b/pykd/pykd_2008.vcproj @@ -1,7 +1,7 @@ + + diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 882738b..88cf7a7 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -245,6 +245,11 @@ BOOST_PYTHON_MODULE( pykd ) python::def( "setImplicitThread", &setImplicitThread, "Set implicit thread for current process" ); + // symbol path + python::def( "getSymbolPath", &getSymbolPath, "Returns current symbol path"); + python::def( "setSymbolPath", &setSymbolPath, "Set current symbol path"); + python::def( "appendSymbolPath", &appendSymbolPath, "Append current symbol path"); + // custom types python::def( "createStruct", &CustomStruct::create, CustomStruct_create( python::args( "name", "align" ), "Create empty structure. Use append() method for building" ) ); diff --git a/pykd/win/sympath.cpp b/pykd/win/sympath.cpp new file mode 100644 index 0000000..7cefe2e --- /dev/null +++ b/pykd/win/sympath.cpp @@ -0,0 +1,52 @@ +// +// Win-[DbgEng]: Debug symbols path +// + +//////////////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "dbgeng.h" + +//////////////////////////////////////////////////////////////////////////////// + +namespace pykd { + +//////////////////////////////////////////////////////////////////////////////// + +std::string getSymbolPath() +{ + ULONG retSymPathChars = 0; + g_dbgEng->symbols->GetSymbolPath(NULL, 0, &retSymPathChars); + if (!retSymPathChars) + return std::string(""); + + const ULONG symPathChars = retSymPathChars + 1; + boost::scoped_array< CHAR > symPath( new CHAR [symPathChars] ); + RtlZeroMemory(symPath.get(), sizeof(CHAR) * symPathChars); + HRESULT hres = + g_dbgEng->symbols->GetSymbolPath(symPath.get(), symPathChars, &retSymPathChars); + if (S_OK != hres) + throw DbgException("IDebugSymbols::GetSymbolPath", hres); + + return std::string( symPath.get() ); +} + +//////////////////////////////////////////////////////////////////////////////// + +void setSymbolPath(const std::string &symPath) +{ + g_dbgEng->symbols->SetSymbolPath(symPath.c_str()); +} + +//////////////////////////////////////////////////////////////////////////////// + +void appendSymbolPath(const std::string &symPath) +{ + g_dbgEng->symbols->AppendSymbolPath(symPath.c_str()); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace pykd + +////////////////////////////////////////////////////////////////////////////////