From: Igor Kulaychuk Date: Mon, 8 Oct 2018 15:47:24 +0000 (+0300) Subject: Speed up named variables evaluation X-Git-Tag: submit/tizen/20181014.073209~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e06acde57f4f4132d577011f8889c494b8ba6050;p=sdk%2Ftools%2Fnetcoredbg.git Speed up named variables evaluation --- 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;