mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 20:03:33 +08:00
[0.2.x] + set symsrv.dll directory
git-svn-id: https://pykd.svn.codeplex.com/svn@80120 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
6c9444877d
commit
38b25e0ccc
@ -134,6 +134,41 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct SymSrvLoadHelper : boost::noncopyable
|
||||||
|
{
|
||||||
|
static std::wstring g_symSrvDir;
|
||||||
|
|
||||||
|
HMODULE m_loadedSymSrv;
|
||||||
|
|
||||||
|
SymSrvLoadHelper() : m_loadedSymSrv(NULL)
|
||||||
|
{
|
||||||
|
if (g_symSrvDir.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (::GetModuleHandle(_T("symsrv.dll")))
|
||||||
|
{
|
||||||
|
// already loaded
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring symSrvFullPath = g_symSrvDir;
|
||||||
|
if (L'\\' != *symSrvFullPath.rbegin())
|
||||||
|
symSrvFullPath += L"\\";
|
||||||
|
symSrvFullPath += L"symsrv.dll";
|
||||||
|
|
||||||
|
m_loadedSymSrv = ::LoadLibraryW( symSrvFullPath.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
~SymSrvLoadHelper()
|
||||||
|
{
|
||||||
|
if (m_loadedSymSrv)
|
||||||
|
::FreeLibrary(m_loadedSymSrv);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::wstring SymSrvLoadHelper::g_symSrvDir;
|
||||||
|
|
||||||
// Load debug symbols using ReadExeAtRVACallback
|
// Load debug symbols using ReadExeAtRVACallback
|
||||||
struct DataForExeByRva : IDataProvider {
|
struct DataForExeByRva : IDataProvider {
|
||||||
|
|
||||||
@ -155,6 +190,7 @@ struct DataForExeByRva : IDataProvider {
|
|||||||
|
|
||||||
virtual HRESULT load(__inout IDiaDataSource &dataSource) override {
|
virtual HRESULT load(__inout IDiaDataSource &dataSource) override {
|
||||||
CComPtr< IUnknown > readExeAtRVACallback(new ReadExeAtRVACallback(m_loadBase, m_openedSymbolFile) );
|
CComPtr< IUnknown > readExeAtRVACallback(new ReadExeAtRVACallback(m_loadBase, m_openedSymbolFile) );
|
||||||
|
SymSrvLoadHelper symSrvLoadHelper;
|
||||||
return
|
return
|
||||||
dataSource.loadDataForExe(
|
dataSource.loadDataForExe(
|
||||||
m_executable.c_str(),
|
m_executable.c_str(),
|
||||||
@ -200,4 +236,11 @@ SymbolSessionPtr loadSymbolFile(
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void setSymSrvDir(const std::wstring &symSrvDir)
|
||||||
|
{
|
||||||
|
diaLoad::SymSrvLoadHelper::g_symSrvDir = symSrvDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
} // namespace pykd
|
} // namespace pykd
|
||||||
|
@ -245,6 +245,9 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
python::def( "setImplicitThread", &setImplicitThread,
|
python::def( "setImplicitThread", &setImplicitThread,
|
||||||
"Set implicit thread for current process" );
|
"Set implicit thread for current process" );
|
||||||
|
|
||||||
|
python::def( "setSymSrvDir", &setSymSrvDir,
|
||||||
|
"Set directory of SYMSRV.dll library.\nUsually this is a directory of WinDbg");
|
||||||
|
|
||||||
// symbol path
|
// symbol path
|
||||||
python::def( "getSymbolPath", &getSymbolPath, "Returns current symbol path");
|
python::def( "getSymbolPath", &getSymbolPath, "Returns current symbol path");
|
||||||
python::def( "setSymbolPath", &setSymbolPath, "Set current symbol path");
|
python::def( "setSymbolPath", &setSymbolPath, "Set current symbol path");
|
||||||
|
@ -181,6 +181,8 @@ SymbolSessionPtr loadSymbolFile(
|
|||||||
__in_opt std::string symbolSearchPath = std::string()
|
__in_opt std::string symbolSearchPath = std::string()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void setSymSrvDir(const std::wstring &symSrvDirectory);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}; // end pykd endpoint
|
}; // end pykd endpoint
|
Loading…
Reference in New Issue
Block a user