Commits (2)
......@@ -187,9 +187,13 @@ DebugCallbackResult ClrDebugManagerImpl::onProcessStart(PROCESS_DEBUG_ID process
{
boost::recursive_mutex::scoped_lock lock(m_processLock);
PROCESS_ID pid = TargetProcess::getById(processid)->getSystemId();
auto process = TargetProcess::getById(processid);
m_processMap[pid] = 0;
if (!process->isKernelDebugging())
{
PROCESS_ID pid = TargetProcess::getById(processid)->getSystemId();
m_processMap[pid] = 0;
}
return DebugCallbackNoChange;
}
......@@ -198,9 +202,13 @@ DebugCallbackResult ClrDebugManagerImpl::onProcessStart(PROCESS_DEBUG_ID process
DebugCallbackResult ClrDebugManagerImpl::onProcessExit( PROCESS_DEBUG_ID processid, ProcessExitReason reason, unsigned long exitCode )
{
PROCESS_ID pid = TargetProcess::getById(processid)->getSystemId();
auto process = TargetProcess::getById(processid);
m_processMap.erase(pid);
if (!process->isKernelDebugging())
{
PROCESS_ID pid = TargetProcess::getById(processid)->getSystemId();
m_processMap.erase(pid);
}
return DebugCallbackNoChange;
}
......
......@@ -403,7 +403,7 @@ PROCESS_DEBUG_ID loadDump( const std::wstring &fileName )
if ( FAILED( hres ) )
throw DbgEngException( L"IDebugSystemObjects::GetCurrentProcessId", hres );
// ProcessMonitor::processStart(processId);
ProcessMonitor::processStart(processId);
return processId;
}
......@@ -422,12 +422,12 @@ void closeDump( PROCESS_DEBUG_ID processId )
throw DbgEngException( L"IDebugSystemObjects::SetCurrentProcessId", hres );
}
ProcessMonitor::processStop(processId, ProcessDetach, 0);
hres = g_dbgMgr->client->TerminateCurrentProcess();
if ( FAILED( hres ) )
throw DbgEngException( L"IDebugClient::TerminateCurrentProcess", hres );
// ProcessMonitor::processStop(processId, ProcessDetach, 0);
if ( ProcessMonitor::getNumberProcesses() == 0 )
g_dbgMgr->ChangeEngineState( DEBUG_CES_EXECUTION_STATUS, DEBUG_STATUS_NO_DEBUGGEE);
......
......@@ -459,10 +459,10 @@ HRESULT STDMETHODCALLTYPE DebugManager::EndInput(
HRESULT STDMETHODCALLTYPE OutputReader::Output(
__in ULONG Mask,
__in PCSTR Text )
__in PCWSTR Text )
{
if ( ( Mask & m_mask ) != 0 )
m_readLine += _bstr_t(Text);
m_readLine += Text;
return S_OK;
}
......
......@@ -234,7 +234,7 @@ extern DebugManagerWrapper g_dbgMgr;
///////////////////////////////////////////////////////////////////////////////
class OutputReader : public IDebugOutputCallbacks, private boost::noncopyable {
class OutputReader : public IDebugOutputCallbacksWide, private boost::noncopyable {
public:
......@@ -246,11 +246,11 @@ public:
m_client = client;
m_mask = outputMask;
hres = m_client->GetOutputCallbacks(&m_callbacks);
hres = m_client->GetOutputCallbacksWide(&m_callbacks);
if ( FAILED( hres ) )
throw DbgEngException( L"IDebugClient::GetOutputCallbacks", hres);
hres = m_client->SetOutputCallbacks(this);
hres = m_client->SetOutputCallbacksWide(this);
if ( FAILED( hres ) )
throw DbgEngException( L"IDebugClient::SetOutputCallbacks", hres);
......@@ -259,7 +259,7 @@ public:
~OutputReader()
{
m_client->SetOutputCallbacks(m_callbacks);
m_client->SetOutputCallbacksWide(m_callbacks);
}
const std::wstring&
......@@ -291,7 +291,7 @@ private:
STDMETHOD(Output)(
__in ULONG Mask,
__in PCSTR Text );
__in PCWSTR Text );
private:
......@@ -299,7 +299,7 @@ private:
CComPtr<IDebugClient5> m_client;
PDEBUG_OUTPUT_CALLBACKS m_callbacks;
PDEBUG_OUTPUT_CALLBACKS_WIDE m_callbacks;
ULONG m_mask;
};
......
#include <stdafx.h>
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/dbgengine.h"
......@@ -22,3 +21,8 @@ TEST_F(DbgEngineTest, DbgCommandSuppress)
EXPECT_EQ(L"", kdlib::debugCommand(L".printf /os \"symbols\"", true, OutputFlag::Normal | OutputFlag::Warning));
}
TEST_F(DbgEngineTest, DbgCommandUnicode)
{
EXPECT_EQ(L"💩", kdlib::debugCommand(kdlib::debugCommand(L".printf \"💩\""), true));
}