Fix eval timeout return code.
authorMikhail Kurinnoi <m.kurinnoi@samsung.com>
Fri, 17 Dec 2021 11:05:56 +0000 (03:05 -0800)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Tue, 1 Feb 2022 14:35:47 +0000 (17:35 +0300)
In case of evaluation timeout we abort evaluation by "abort" feature with meaning, that evaluation is failed. But in case of successful evaluation abort, runtime return CORDBG_S_FUNC_EVAL_ABORTED successful return code.

src/debugger/evalhelpers.cpp
src/debugger/evalwaiter.cpp
test-suite/MITestEvaluate/Program.cs
test-suite/VSCodeTestEvaluate/Program.cs

index efe2f3ef9ec7d20000fa99d5952c413df7216333..ee271f82b3d68714a99c804763e27bdd897542b1 100644 (file)
@@ -90,7 +90,7 @@ HRESULT EvalHelpers::EvalFunction(
             HRESULT Status;
             ToRelease<ICorDebugEval2> pEval2;
             IfFailRet(pEval->QueryInterface(IID_ICorDebugEval2, (LPVOID*) &pEval2));
-            IfFailRet(Status = pEval2->CallParameterizedFunction(
+            IfFailRet(pEval2->CallParameterizedFunction(
                 pFunc,
                 static_cast<uint32_t>(typeParams.size()),
                 (ICorDebugType **)typeParams.data(),
index 579a5df74c920361e29b25205c0643853df44ba5..3270d30f5c000aac7d4ef5e1377572ef2e88004f 100644 (file)
@@ -191,7 +191,8 @@ HRESULT EvalWaiter::WaitEvalResult(ICorDebugThread *pThread,
     };\r
     HRESULT ret = WaitResult();\r
 \r
-    // TODO Let user know we have timed out evaluation, provide "Evaluation timed out." message.\r
+    if (ret == CORDBG_S_FUNC_EVAL_ABORTED)\r
+        ret = COR_E_TIMEOUT;\r
 \r
     ChangeThreadsState(THREAD_RUN);\r
     return ret;\r
index 6fde62243d6dedba214e6bb2ac89628f3878f490..5320a3f207630957ee8476bfb1a7851486d24188 100644 (file)
@@ -679,6 +679,12 @@ namespace MITestEvaluate
             return 222;
         }
 
+        static int TestTimeOut()
+        {
+            System.Threading.Thread.Sleep(10000);
+            return 5;
+        }
+
         static void Main(string[] args)
         {
             Label.Checkpoint("init", "values_test", (Object context) => {
@@ -1404,6 +1410,8 @@ namespace MITestEvaluate
                 Context.GetAndCheckValue(@"__FILE__:__LINE__", "111", "int", "stGetInt()");
                 Context.GetAndCheckValue(@"__FILE__:__LINE__", "666", "int", "stGetInt(333)");
                 Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "getInt()", "Error:");
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "TestTimeOut()", "Error: 0x80131505");
+
                 Context.Continue(@"__FILE__:__LINE__");
             });
             
index 24bba8a220e1f04125df7987ad922fd5b68a6d1d..bae2db0b5bf0979944833371ffe0b69fca79dcd0 100644 (file)
@@ -796,6 +796,12 @@ namespace VSCodeTestEvaluate
             return 222;
         }
 
+        static int TestTimeOut()
+        {
+            System.Threading.Thread.Sleep(10000);
+            return 5;
+        }
+
         static void Main(string[] args)
         {
             Label.Checkpoint("init", "values_test", (Object context) => {
@@ -1527,6 +1533,7 @@ namespace VSCodeTestEvaluate
                 Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, "111", "int", "stGetInt()");
                 Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, "222", "int", "stGetInt(111)");
                 Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "getInt()", "error");
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "TestTimeOut()", "error: 0x80131505");
 
                 Context.Continue(@"__FILE__:__LINE__");
             });