From e06acde57f4f4132d577011f8889c494b8ba6050 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Mon, 8 Oct 2018 18:47:24 +0300 Subject: [PATCH] Speed up named variables evaluation --- src/debug/netcoredbg/variables.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/debug/netcoredbg/variables.cpp b/src/debug/netcoredbg/variables.cpp index 66a5363..68a3d1d 100644 --- a/src/debug/netcoredbg/variables.cpp +++ b/src/debug/netcoredbg/variables.cpp @@ -2,6 +2,7 @@ // Distributed under the MIT License. // See the LICENSE file in the project root for more information. +#include #include "manageddebugger.h" #include @@ -425,9 +426,21 @@ HRESULT Variables::Evaluate( IfFailRet(pFrame->QueryInterface(IID_ICorDebugILFrame, (LPVOID*) &pILFrame)); ToRelease pResultValue; + + static std::regex re("[[:alpha:]\\$_][[:alnum:]_]*"); + + if (std::regex_match(expression, re)) + { + // Use simple name parser + IfFailRet(m_evaluator.EvalExpr(pThread, pFrame, expression, &pResultValue)); + } + int typeId; std::vector< ToRelease > marshalledValues; + // Use Roslyn for expression evaluation + if (!pResultValue) + { IfFailRet(SymbolReader::EvalExpression( expression, output, &typeId, &pResultValue, [&](void *corValue, const std::string &name, int *typeId, void **data) -> bool @@ -505,6 +518,7 @@ HRESULT Variables::Evaluate( return true; })); + } variable.evaluateName = expression; -- 2.34.1