#include "platform.h"
#include "typeprinter.h"
#include "frames.h"
+#include "logger.h"
// From dbgshim.h
struct dbgshim_t
int ManagedDebugger::GetLastStoppedThreadId()
{
+ LogFuncEntry();
+
std::lock_guard<std::mutex> lock(m_lastStoppedThreadIdMutex);
return m_lastStoppedThreadId;
}
void HandleEvent(ICorDebugController *controller, const std::string &eventName)
{
+ LogFuncEntry();
+
std::string text = "Event received: '" + eventName + "'\n";
m_debugger.m_protocol->EmitOutputEvent(OutputEvent(OutputConsole, text));
controller->Continue(0);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppInterface)
{
+ LogFuncEntry();
+
if(riid == __uuidof(ICorDebugManagedCallback))
{
*ppInterface = static_cast<ICorDebugManagedCallback*>(this);
virtual ULONG STDMETHODCALLTYPE AddRef()
{
+ LogFuncEntry();
+
return InterlockedIncrement((volatile LONG *) &m_refCount);
}
virtual ULONG STDMETHODCALLTYPE Release()
{
+ LogFuncEntry();
+
ULONG count = InterlockedDecrement((volatile LONG *) &m_refCount);
if(count == 0)
{
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugBreakpoint *pBreakpoint)
{
+ LogFuncEntry();
+
if (m_debugger.m_evaluator.IsEvalRunning())
{
pAppDomain->Continue(0);
/* [in] */ ICorDebugStepper *pStepper,
/* [in] */ CorDebugStepReason reason)
{
+ LogFuncEntry();
+
DWORD threadId = 0;
pThread->GetID(&threadId);
virtual HRESULT STDMETHODCALLTYPE Break(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *thread)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE Exception(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *pThread,
/* [in] */ BOOL unhandled)
{
+ LogFuncEntry();
+
std::string excType;
std::string excModule;
GetExceptionInfo(pThread, excType, excModule);
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugEval *pEval)
{
+ LogFuncEntry();
+
m_debugger.m_evaluator.NotifyEvalComplete(pThread, pEval);
return S_OK;
}
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugEval *pEval)
{
+ LogFuncEntry();
+
m_debugger.m_evaluator.NotifyEvalComplete(pThread, pEval);
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE CreateProcess(
/* [in] */ ICorDebugProcess *pProcess)
{
+ LogFuncEntry();
m_debugger.NotifyProcessCreated();
pProcess->Continue(0);
return S_OK;
virtual HRESULT STDMETHODCALLTYPE ExitProcess(
/* [in] */ ICorDebugProcess *pProcess)
{
+ LogFuncEntry();
+
m_debugger.m_evaluator.NotifyEvalComplete(nullptr, nullptr);
m_debugger.m_protocol->EmitExitedEvent(ExitedEvent(0));
m_debugger.NotifyProcessExited();
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *thread)
{
+ LogFuncEntry();
+
DWORD threadId = 0;
thread->GetID(&threadId);
m_debugger.m_protocol->EmitThreadEvent(ThreadEvent(ThreadStarted, threadId));
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *thread)
{
+ LogFuncEntry();
+
m_debugger.m_evaluator.NotifyEvalComplete(thread, nullptr);
DWORD threadId = 0;
thread->GetID(&threadId);
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugModule *pModule)
{
+ LogFuncEntry();
+
Module module;
m_debugger.m_modules.TryLoadModuleSymbols(pModule, module);
virtual HRESULT STDMETHODCALLTYPE UnloadModule(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugModule *pModule)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE LoadClass(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugClass *c)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE UnloadClass(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugClass *c)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE DebuggerError(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ HRESULT errorHR,
/* [in] */ DWORD errorCode)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE LogMessage(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ LONG lLevel,
/* [in] */ WCHAR *pLogSwitchName,
/* [in] */ WCHAR *pMessage)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE LogSwitch(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ULONG ulReason,
/* [in] */ WCHAR *pLogSwitchName,
/* [in] */ WCHAR *pParentName)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE CreateAppDomain(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ ICorDebugAppDomain *pAppDomain)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE ExitAppDomain(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ ICorDebugAppDomain *pAppDomain)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE LoadAssembly(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugAssembly *pAssembly)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE UnloadAssembly(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugAssembly *pAssembly)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE ControlCTrap(
/* [in] */ ICorDebugProcess *pProcess)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE NameChange(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *pThread)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE UpdateModuleSymbols(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugModule *pModule,
/* [in] */ IStream *pSymbolStream)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE EditAndContinueRemap(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugFunction *pFunction,
/* [in] */ BOOL fAccurate)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE BreakpointSetError(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugBreakpoint *pBreakpoint,
/* [in] */ DWORD dwError)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
// ICorDebugManagedCallback2
/* [in] */ ICorDebugFunction *pOldFunction,
/* [in] */ ICorDebugFunction *pNewFunction,
/* [in] */ ULONG32 oldILOffset)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE CreateConnection(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ CONNID dwConnectionId,
/* [in] */ WCHAR *pConnName)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE ChangeConnection(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ CONNID dwConnectionId)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE DestroyConnection(
/* [in] */ ICorDebugProcess *pProcess,
/* [in] */ CONNID dwConnectionId)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE Exception(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ CorDebugExceptionCallbackType dwEventType,
/* [in] */ DWORD dwFlags)
{
+ LogFuncEntry();
// TODO:
// const char *cbTypeName;
// switch(dwEventType)
/* [in] */ ICorDebugThread *pThread,
/* [in] */ CorDebugExceptionUnwindCallbackType dwEventType,
/* [in] */ DWORD dwFlags)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE FunctionRemapComplete(
/* [in] */ ICorDebugAppDomain *pAppDomain,
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugFunction *pFunction)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE MDANotification(
/* [in] */ ICorDebugController *pController,
/* [in] */ ICorDebugThread *pThread,
/* [in] */ ICorDebugMDA *pMDA)
- { return E_NOTIMPL; }
+ {
+ LogFuncEntry();
+ return E_NOTIMPL;
+ }
};
ManagedDebugger::ManagedDebugger() :
HRESULT ManagedDebugger::Initialize()
{
+ LogFuncEntry();
+
// TODO: Report capabilities and check client support
m_startMethod = StartNone;
m_protocol->EmitInitializedEvent();
HRESULT ManagedDebugger::Attach(int pid)
{
+ LogFuncEntry();
+
m_startMethod = StartAttach;
m_processId = pid;
return S_OK;
HRESULT ManagedDebugger::Launch(std::string fileExec, std::vector<std::string> execArgs, bool stopAtEntry)
{
+ LogFuncEntry();
+
m_startMethod = StartLaunch;
m_execPath = fileExec;
m_execArgs = execArgs;
HRESULT ManagedDebugger::ConfigurationDone()
{
+ LogFuncEntry();
+
switch(m_startMethod)
{
case StartLaunch:
HRESULT ManagedDebugger::Disconnect(DisconnectAction action)
{
+ LogFuncEntry();
+
bool terminate;
switch(action)
{
HRESULT ManagedDebugger::StepCommand(int threadId, StepType stepType)
{
+ LogFuncEntry();
+
HRESULT Status;
ToRelease<ICorDebugThread> pThread;
IfFailRet(m_pProcess->GetThread(threadId, &pThread));
HRESULT ManagedDebugger::Continue()
{
+ LogFuncEntry();
+
if (!m_pProcess)
return E_FAIL;
HRESULT ManagedDebugger::Pause()
{
+ LogFuncEntry();
+
if (!m_pProcess)
return E_FAIL;
HRESULT Status = m_pProcess->Stop(0);
HRESULT ManagedDebugger::GetThreads(std::vector<Thread> &threads)
{
+ LogFuncEntry();
+
if (!m_pProcess)
return E_FAIL;
return GetThreadsState(m_pProcess, threads);
HRESULT ManagedDebugger::Startup(IUnknown *punk, DWORD pid)
{
+ LogFuncEntry();
+
HRESULT Status;
ToRelease<ICorDebug> pCorDebug;