mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ void queryModuleParams(
|
||||
NULL,
|
||||
0,
|
||||
NULL );
|
||||
|
||||
std::vector<char> nameBuf(moduleNameChars);
|
||||
|
||||
name.resize(moduleNameChars + 1);
|
||||
hres = dbgExt->symbols->GetModuleNames(
|
||||
moduleIndex,
|
||||
@ -75,14 +78,16 @@ void queryModuleParams(
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
&name[0],
|
||||
(ULONG)name.size(),
|
||||
&nameBuf[0],
|
||||
nameBuf.size(),
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL );
|
||||
if ( FAILED( hres ) )
|
||||
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_end( addr64(base) + size )
|
||||
{
|
||||
reloadSymbols();
|
||||
//reloadSymbols();
|
||||
|
||||
std::string pattern = name + "!*";
|
||||
ULONG64 enumHandle = 0;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <exception>
|
||||
#include "dbgext.h"
|
||||
#include "dbgexcept.h"
|
||||
#include "dbgsystem.h"
|
||||
@ -13,23 +12,11 @@ is64bitSystem()
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
hres = dbgExt->control->IsPointer64Bit();
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::IsPointer64Bit failed" );
|
||||
|
||||
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;
|
||||
std::string pathStr;
|
||||
|
||||
try {
|
||||
|
||||
ULONG size;
|
||||
dbgExt->symbols->GetSymbolPath( NULL, 0, &size );
|
||||
|
||||
|
||||
std::vector<char> path(size);
|
||||
hres = dbgExt->symbols->GetSymbolPath( &path[0], size, NULL );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugSymbols::GetSymbolPath failed" );
|
||||
|
||||
pathStr = &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;
|
||||
return std::string(&path[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +55,6 @@ getPdbFile( ULONG64 moduleBase )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
IMAGEHLP_MODULEW64 imageHelpInfo = { 0 };
|
||||
@ -98,22 +71,13 @@ getPdbFile( ULONG64 moduleBase )
|
||||
0,
|
||||
NULL );
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugAdvanced2::GetSymbolInformation failed" );
|
||||
|
||||
char fileName[ 256 ];
|
||||
WideCharToMultiByte( CP_ACP, 0, imageHelpInfo.LoadedPdbName, 256, fileName, 256, NULL, NULL );
|
||||
|
||||
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
|
||||
reloadModule( const char * moduleName )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
// ïîäàâèòü âûâîä ñîîáùåíèé îá îòñóòñòâèè ñèìâîëîâ
|
||||
OutputReader outputReader( dbgExt->client );
|
||||
|
||||
hres = 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" );
|
||||
}
|
||||
dbgExt->symbols->Reload( moduleName );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -149,10 +97,6 @@ bool
|
||||
isKernelDebugging()
|
||||
{
|
||||
HRESULT hres;
|
||||
bool result = false;
|
||||
|
||||
try {
|
||||
|
||||
ULONG debugClass, debugQualifier;
|
||||
|
||||
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
||||
@ -160,19 +104,7 @@ isKernelDebugging()
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
||||
|
||||
result = 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;
|
||||
return debugClass == DEBUG_CLASS_KERNEL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -181,10 +113,6 @@ bool
|
||||
isDumpAnalyzing()
|
||||
{
|
||||
HRESULT hres;
|
||||
bool result = false;
|
||||
|
||||
try {
|
||||
|
||||
ULONG debugClass, debugQualifier;
|
||||
|
||||
hres = dbgExt->control->GetDebuggeeType( &debugClass, &debugQualifier );
|
||||
@ -192,19 +120,7 @@ isDumpAnalyzing()
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetDebuggeeType failed" );
|
||||
|
||||
result = 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;
|
||||
return debugQualifier >= DEBUG_DUMP_SMALL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user