mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
add dml for error output
This commit is contained in:
parent
72e7584947
commit
e90aa76811
@ -182,28 +182,10 @@ info(
|
|||||||
sstr << std::endl;
|
sstr << std::endl;
|
||||||
|
|
||||||
printString(client, DEBUG_OUTPUT_NORMAL, sstr.str().c_str() );
|
printString(client, DEBUG_OUTPUT_NORMAL, sstr.str().c_str() );
|
||||||
|
|
||||||
//CComQIPtr<IDebugControl> control = client;
|
|
||||||
|
|
||||||
//control->ControlledOutput(
|
|
||||||
// DEBUG_OUTCTL_AMBIENT_TEXT,
|
|
||||||
// DEBUG_OUTPUT_NORMAL,
|
|
||||||
// "%s",
|
|
||||||
// sstr.str().c_str()
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
||||||
|
|
||||||
//CComQIPtr<IDebugControl> control = client;
|
|
||||||
|
|
||||||
//control->ControlledOutput(
|
|
||||||
// DEBUG_OUTCTL_AMBIENT_TEXT,
|
|
||||||
// DEBUG_OUTPUT_ERROR,
|
|
||||||
// "%s",
|
|
||||||
// e.what()
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -484,15 +466,6 @@ py(
|
|||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
||||||
|
|
||||||
//CComQIPtr<IDebugControl> control = client;
|
|
||||||
|
|
||||||
//control->ControlledOutput(
|
|
||||||
// DEBUG_OUTCTL_AMBIENT_TEXT,
|
|
||||||
// DEBUG_OUTPUT_ERROR,
|
|
||||||
// "%s",
|
|
||||||
// e.what()
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client->SetOutputMask(oldMask);
|
client->SetOutputMask(oldMask);
|
||||||
@ -557,15 +530,6 @@ pip(
|
|||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
printString(client, DEBUG_OUTPUT_ERROR, e.what() );
|
||||||
|
|
||||||
//CComQIPtr<IDebugControl> control = client;
|
|
||||||
|
|
||||||
//control->ControlledOutput(
|
|
||||||
// DEBUG_OUTCTL_AMBIENT_TEXT,
|
|
||||||
// DEBUG_OUTPUT_ERROR,
|
|
||||||
// "%s",
|
|
||||||
// e.what()
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--recursiveGuard;
|
--recursiveGuard;
|
||||||
@ -802,14 +766,28 @@ void getDefaultPythonVersion(int& majorVersion, int& minorVersion)
|
|||||||
|
|
||||||
void printString(PDEBUG_CLIENT client, ULONG mask, const char* str)
|
void printString(PDEBUG_CLIENT client, ULONG mask, const char* str)
|
||||||
{
|
{
|
||||||
|
CComQIPtr<IDebugControl> control = client;
|
||||||
|
|
||||||
|
ULONG engOpts;
|
||||||
|
bool prefer_dml = SUCCEEDED(control->GetEngineOptions(&engOpts)) && ( (engOpts & DEBUG_ENGOPT_PREFER_DML ) != 0 );
|
||||||
|
|
||||||
std::stringstream sstr(str);
|
std::stringstream sstr(str);
|
||||||
while( sstr.good() )
|
while( sstr.good() )
|
||||||
{
|
{
|
||||||
std::string line;
|
std::string line;
|
||||||
std::getline(sstr, line);
|
std::getline(sstr, line);
|
||||||
|
|
||||||
CComQIPtr<IDebugControl> control = client;
|
if ( prefer_dml && mask == DEBUG_OUTPUT_ERROR )
|
||||||
|
{
|
||||||
|
control->ControlledOutput(
|
||||||
|
DEBUG_OUTCTL_AMBIENT_DML,
|
||||||
|
mask,
|
||||||
|
"<col fg=\"errfg\" bg=\"errbg\">%s</col>\n",
|
||||||
|
line.c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
control->ControlledOutput(
|
control->ControlledOutput(
|
||||||
DEBUG_OUTCTL_AMBIENT_TEXT,
|
DEBUG_OUTCTL_AMBIENT_TEXT,
|
||||||
mask,
|
mask,
|
||||||
@ -817,6 +795,7 @@ void printString(PDEBUG_CLIENT client, ULONG mask, const char* str)
|
|||||||
line.c_str()
|
line.c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user