[0.2.x] + symbol path

git-svn-id: https://pykd.svn.codeplex.com/svn@80085 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2012-10-08 15:08:08 +00:00 committed by Mikhail I. Izmestev
parent 1e1c88d0ef
commit 03b7cedb85
4 changed files with 67 additions and 1 deletions

View File

@ -91,5 +91,10 @@ ULONG64 getImplicitThread();
void setCurrentProcess( ULONG64 processAddr ); void setCurrentProcess( ULONG64 processAddr );
void setImplicitThread( ULONG64 threadAddr ); void setImplicitThread( ULONG64 threadAddr );
// Symbol patch
std::string getSymbolPath();
void setSymbolPath(const std::string &symPath);
void appendSymbolPath(const std::string &symPath);
}; };

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?> <?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="pykd" Name="pykd"
ProjectGUID="{FE961905-666F-4908-A212-961465F46F13}" ProjectGUID="{FE961905-666F-4908-A212-961465F46F13}"
RootNamespace="pykd" RootNamespace="pykd"
@ -593,6 +593,10 @@
RelativePath=".\win\memory.cpp" RelativePath=".\win\memory.cpp"
> >
</File> </File>
<File
RelativePath=".\win\sympath.cpp"
>
</File>
<File <File
RelativePath=".\win\utils.h" RelativePath=".\win\utils.h"
> >

View File

@ -245,6 +245,11 @@ BOOST_PYTHON_MODULE( pykd )
python::def( "setImplicitThread", &setImplicitThread, python::def( "setImplicitThread", &setImplicitThread,
"Set implicit thread for current process" ); "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 // custom types
python::def( "createStruct", &CustomStruct::create, CustomStruct_create( python::args( "name", "align" ), python::def( "createStruct", &CustomStruct::create, CustomStruct_create( python::args( "name", "align" ),
"Create empty structure. Use append() method for building" ) ); "Create empty structure. Use append() method for building" ) );

52
pykd/win/sympath.cpp Normal file
View File

@ -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
////////////////////////////////////////////////////////////////////////////////