From 0c9c6f3fdac2fee09d744473e03b10b75892177f Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Mon, 24 Jul 2017 21:00:50 +0300 Subject: [PATCH] Do not hit breakpoints during func-eval --- src/debug/netcoredbg/main.cpp | 7 +++++++ src/debug/netcoredbg/valuewalk.cpp | 9 +++++++++ src/debug/netcoredbg/valuewalk.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/debug/netcoredbg/main.cpp b/src/debug/netcoredbg/main.cpp index 5bd1062..8fbe732 100644 --- a/src/debug/netcoredbg/main.cpp +++ b/src/debug/netcoredbg/main.cpp @@ -15,6 +15,7 @@ #include "typeprinter.h" #include "debugger.h" #include "modules.h" +#include "valuewalk.h" #define __in #define __out @@ -365,6 +366,12 @@ public: /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugBreakpoint *pBreakpoint) { + if (IsEvalRunning()) + { + pAppDomain->Continue(0); + return S_OK; + } + ULONG32 id = 0; ULONG32 times = 0; HitBreakpoint(pThread, id, times); diff --git a/src/debug/netcoredbg/valuewalk.cpp b/src/debug/netcoredbg/valuewalk.cpp index 73dee18..dc51d43 100644 --- a/src/debug/netcoredbg/valuewalk.cpp +++ b/src/debug/netcoredbg/valuewalk.cpp @@ -28,15 +28,23 @@ typedef std::function lock(g_evalMutex); g_evalComplete = true; + g_evalStarted = false; g_evalMutex.unlock(); g_evalCV.notify_one(); } +bool IsEvalRunning() +{ + std::lock_guard lock(g_evalMutex); + return g_evalStarted; +} + static HRESULT WaitEvalResult(ICorDebugProcess *pProcess, ICorDebugEval *pEval, ICorDebugValue **ppEvalResult) @@ -44,6 +52,7 @@ static HRESULT WaitEvalResult(ICorDebugProcess *pProcess, HRESULT Status; std::unique_lock lock(g_evalMutex); g_evalComplete = false; + g_evalStarted = true; IfFailRet(pProcess->Continue(0)); g_evalCV.wait(lock, []{return g_evalComplete;}); diff --git a/src/debug/netcoredbg/valuewalk.h b/src/debug/netcoredbg/valuewalk.h index d73dd91..a1eee9a 100644 --- a/src/debug/netcoredbg/valuewalk.h +++ b/src/debug/netcoredbg/valuewalk.h @@ -13,3 +13,5 @@ HRESULT EvalObjectNoConstructor( ICorDebugThread *pThread, ICorDebugType *pType, ICorDebugValue **ppEvalResult); + +bool IsEvalRunning(); -- 2.7.4