mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 20:03:33 +08:00
[pykd] fixed: issue 9555 ( dbgModuleClass.name() corrupts output )
git-svn-id: https://pykd.svn.codeplex.com/svn@70041 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
26c2b2d117
commit
4dc9bba048
@ -24,9 +24,8 @@ void dbgPrint::dprint( const boost::python::object& obj, bool dml )
|
|||||||
void dbgPrint::dprintln( const boost::python::object& obj, bool dml )
|
void dbgPrint::dprintln( const boost::python::object& obj, bool dml )
|
||||||
{
|
{
|
||||||
std::wstring str = boost::python::extract<std::wstring>( obj );
|
std::wstring str = boost::python::extract<std::wstring>( obj );
|
||||||
str += L"\r\n";
|
|
||||||
|
|
||||||
dbgExt->control4->ControlledOutputWide( dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, L"%ws", str.c_str() );
|
dbgExt->control4->ControlledOutputWide( dml ? DEBUG_OUTCTL_AMBIENT_DML : DEBUG_OUTCTL_AMBIENT_TEXT, DEBUG_OUTPUT_NORMAL, L"%ws\r\n", str.c_str() );
|
||||||
|
|
||||||
std::wcout << str;
|
std::wcout << str;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,9 @@ void queryModuleParams(
|
|||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
|
std::vector<char> nameBuf(moduleNameChars);
|
||||||
|
|
||||||
name.resize(moduleNameChars + 1);
|
name.resize(moduleNameChars + 1);
|
||||||
hres = dbgExt->symbols->GetModuleNames(
|
hres = dbgExt->symbols->GetModuleNames(
|
||||||
moduleIndex,
|
moduleIndex,
|
||||||
@ -75,14 +78,16 @@ void queryModuleParams(
|
|||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&name[0],
|
&nameBuf[0],
|
||||||
(ULONG)name.size(),
|
nameBuf.size(),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL );
|
NULL );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugSymbol::GetModuleNames failed" );
|
throw DbgException( "IDebugSymbol::GetModuleNames failed" );
|
||||||
|
|
||||||
|
name = std::string( &nameBuf[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -106,7 +111,7 @@ dbgModuleClass::dbgModuleClass( const std::string &name, ULONG64 base, ULONG siz
|
|||||||
m_base( addr64(base) ),
|
m_base( addr64(base) ),
|
||||||
m_end( addr64(base) + size )
|
m_end( addr64(base) + size )
|
||||||
{
|
{
|
||||||
reloadSymbols();
|
//reloadSymbols();
|
||||||
|
|
||||||
std::string pattern = name + "!*";
|
std::string pattern = name + "!*";
|
||||||
ULONG64 enumHandle = 0;
|
ULONG64 enumHandle = 0;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
#include "dbgext.h"
|
#include "dbgext.h"
|
||||||
#include "dbgexcept.h"
|
#include "dbgexcept.h"
|
||||||
#include "dbgsystem.h"
|
#include "dbgsystem.h"
|
||||||
@ -13,23 +12,11 @@ is64bitSystem()
|
|||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
hres = dbgExt->control->IsPointer64Bit();
|
hres = dbgExt->control->IsPointer64Bit();
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::IsPointer64Bit failed" );
|
||||||
|
|
||||||
return hres == S_OK;
|
return hres == S_OK;
|
||||||
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -48,29 +35,16 @@ dbgSymPath()
|
|||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
std::string pathStr;
|
std::string pathStr;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
ULONG size;
|
ULONG size;
|
||||||
dbgExt->symbols->GetSymbolPath( NULL, 0, &size );
|
dbgExt->symbols->GetSymbolPath( NULL, 0, &size );
|
||||||
|
|
||||||
|
|
||||||
std::vector<char> path(size);
|
std::vector<char> path(size);
|
||||||
hres = dbgExt->symbols->GetSymbolPath( &path[0], size, NULL );
|
hres = dbgExt->symbols->GetSymbolPath( &path[0], size, NULL );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugSymbols::GetSymbolPath failed" );
|
throw DbgException( "IDebugSymbols::GetSymbolPath failed" );
|
||||||
|
|
||||||
pathStr = &path[0];
|
return std::string(&path[0]);
|
||||||
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return pathStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,7 +55,6 @@ getPdbFile( ULONG64 moduleBase )
|
|||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
|
|
||||||
IMAGEHLP_MODULEW64 imageHelpInfo = { 0 };
|
IMAGEHLP_MODULEW64 imageHelpInfo = { 0 };
|
||||||
@ -98,22 +71,13 @@ getPdbFile( ULONG64 moduleBase )
|
|||||||
0,
|
0,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugAdvanced2::GetSymbolInformation failed" );
|
||||||
|
|
||||||
char fileName[ 256 ];
|
char fileName[ 256 ];
|
||||||
WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL );
|
WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL );
|
||||||
|
|
||||||
return std::string( fileName );
|
return std::string( fileName );
|
||||||
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -121,26 +85,10 @@ getPdbFile( ULONG64 moduleBase )
|
|||||||
void
|
void
|
||||||
reloadModule( const char * moduleName )
|
reloadModule( const char * moduleName )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
// ïîäàâèòü âûâîä ñîîáùåíèé îá îòñóòñòâèè ñèìâîëîâ
|
// ïîäàâèòü âûâîä ñîîáùåíèé îá îòñóòñòâèè ñèìâîëîâ
|
||||||
OutputReader outputReader( dbgExt->client );
|
OutputReader outputReader( dbgExt->client );
|
||||||
|
|
||||||
hres = dbgExt->symbols->Reload( moduleName );
|
dbgExt->symbols->Reload( moduleName );
|
||||||
|
|
||||||
//if ( FAILED( hres ) )
|
|
||||||
// throw DbgException( "IDebugSymbol::Reload failed" );
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -149,10 +97,6 @@ bool
|
|||||||
isKernelDebugging()
|
isKernelDebugging()
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
ULONG debugClass, debugQualifier;
|
ULONG debugClass, debugQualifier;
|
||||||
|
|
||||||
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
||||||
@ -160,19 +104,7 @@ isKernelDebugging()
|
|||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
||||||
|
|
||||||
result = debugClass == DEBUG_CLASS_KERNEL;
|
return debugClass == DEBUG_CLASS_KERNEL;
|
||||||
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -181,10 +113,6 @@ bool
|
|||||||
isDumpAnalyzing()
|
isDumpAnalyzing()
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
ULONG debugClass, debugQualifier;
|
ULONG debugClass, debugQualifier;
|
||||||
|
|
||||||
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
||||||
@ -192,19 +120,7 @@ isDumpAnalyzing()
|
|||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
||||||
|
|
||||||
result = debugQualifier >= DEBUG_DUMP_SMALL;
|
return debugQualifier >= DEBUG_DUMP_SMALL;
|
||||||
|
|
||||||
}
|
|
||||||
catch( std::exception &e )
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user