[0.2.x] added: writeDump routine ( Create memory dump file )

git-svn-id: https://pykd.svn.codeplex.com/svn@82203 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-01-09 07:07:42 +00:00 committed by Mikhail I. Izmestev
parent 3b7173878b
commit 22496fba41
4 changed files with 30 additions and 1 deletions

View File

@ -12,6 +12,7 @@ void detachProcess( ULONG processId = -1);
void terminateProcess( ULONG processId = -1); void terminateProcess( ULONG processId = -1);
void loadDump( const std::wstring &fileName ); void loadDump( const std::wstring &fileName );
void writeDump( const std::wstring &fileNamem, bool smallDump );
bool isDumpAnalyzing(); bool isDumpAnalyzing();
bool isKernelDebugging(); bool isKernelDebugging();

View File

@ -2,7 +2,7 @@
#define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MAJOR 0
#define PYKD_VERSION_MINOR 2 #define PYKD_VERSION_MINOR 2
#define PYKD_VERSION_SUBVERSION 0 #define PYKD_VERSION_SUBVERSION 0
#define PYKD_VERSION_BUILDNO 11 #define PYKD_VERSION_BUILDNO 12
#define __VER_STR2__(x) #x #define __VER_STR2__(x) #x

View File

@ -104,6 +104,8 @@ BOOST_PYTHON_MODULE( pykd )
"Check if kernel dubugging is running" ); "Check if kernel dubugging is running" );
python::def( "isWindbgExt", &WindbgGlobalSession::isInit, python::def( "isWindbgExt", &WindbgGlobalSession::isInit,
"Check if script works in windbg context" ); "Check if script works in windbg context" );
python::def( "writeDump", &writeDump,
"Write memory dump" );
python::def( "breakin", &debugBreak, python::def( "breakin", &debugBreak,
"Break into debugger" ); "Break into debugger" );

View File

@ -144,6 +144,32 @@ void loadDump( const std::wstring &fileName )
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
void writeDump( const std::wstring &fileName, bool smallDump )
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
HRESULT hres;
ULONG debugClass, debugQualifier;
hres = g_dbgEng->control->GetDebuggeeType( &debugClass, &debugQualifier );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
hres = g_dbgEng->client->WriteDumpFileWide(
fileName.c_str(),
NULL,
smallDump ? DEBUG_DUMP_SMALL : ( debugClass == DEBUG_CLASS_KERNEL ? DEBUG_DUMP_FULL : DEBUG_DUMP_DEFAULT ),
DEBUG_FORMAT_DEFAULT,
NULL );
if ( FAILED(hres) )
throw DbgException( "IDebugClient4::WriteDumpFileWide failed" );
}
///////////////////////////////////////////////////////////////////////////////////
bool isDumpAnalyzing() bool isDumpAnalyzing()
{ {
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate ); PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );