mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[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:
parent
1e1c88d0ef
commit
03b7cedb85
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="pykd"
|
||||
ProjectGUID="{FE961905-666F-4908-A212-961465F46F13}"
|
||||
RootNamespace="pykd"
|
||||
@ -593,6 +593,10 @@
|
||||
RelativePath=".\win\memory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\win\sympath.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\win\utils.h"
|
||||
>
|
||||
|
@ -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" ) );
|
||||
|
52
pykd/win/sympath.cpp
Normal file
52
pykd/win/sympath.cpp
Normal 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
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
Loading…
Reference in New Issue
Block a user