sizeof() operator added to evaluator
authorOleg Lekarev <o.lekarev@samsung.com>
Wed, 13 Oct 2021 10:29:59 +0000 (13:29 +0300)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Thu, 18 Nov 2021 15:28:44 +0000 (18:28 +0300)
15 files changed:
src/debugger/evalstackmachine.cpp
src/debugger/evalstackmachine.h
src/managed/StackMachine.cs
test-suite/MITestSizeof/MITestSizeof.csproj [new file with mode: 0644]
test-suite/MITestSizeof/Program.cs [new file with mode: 0644]
test-suite/NetcoreDbgTest/ControlScript.cs
test-suite/VSCodeTestSizeof/Program.cs [new file with mode: 0644]
test-suite/VSCodeTestSizeof/VSCodeTestSizeof.csproj [new file with mode: 0644]
test-suite/XunitTests/LocalTest.cs
test-suite/XunitTests/XunitTests.csproj
test-suite/run_tests.ps1
test-suite/run_tests.sh
test-suite/sdb_run_tests.ps1
test-suite/sdb_run_tests.sh
test-suite/test-suite.sln

index 10123f90901741f3978722c7c2d8fe1a33e465fe..4efa27aa8201e0780cc4409f57027b38aeba5e62 100644 (file)
@@ -133,6 +133,9 @@ namespace
         IfFailRet(pThread->CreateEval(&iCorEval));
         IfFailRet(iCorEval->CreateValue(type, nullptr, ppValue));
 
+        if (!ptr)
+            return S_OK;
+
         ToRelease<ICorDebugGenericValue> iCorGenValue;
         IfFailRet((*ppValue)->QueryInterface(IID_ICorDebugGenericValue, (LPVOID *) &iCorGenValue));
         return iCorGenValue->SetValue(ptr);
@@ -307,6 +310,31 @@ namespace
         return Status;
     }
 
+    HRESULT GetFrontStackEntryType(ICorDebugType **ppResultType, std::list<EvalStackEntry> &evalStack, EvalData &ed, std::string &output)
+    {
+        HRESULT Status;
+        ToRelease<ICorDebugValue> iCorValue;
+        if ((FAILED(Status = ed.pEvaluator->ResolveIdentifiers(ed.pThread, ed.frameLevel, evalStack.front().iCorValue, evalStack.front().identifiers, &iCorValue, ppResultType, ed.evalFlags))
+            && !evalStack.front().identifiers.empty()) || iCorValue)
+        {
+            std::ostringstream ss;
+            for (size_t i = 0; i < evalStack.front().identifiers.size(); i++)
+            {
+                if (i != 0)
+                    ss << ".";
+                ss << evalStack.front().identifiers[i];
+            }
+            if(!iCorValue)
+                output = "error: The type or namespace name '" + ss.str() + "' couldn't be found";
+            else
+                output = "error: '" + ss.str() + "' is a variable but is used like a type";
+            if (SUCCEEDED(Status))
+                Status = E_FAIL;
+        }
+
+        return Status;
+    }
+
     HRESULT GetIndexesFromStack(std::vector<ULONG32> &indexes, int dimension, std::list<EvalStackEntry> &evalStack, EvalData &ed, std::string &output)
     {
         HRESULT Status;
@@ -1254,15 +1282,33 @@ namespace
 
     HRESULT PredefinedType(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
     {
+        static const CorElementType BasicTypesAlias[] {
+            ELEMENT_TYPE_BOOLEAN,   // Boolean
+            ELEMENT_TYPE_U1,        // Byte
+            ELEMENT_TYPE_CHAR,      // Char
+            ELEMENT_TYPE_VALUETYPE, // Decimal
+            ELEMENT_TYPE_R8,        // Double
+            ELEMENT_TYPE_R4,        // Float
+            ELEMENT_TYPE_I4,        // Int
+            ELEMENT_TYPE_I8,        // Long
+            ELEMENT_TYPE_MAX,       // Object
+            ELEMENT_TYPE_I1,        // SByte
+            ELEMENT_TYPE_I2,        // Short
+            ELEMENT_TYPE_MAX,       // String
+            ELEMENT_TYPE_U2,        // UShort
+            ELEMENT_TYPE_U4,        // UInt
+            ELEMENT_TYPE_U8         // ULong
+        };
+
         // TODO uint32_t Flags = ((FormatFI*)pArguments)->Flags;
-        // TODO int32_t Int = ((FormatFI*)pArguments)->Int;
-        return E_NOTIMPL;
-    }
+        int32_t Int = ((FormatFI*)pArguments)->Int;
 
-    HRESULT QualifiedName(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
-    {
-        // TODO uint32_t Flags = ((FormatF*)pArguments)->Flags;
-        return E_NOTIMPL;
+        evalStack.emplace_front();
+
+        if (BasicTypesAlias[Int] == ELEMENT_TYPE_VALUETYPE)
+            return CreateValueType(ed.pEvalWaiter, ed.pThread, ed.iCorDecimalClass, &evalStack.front().iCorValuePredefined, nullptr);
+        else
+            return CreatePrimitiveValue(ed.pThread, &evalStack.front().iCorValuePredefined, BasicTypesAlias[Int], nullptr);
     }
 
     HRESULT AliasQualifiedName(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
@@ -1323,6 +1369,11 @@ namespace
         return S_OK;
     }
 
+    HRESULT QualifiedName(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
+    {
+        return SimpleMemberAccessExpression(evalStack, pArguments, output, ed);
+    }
+
     HRESULT PointerMemberAccessExpression(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
     {
         // TODO uint32_t Flags = ((FormatF*)pArguments)->Flags;
@@ -1504,10 +1555,63 @@ namespace
 
     HRESULT SizeOfExpression(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
     {
-        // TODO uint32_t Flags = ((FormatF*)pArguments)->Flags;
-        return E_NOTIMPL;
+        assert(evalStack.size() > 0);
+        HRESULT Status;
+        uint32_t size = 0;
+        PVOID szPtr = &size;
+
+        if (evalStack.front().iCorValuePredefined)
+        {
+            //  predefined type
+            CorElementType elType;
+            IfFailRet(evalStack.front().iCorValuePredefined->GetType(&elType));
+            if(elType == ELEMENT_TYPE_CLASS)
+            {
+                ToRelease<ICorDebugValue> iCorValue;
+                IfFailRet(DereferenceAndUnboxValue(evalStack.front().iCorValuePredefined, &iCorValue, nullptr));
+                IfFailRet(iCorValue->GetSize(&size));
+            }
+            else
+            {
+                IfFailRet(evalStack.front().iCorValuePredefined->GetSize(&size));
+            }
+        }
+        else
+        {
+            ToRelease<ICorDebugType> iCorType;
+            ToRelease<ICorDebugValue> iCorValueRef, iCorValue;
+
+            IfFailRet(GetFrontStackEntryType(&iCorType, evalStack, ed, output));
+            if(iCorType)
+            {
+                CorElementType elType;
+                IfFailRet(iCorType->GetType(&elType));
+                if (elType == ELEMENT_TYPE_VALUETYPE)
+                {
+                    // user defined type (structure)
+                    ToRelease<ICorDebugClass> iCorClass;
+
+                    IfFailRet(iCorType->GetClass(&iCorClass));
+                    IfFailRet(CreateValueType(ed.pEvalWaiter, ed.pThread, iCorClass, &iCorValueRef, nullptr));
+                    IfFailRet(DereferenceAndUnboxValue(iCorValueRef, &iCorValue, nullptr));
+                    IfFailRet(iCorValue->GetSize(&size));
+                }
+                else
+                {
+                    return E_INVALIDARG;
+                }
+            }
+            else
+            {
+                // TODO other cases
+                return E_NOTIMPL;
+            }
+        }
+        evalStack.front().ResetEntry();
+        return CreatePrimitiveValue(ed.pThread, &evalStack.front().iCorValue, ELEMENT_TYPE_U4, szPtr);
     }
 
+
     HRESULT TypeOfExpression(std::list<EvalStackEntry> &evalStack, PVOID pArguments, std::string &output, EvalData &ed)
     {
         // TODO uint32_t Flags = ((FormatF*)pArguments)->Flags;
index d30e7215445a06f4ed002db68b80369f6b27ccbd..78a31f126e550a5d050379293c7dabd511d9c3f9 100644 (file)
@@ -29,6 +29,8 @@ struct EvalStackEntry
     std::vector<std::string> identifiers;\r
     // Resolved to value identifiers.\r
     ToRelease<ICorDebugValue> iCorValue;\r
+    // Predefined types values\r
+    ToRelease<ICorDebugValue> iCorValuePredefined;\r
     // Prevent future binding in case of conditional access with nulled object (`a?.b`, `a?[1]`, ...).\r
     // Note, this state could be related to iCorValue only (iCorValue must be checked for null first).\r
     bool preventBinding;\r
@@ -42,6 +44,7 @@ struct EvalStackEntry
     {\r
         identifiers.clear();\r
         iCorValue.Free();\r
+        iCorValuePredefined.Free();\r
         preventBinding = false;\r
         if (!skipLiteral)\r
             literal = false;\r
index 016f4299c22f1d592709caf2b0e68753b74cfd02..93a851b06bc79785ce5767a5a0894a9a8e4e0649 100644 (file)
@@ -658,11 +658,11 @@ namespace NetCoreDbg
                         case SyntaxKind.CharacterLiteralExpression: // 1 wchar
                             stackMachineProgram.Commands.Add(new TwoOperandCommand(node.Kind(), CurrentScopeFlags.Peek(), TypeAlias[node.GetFirstToken().Value.GetType()], node.GetFirstToken().Value));
                             break;
-/* TODO
+
                         case SyntaxKind.PredefinedType:
                             stackMachineProgram.Commands.Add(new OneOperandCommand(node.Kind(), CurrentScopeFlags.Peek(), TypeKindAlias[node.GetFirstToken().Kind()]));
                             break;
-*/
+
                         // skip, in case of stack machine program creation we don't use this kinds directly
                         case SyntaxKind.Argument:
                         case SyntaxKind.BracketedArgumentList:
@@ -705,9 +705,9 @@ namespace NetCoreDbg
                         case SyntaxKind.LessThanExpression:
                         case SyntaxKind.GreaterThanOrEqualExpression:
                         case SyntaxKind.LessThanOrEqualExpression:
+                        case SyntaxKind.QualifiedName:
 
 /* TODO
-                        case SyntaxKind.QualifiedName:
                         case SyntaxKind.AliasQualifiedName:
                         case SyntaxKind.ConditionalExpression:
                         case SyntaxKind.PointerMemberAccessExpression:
@@ -718,7 +718,9 @@ namespace NetCoreDbg
                         case SyntaxKind.PostIncrementExpression:
                         case SyntaxKind.PreDecrementExpression:
                         case SyntaxKind.PostDecrementExpression:
+*/
                         case SyntaxKind.SizeOfExpression:
+/*
                         case SyntaxKind.TypeOfExpression:
                         case SyntaxKind.CoalesceExpression:
 */
diff --git a/test-suite/MITestSizeof/MITestSizeof.csproj b/test-suite/MITestSizeof/MITestSizeof.csproj
new file mode 100644 (file)
index 0000000..2005951
--- /dev/null
@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+  <ItemGroup>
+    <ProjectReference Include="..\NetcoreDbgTest\NetcoreDbgTest.csproj" />
+  </ItemGroup>\r
+\r
+  <PropertyGroup>\r
+    <OutputType>Exe</OutputType>\r
+    <TargetFramework>netcoreapp3.1</TargetFramework>\r
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
+  </PropertyGroup>\r
+\r
+</Project>\r
diff --git a/test-suite/MITestSizeof/Program.cs b/test-suite/MITestSizeof/Program.cs
new file mode 100644 (file)
index 0000000..4f57521
--- /dev/null
@@ -0,0 +1,279 @@
+using System;\r
+using System.IO;\r
+\r
+using NetcoreDbgTest;\r
+using NetcoreDbgTest.MI;\r
+using NetcoreDbgTest.Script;\r
+\r
+namespace NetcoreDbgTest.Script\r
+{\r
+    class Context\r
+    {\r
+        public void Prepare(string caller_trace)\r
+        {\r
+            Assert.Equal(MIResultClass.Done,\r
+                         MIDebugger.Request("-file-exec-and-symbols " + ControlInfo.CorerunPath).Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            Assert.Equal(MIResultClass.Done,\r
+                         MIDebugger.Request("-exec-arguments " + ControlInfo.TargetAssemblyPath).Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            Assert.Equal(MIResultClass.Running,\r
+                         MIDebugger.Request("-exec-run").Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void EnableBreakpoint(string caller_trace, string bpName)\r
+        {\r
+            Breakpoint bp = ControlInfo.Breakpoints[bpName];\r
+\r
+            Assert.Equal(BreakpointType.Line, bp.Type, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            var lbp = (LineBreakpoint)bp;\r
+\r
+            Assert.Equal(MIResultClass.Done,\r
+                         MIDebugger.Request("-break-insert -f " + lbp.FileName + ":" + lbp.NumLine).Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void CalcAndCheckExpression(string caller_trace, string ExpectedResult, string expr)\r
+        {\r
+            var res = MIDebugger.Request("-var-create - * \"" + expr + "\"");\r
+\r
+            Assert.Equal(MIResultClass.Done, res.Class, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            Assert.Equal(ExpectedResult, ((MIConst)res["value"]).CString, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void CheckErrorAtRequest(string caller_trace, string Expression, string errMsgStart)\r
+        {\r
+            var res = MIDebugger.Request(String.Format("-var-create - * \"{0}\"", Expression));\r
+            Assert.Equal(MIResultClass.Error, res.Class, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            Assert.True(((MIConst)res["msg"]).CString.StartsWith(errMsgStart), @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void GetResultAsString(string caller_trace, string expr, out string strRes)\r
+        {\r
+            var res = MIDebugger.Request("-var-create - * \"" + expr + "\"");\r
+            Assert.Equal(MIResultClass.Done, res.Class, @"__FILE__:__LINE__"+"\n" + caller_trace);\r
+            strRes = ((MIConst)res["value"]).CString;\r
+        }\r
+\r
+        public void WasEntryPointHit(string caller_trace)\r
+        {\r
+            Func<MIOutOfBandRecord, bool> filter = (record) => {\r
+                if (!IsStoppedEvent(record)) {\r
+                    return false;\r
+                }\r
+\r
+                var output = ((MIAsyncRecord)record).Output;\r
+                var reason = (MIConst)output["reason"];\r
+\r
+                if (reason.CString != "entry-point-hit") {\r
+                    return false;\r
+                }\r
+\r
+                var frame = (MITuple)output["frame"];\r
+                var func = (MIConst)frame["func"];\r
+                if (func.CString == ControlInfo.TestName + ".Program.Main()") {\r
+                    return true;\r
+                }\r
+\r
+                return false;\r
+            };\r
+\r
+            Assert.True(MIDebugger.IsEventReceived(filter), @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void WasBreakpointHit(string caller_trace, string bpName)\r
+        {\r
+            var bp = (LineBreakpoint)ControlInfo.Breakpoints[bpName];\r
+\r
+            Func<MIOutOfBandRecord, bool> filter = (record) => {\r
+                if (!IsStoppedEvent(record)) {\r
+                    return false;\r
+                }\r
+\r
+                var output = ((MIAsyncRecord)record).Output;\r
+                var reason = (MIConst)output["reason"];\r
+\r
+                if (reason.CString != "breakpoint-hit") {\r
+                    return false;\r
+                }\r
+\r
+                var frame = (MITuple)output["frame"];\r
+                var fileName = (MIConst)frame["file"];\r
+                var line = ((MIConst)frame["line"]).Int;\r
+\r
+                if (fileName.CString == bp.FileName &&\r
+                    line == bp.NumLine) {\r
+                    return true;\r
+                }\r
+\r
+                return false;\r
+            };\r
+\r
+            Assert.True(MIDebugger.IsEventReceived(filter),\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void WasExit(string caller_trace)\r
+        {\r
+            Func<MIOutOfBandRecord, bool> filter = (record) => {\r
+                if (!IsStoppedEvent(record)) {\r
+                    return false;\r
+                }\r
+\r
+                var output = ((MIAsyncRecord)record).Output;\r
+                var reason = (MIConst)output["reason"];\r
+\r
+                if (reason.CString != "exited") {\r
+                    return false;\r
+                }\r
+\r
+                var exitCode = (MIConst)output["exit-code"];\r
+\r
+                if (exitCode.CString == "0") {\r
+                    return true;\r
+                }\r
+\r
+                return false;\r
+            };\r
+\r
+            Assert.True(MIDebugger.IsEventReceived(filter), @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void DebuggerExit(string caller_trace)\r
+        {\r
+            Assert.Equal(MIResultClass.Exit,\r
+                         MIDebugger.Request("-gdb-exit").Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        bool IsStoppedEvent(MIOutOfBandRecord record)\r
+        {\r
+            if (record.Type != MIOutOfBandRecordType.Async) {\r
+                return false;\r
+            }\r
+\r
+            var asyncRecord = (MIAsyncRecord)record;\r
+\r
+            if (asyncRecord.Class != MIAsyncRecordClass.Exec ||\r
+                asyncRecord.Output.Class != MIAsyncOutputClass.Stopped) {\r
+                return false;\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+        public void Continue(string caller_trace)\r
+        {\r
+            Assert.Equal(MIResultClass.Running,\r
+                         MIDebugger.Request("-exec-continue").Class,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public Context(ControlInfo controlInfo, NetcoreDbgTestCore.DebuggerClient debuggerClient)\r
+        {\r
+            ControlInfo = controlInfo;\r
+            MIDebugger = new MIDebugger(debuggerClient);\r
+        }\r
+\r
+        ControlInfo ControlInfo;\r
+        MIDebugger MIDebugger;\r
+    }\r
+}\r
+\r
+namespace MITestSizeof\r
+{\r
+    public struct Point\r
+    {\r
+        public Point(byte tag, decimal x, decimal y) => (Tag, X, Y) = (tag, x, y);\r
+\r
+        public decimal X { get; }\r
+        public decimal Y { get; }\r
+        public byte Tag { get; }\r
+    }\r
+\r
+\r
+    class Program\r
+    {\r
+        static void Main(string[] args)\r
+        {\r
+            Label.Checkpoint("init", "expression_test1", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.Prepare(@"__FILE__:__LINE__");\r
+                Context.WasEntryPointHit(@"__FILE__:__LINE__");\r
+                Context.EnableBreakpoint(@"__FILE__:__LINE__", "BREAK1");\r
+                Context.Continue(@"__FILE__:__LINE__");\r
+            });\r
+\r
+            int a = 10;\r
+            TestStruct tc = new TestStruct(a, 11);\r
+            string str1 = "string1";\r
+            uint c;\r
+            unsafe { c = (uint)sizeof(Point); }\r
+            uint d = c;                                        Label.Breakpoint("BREAK1");\r
+\r
+            Label.Checkpoint("expression_test1", "finish", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.WasBreakpointHit(@"__FILE__:__LINE__", "BREAK1");\r
+\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(bool).ToString(), "sizeof(bool)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(byte).ToString(), "sizeof(byte)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(sbyte).ToString(), "sizeof(sbyte)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(char).ToString(), "sizeof(char)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(int).ToString(), "sizeof(int)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(uint).ToString(), "sizeof(uint)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(long).ToString(), "sizeof(long)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(ulong).ToString(), "sizeof(ulong)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(float).ToString(), "sizeof(float)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(double).ToString(), "sizeof(double)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(decimal).ToString(), "sizeof(decimal)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Boolean).ToString(), "sizeof(System.Boolean)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Byte).ToString(), "sizeof(System.Byte)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Char).ToString(), "sizeof(System.Char)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Decimal).ToString(), "sizeof(System.Decimal)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Double).ToString(), "sizeof(System.Double)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Int16).ToString(), "sizeof(System.Int16)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Int32).ToString(), "sizeof(System.Int32)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Int64).ToString(), "sizeof(System.Int64)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.SByte).ToString(), "sizeof(System.SByte)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.Single).ToString(), "sizeof(System.Single)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.UInt16).ToString(), "sizeof(System.UInt16)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.UInt32).ToString(), "sizeof(System.UInt32)");\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", sizeof(System.UInt64).ToString(), "sizeof(System.UInt64)");\r
+                string ss1;\r
+                Context.GetResultAsString(@"__FILE__:__LINE__", "sizeof(Point)", out ss1);\r
+                Context.CalcAndCheckExpression(@"__FILE__:__LINE__", ss1, "c");\r
+\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(a)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(tc)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(str1)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(abcd)", "error: The type or namespace name");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(Program)", "Error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", "sizeof(tc.a)", "");\r
+\r
+                Context.Continue(@"__FILE__:__LINE__");\r
+            });\r
+\r
+            Label.Checkpoint("finish", "", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.WasExit(@"__FILE__:__LINE__");\r
+                Context.DebuggerExit(@"__FILE__:__LINE__");\r
+            });\r
+        }\r
+\r
+        struct TestStruct\r
+        {\r
+            public int a;\r
+            public int b;\r
+\r
+            public TestStruct(int x, int y)\r
+            {\r
+                a = x;\r
+                b = y;\r
+            }\r
+        }\r
+    }\r
+}\r
index 3a33d691cb8700d228cfb6ad122bd7b9fe0915b0..9a1d4777173ce9cded166f943755ea39c927c7c8 100644 (file)
@@ -198,6 +198,7 @@ namespace NetcoreDbgTestCore
 
         Compilation CompileTree(SyntaxTree tree)
         {
+            //var CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)
             var compilation = CSharpCompilation.Create(
                 "ControlScript",
                 new SyntaxTree[] {tree},
diff --git a/test-suite/VSCodeTestSizeof/Program.cs b/test-suite/VSCodeTestSizeof/Program.cs
new file mode 100644 (file)
index 0000000..98b7497
--- /dev/null
@@ -0,0 +1,345 @@
+using System;\r
+using System.IO;\r
+using System.Collections.Generic;\r
+\r
+using NetcoreDbgTest;\r
+using NetcoreDbgTest.VSCode;\r
+using NetcoreDbgTest.Script;\r
+\r
+using Newtonsoft.Json;\r
+\r
+namespace NetcoreDbgTest.Script\r
+{\r
+    class Context\r
+    {\r
+        public void PrepareStart(string caller_trace)\r
+        {\r
+            InitializeRequest initializeRequest = new InitializeRequest();\r
+            initializeRequest.arguments.clientID = "vscode";\r
+            initializeRequest.arguments.clientName = "Visual Studio Code";\r
+            initializeRequest.arguments.adapterID = "coreclr";\r
+            initializeRequest.arguments.pathFormat = "path";\r
+            initializeRequest.arguments.linesStartAt1 = true;\r
+            initializeRequest.arguments.columnsStartAt1 = true;\r
+            initializeRequest.arguments.supportsVariableType = true;\r
+            initializeRequest.arguments.supportsVariablePaging = true;\r
+            initializeRequest.arguments.supportsRunInTerminalRequest = true;\r
+            initializeRequest.arguments.locale = "en-us";\r
+            Assert.True(VSCodeDebugger.Request(initializeRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            LaunchRequest launchRequest = new LaunchRequest();\r
+            launchRequest.arguments.name = ".NET Core Launch (console) with pipeline";\r
+            launchRequest.arguments.type = "coreclr";\r
+            launchRequest.arguments.preLaunchTask = "build";\r
+            launchRequest.arguments.program = ControlInfo.TargetAssemblyPath;\r
+            launchRequest.arguments.cwd = "";\r
+            launchRequest.arguments.console = "internalConsole";\r
+            launchRequest.arguments.stopAtEntry = true;\r
+            launchRequest.arguments.internalConsoleOptions = "openOnSessionStart";\r
+            launchRequest.arguments.__sessionId = Guid.NewGuid().ToString();\r
+            Assert.True(VSCodeDebugger.Request(launchRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void PrepareEnd(string caller_trace)\r
+        {\r
+            ConfigurationDoneRequest configurationDoneRequest = new ConfigurationDoneRequest();\r
+            Assert.True(VSCodeDebugger.Request(configurationDoneRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void WasEntryPointHit(string caller_trace)\r
+        {\r
+            Func<string, bool> filter = (resJSON) => {\r
+                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped")\r
+                    && VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "entry")) {\r
+                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));\r
+                    return true;\r
+                }\r
+                return false;\r
+            };\r
+\r
+            Assert.True(VSCodeDebugger.IsEventReceived(filter),\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void WasExit(string caller_trace)\r
+        {\r
+            bool wasExited = false;\r
+            int ?exitCode = null;\r
+            bool wasTerminated = false;\r
+\r
+            Func<string, bool> filter = (resJSON) => {\r
+                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "exited")) {\r
+                    wasExited = true;\r
+                    ExitedEvent exitedEvent = JsonConvert.DeserializeObject<ExitedEvent>(resJSON);\r
+                    exitCode = exitedEvent.body.exitCode;\r
+                }\r
+                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated")) {\r
+                    wasTerminated = true;\r
+                }\r
+                if (wasExited && exitCode == 0 && wasTerminated)\r
+                    return true;\r
+\r
+                return false;\r
+            };\r
+\r
+            Assert.True(VSCodeDebugger.IsEventReceived(filter),\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void DebuggerExit(string caller_trace)\r
+        {\r
+            DisconnectRequest disconnectRequest = new DisconnectRequest();\r
+            disconnectRequest.arguments = new DisconnectArguments();\r
+            disconnectRequest.arguments.restart = false;\r
+            Assert.True(VSCodeDebugger.Request(disconnectRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void AddBreakpoint(string caller_trace, string bpName, string Condition = null)\r
+        {\r
+            Breakpoint bp = ControlInfo.Breakpoints[bpName];\r
+            Assert.Equal(BreakpointType.Line, bp.Type,\r
+                         @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            var lbp = (LineBreakpoint)bp;\r
+\r
+            BreakpointSourceName = lbp.FileName;\r
+            BreakpointList.Add(new SourceBreakpoint(lbp.NumLine, Condition));\r
+            BreakpointLines.Add(lbp.NumLine);\r
+        }\r
+\r
+        public void SetBreakpoints(string caller_trace)\r
+        {\r
+            SetBreakpointsRequest setBreakpointsRequest = new SetBreakpointsRequest();\r
+            setBreakpointsRequest.arguments.source.name = BreakpointSourceName;\r
+            // NOTE this code works only with one source file\r
+            setBreakpointsRequest.arguments.source.path = ControlInfo.SourceFilesPath;\r
+            setBreakpointsRequest.arguments.lines.AddRange(BreakpointLines);\r
+            setBreakpointsRequest.arguments.breakpoints.AddRange(BreakpointList);\r
+            setBreakpointsRequest.arguments.sourceModified = false;\r
+            Assert.True(VSCodeDebugger.Request(setBreakpointsRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void WasBreakpointHit(string caller_trace, string bpName)\r
+        {\r
+            Func<string, bool> filter = (resJSON) => {\r
+                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped")\r
+                    && VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "breakpoint")) {\r
+                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));\r
+                    return true;\r
+                }\r
+                return false;\r
+            };\r
+\r
+            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            StackTraceRequest stackTraceRequest = new StackTraceRequest();\r
+            stackTraceRequest.arguments.threadId = threadId;\r
+            stackTraceRequest.arguments.startFrame = 0;\r
+            stackTraceRequest.arguments.levels = 20;\r
+            var ret = VSCodeDebugger.Request(stackTraceRequest);\r
+            Assert.True(ret.Success, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            Breakpoint breakpoint = ControlInfo.Breakpoints[bpName];\r
+            Assert.Equal(BreakpointType.Line, breakpoint.Type, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            var lbp = (LineBreakpoint)breakpoint;\r
+\r
+            StackTraceResponse stackTraceResponse =\r
+                JsonConvert.DeserializeObject<StackTraceResponse>(ret.ResponseStr);\r
+\r
+            if (stackTraceResponse.body.stackFrames[0].line == lbp.NumLine\r
+                && stackTraceResponse.body.stackFrames[0].source.name == lbp.FileName\r
+                // NOTE this code works only with one source file\r
+                && stackTraceResponse.body.stackFrames[0].source.path == ControlInfo.SourceFilesPath)\r
+                return;\r
+\r
+            throw new ResultNotSuccessException(@"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void Continue(string caller_trace)\r
+        {\r
+            ContinueRequest continueRequest = new ContinueRequest();\r
+            continueRequest.arguments.threadId = threadId;\r
+            Assert.True(VSCodeDebugger.Request(continueRequest).Success,\r
+                        @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public Context(ControlInfo controlInfo, NetcoreDbgTestCore.DebuggerClient debuggerClient)\r
+        {\r
+            ControlInfo = controlInfo;\r
+            VSCodeDebugger = new VSCodeDebugger(debuggerClient);\r
+        }\r
+\r
+        public Int64 DetectFrameId(string caller_trace, string bpName)\r
+        {\r
+            StackTraceRequest stackTraceRequest = new StackTraceRequest();\r
+            stackTraceRequest.arguments.threadId = threadId;\r
+            stackTraceRequest.arguments.startFrame = 0;\r
+            stackTraceRequest.arguments.levels = 20;\r
+            var ret = VSCodeDebugger.Request(stackTraceRequest);\r
+            Assert.True(ret.Success, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            Breakpoint breakpoint = ControlInfo.Breakpoints[bpName];\r
+            Assert.Equal(BreakpointType.Line, breakpoint.Type, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            var lbp = (LineBreakpoint)breakpoint;\r
+\r
+            StackTraceResponse stackTraceResponse =\r
+                JsonConvert.DeserializeObject<StackTraceResponse>(ret.ResponseStr);\r
+\r
+            if (stackTraceResponse.body.stackFrames[0].line == lbp.NumLine\r
+                && stackTraceResponse.body.stackFrames[0].source.name == lbp.FileName\r
+                // NOTE this code works only with one source file\r
+                && stackTraceResponse.body.stackFrames[0].source.path == ControlInfo.SourceFilesPath)\r
+                return stackTraceResponse.body.stackFrames[0].id;\r
+\r
+            throw new ResultNotSuccessException(@"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void GetAndCheckValue(string caller_trace, Int64 frameId, string ExpectedResult, string ExpectedType, string Expression)\r
+        {\r
+            EvaluateRequest evaluateRequest = new EvaluateRequest();\r
+            evaluateRequest.arguments.expression = Expression;\r
+            evaluateRequest.arguments.frameId = frameId;\r
+            var ret = VSCodeDebugger.Request(evaluateRequest);\r
+            Assert.True(ret.Success, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            EvaluateResponse evaluateResponse =\r
+                JsonConvert.DeserializeObject<EvaluateResponse>(ret.ResponseStr);\r
+\r
+            Assert.Equal(ExpectedResult, evaluateResponse.body.result, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            Assert.Equal(ExpectedType, evaluateResponse.body.type, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void CheckErrorAtRequest(string caller_trace, Int64 frameId, string Expression, string errMsgStart)\r
+        {\r
+            EvaluateRequest evaluateRequest = new EvaluateRequest();\r
+            evaluateRequest.arguments.expression = Expression;\r
+            evaluateRequest.arguments.frameId = frameId;\r
+            var ret = VSCodeDebugger.Request(evaluateRequest);\r
+            Assert.False(ret.Success, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+\r
+            EvaluateResponse evaluateResponse =\r
+                JsonConvert.DeserializeObject<EvaluateResponse>(ret.ResponseStr);\r
+\r
+            Assert.True(evaluateResponse.message.StartsWith(errMsgStart), @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+        }\r
+\r
+        public void GetResultAsString(string caller_trace, Int64 frameId, string expr, out string strRes)\r
+        {\r
+            EvaluateRequest evaluateRequest = new EvaluateRequest();\r
+            evaluateRequest.arguments.expression = expr;\r
+            evaluateRequest.arguments.frameId = frameId;\r
+            var ret = VSCodeDebugger.Request(evaluateRequest);\r
+            Assert.True(ret.Success, @"__FILE__:__LINE__"+"\n"+caller_trace);\r
+            EvaluateResponse evaluateResponse = JsonConvert.DeserializeObject<EvaluateResponse>(ret.ResponseStr);\r
+            strRes = evaluateResponse.body.result;\r
+        }\r
+\r
+        ControlInfo ControlInfo;\r
+        VSCodeDebugger VSCodeDebugger;\r
+        int threadId = -1;\r
+        string BreakpointSourceName;\r
+        List<SourceBreakpoint> BreakpointList = new List<SourceBreakpoint>();\r
+        List<int> BreakpointLines = new List<int>();\r
+    }\r
+}\r
+\r
+namespace VSCodeTestSizeof\r
+{\r
+    public struct Point\r
+    {\r
+        public Point(byte tag, decimal x, decimal y) => (Tag, X, Y) = (tag, x, y);\r
+\r
+        public decimal X { get; }\r
+        public decimal Y { get; }\r
+        public byte Tag { get; }\r
+    }\r
+\r
+    class Program\r
+    {\r
+        static void Main(string[] args)\r
+        {\r
+            // first checkpoint (initialization) must provide "init" as id\r
+            Label.Checkpoint("init", "bp_test", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.PrepareStart(@"__FILE__:__LINE__");\r
+                Context.AddBreakpoint(@"__FILE__:__LINE__", "BREAK1");\r
+                Context.SetBreakpoints(@"__FILE__:__LINE__");\r
+                Context.PrepareEnd(@"__FILE__:__LINE__");\r
+                Context.WasEntryPointHit(@"__FILE__:__LINE__");\r
+                Context.Continue(@"__FILE__:__LINE__");\r
+            });\r
+\r
+            int a = 10;\r
+            TestStruct tc = new TestStruct(a, 11);\r
+            string str1 = "string1";\r
+            uint c;\r
+            unsafe { c = (uint)sizeof(Point); }\r
+            uint d = c;                                                   Label.Breakpoint("BREAK1");\r
+\r
+            Label.Checkpoint("bp_test", "finish", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.WasBreakpointHit(@"__FILE__:__LINE__", "BREAK1");\r
+                Int64 frameId = Context.DetectFrameId(@"__FILE__:__LINE__", "BREAK1");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(bool).ToString(), "uint", "sizeof(bool)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(byte).ToString(), "uint", "sizeof(byte)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(sbyte).ToString(), "uint", "sizeof(sbyte)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(char).ToString(), "uint", "sizeof(char)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(int).ToString(), "uint", "sizeof(int)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(uint).ToString(), "uint", "sizeof(uint)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(long).ToString(), "uint", "sizeof(long)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(ulong).ToString(), "uint", "sizeof(ulong)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(float).ToString(), "uint", "sizeof(float)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(double).ToString(), "uint", "sizeof(double)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(decimal).ToString(), "uint", "sizeof(decimal)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Boolean).ToString(), "uint", "sizeof(System.Boolean)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Byte).ToString(), "uint", "sizeof(System.Byte)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Char).ToString(), "uint", "sizeof(System.Char)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Decimal).ToString(), "uint", "sizeof(System.Decimal)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Double).ToString(), "uint", "sizeof(System.Double)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Int16).ToString(), "uint", "sizeof(System.Int16)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Int32).ToString(), "uint", "sizeof(System.Int32)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Int64).ToString(), "uint", "sizeof(System.Int64)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.SByte).ToString(), "uint", "sizeof(System.SByte)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.Single).ToString(), "uint", "sizeof(System.Single)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.UInt16).ToString(), "uint", "sizeof(System.UInt16)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.UInt32).ToString(), "uint", "sizeof(System.UInt32)");\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, sizeof(System.UInt64).ToString(), "uint", "sizeof(System.UInt64)");\r
+                string ss1;\r
+                Context.GetResultAsString(@"__FILE__:__LINE__", frameId, "sizeof(Point)", out ss1);\r
+                Context.GetAndCheckValue(@"__FILE__:__LINE__", frameId, ss1, "uint", "c");\r
+\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(a)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(tc)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(str1)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(abcd)", "error: The type or namespace name");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(Program)", "error:");\r
+                Context.CheckErrorAtRequest(@"__FILE__:__LINE__", frameId, "sizeof(tc.a)", "");\r
+\r
+                Context.Continue(@"__FILE__:__LINE__");\r
+            });\r
+\r
+            // last checkpoint must provide "finish" as id or empty string ("") as next checkpoint id\r
+            Label.Checkpoint("finish", "", (Object context) => {\r
+                Context Context = (Context)context;\r
+                Context.WasExit(@"__FILE__:__LINE__");\r
+                Context.DebuggerExit(@"__FILE__:__LINE__");\r
+            });\r
+        }\r
+\r
+        struct TestStruct\r
+        {\r
+            public int a;\r
+            public int b;\r
+\r
+            public TestStruct(int x, int y)\r
+            {\r
+                a = x;\r
+                b = y;\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/test-suite/VSCodeTestSizeof/VSCodeTestSizeof.csproj b/test-suite/VSCodeTestSizeof/VSCodeTestSizeof.csproj
new file mode 100644 (file)
index 0000000..2005951
--- /dev/null
@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+  <ItemGroup>
+    <ProjectReference Include="..\NetcoreDbgTest\NetcoreDbgTest.csproj" />
+  </ItemGroup>\r
+\r
+  <PropertyGroup>\r
+    <OutputType>Exe</OutputType>\r
+    <TargetFramework>netcoreapp3.1</TargetFramework>\r
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\r
+  </PropertyGroup>\r
+\r
+</Project>\r
index e402e9af5d29333ca905306d9d3dc12bd835afd9..8b539c50be8acfdffe61d2295f01da4111f15561 100644 (file)
@@ -44,6 +44,7 @@ namespace XUnitTests
         [InlineData("MITestNoJMCBreakpoint", "Program.cs")]
         [InlineData("MITestNoJMCAsyncStepping", "Program.cs")]
         [InlineData("MITestNoJMCExceptionBreakpoint", "Program.cs")]
+        [InlineData("MITestSizeof", "Program.cs")]
         [InlineData("VSCodeExampleTest", "Program.cs")]
         [InlineData("VSCodeTestBreakpoint", "Program.cs")]
         [InlineData("VSCodeTestFuncBreak", "Program.cs")]
@@ -67,6 +68,7 @@ namespace XUnitTests
         [InlineData("VSCodeTestNoJMCAsyncStepping", "Program.cs")]
         [InlineData("VSCodeTestExceptionBreakpoint", "Program.cs")]
         [InlineData("VSCodeTestNoJMCExceptionBreakpoint", "Program.cs")]
+        [InlineData("VSCodeTestSizeof", "Program.cs")]
         public void Run(string testCaseName, string testCourceList)
         {
             // Explicit encoding setup, since system console encoding could be not utf8 (Windows OS).
index 579d35eeecaf0908b259455a08cced62804ce152..41db66882ecc33e7380e71ab01f63d2e28da7e3a 100644 (file)
@@ -65,6 +65,8 @@
     <ProjectReference Include="..\VSCodeTestNoJMCAsyncStepping\VSCodeTestNoJMCAsyncStepping.csproj" />\r
     <ProjectReference Include="..\VSCodeTestExceptionBreakpoint\VSCodeTestExceptionBreakpoint.csproj" />\r
     <ProjectReference Include="..\VSCodeTestNoJMCExceptionBreakpoint\VSCodeTestNoJMCExceptionBreakpoint.csproj" />\r
+    <ProjectReference Include="..\MITestSizeof\MITestSizeof.csproj" />\r
+    <ProjectReference Include="..\VSCodeTestSizeof\VSCodeTestSizeof.csproj" />\r
   </ItemGroup>\r
 \r
 </Project>\r
index 34ddea1e6b5df227c35f3eebdd9419bcc061aa98..5923f9cf4367c864940eef825f9e44fde57f22d7 100644 (file)
@@ -28,6 +28,7 @@ $ALL_TEST_NAMES = @(
     "MITestNoJMCBreakpoint"
     "MITestNoJMCAsyncStepping"
     "MITestNoJMCExceptionBreakpoint"
+    "MITestSizeof"
     "VSCodeExampleTest"
     "VSCodeTestBreakpoint"
     "VSCodeTestFuncBreak"
@@ -51,6 +52,7 @@ $ALL_TEST_NAMES = @(
     "VSCodeTestNoJMCAsyncStepping"
     "VSCodeTestExceptionBreakpoint"
     "VSCodeTestNoJMCExceptionBreakpoint"
+    "VSCodeTestSizeof"
 )
 
 # Skipped tests:
index 006d6d34aecb968fa7b878fa40834e9d4da34388..fe02536b4948555d75ee35edd4d87509dbfe977a 100755 (executable)
@@ -29,6 +29,7 @@ ALL_TEST_NAMES=(
     "MITestNoJMCBreakpoint"
     "MITestNoJMCAsyncStepping"
     "MITestNoJMCExceptionBreakpoint"
+    "MITestSizeof"
     "VSCodeExampleTest"
     "VSCodeTestBreakpoint"
     "VSCodeTestFuncBreak"
@@ -52,6 +53,7 @@ ALL_TEST_NAMES=(
     "VSCodeTestNoJMCAsyncStepping"
     "VSCodeTestExceptionBreakpoint"
     "VSCodeTestNoJMCExceptionBreakpoint"
+    "VSCodeTestSizeof"
 )
 
 # Skipped tests:
index dd500f7ea1bd4c1f38b77185fb3fa837445f28a1..1dcd788505b1f826109f75060e45dacaa60e00a4 100644 (file)
@@ -27,6 +27,7 @@ $ALL_TEST_NAMES = @(
     "MITestNoJMCBreakpoint"
     "MITestNoJMCAsyncStepping"
     "MITestNoJMCExceptionBreakpoint"
+    "MITestSizeof"
     "VSCodeExampleTest"
     "VSCodeTestBreakpoint"
     "VSCodeTestFuncBreak"
@@ -47,6 +48,7 @@ $ALL_TEST_NAMES = @(
     "VSCodeTestNoJMCAsyncStepping"
     "VSCodeTestExceptionBreakpoint"
     "VSCodeTestNoJMCExceptionBreakpoint"
+    "VSCodeTestSizeof"
 )
 
 # Skipped tests:
index b52cd5f1e3c6da1f42eefcf80303c3193526d3fa..25d6e5f1b63e3652b40a67052b5a648df5b5adaf 100755 (executable)
@@ -55,6 +55,7 @@ ALL_TEST_NAMES=(
     "MITestNoJMCBreakpoint"
     "MITestNoJMCAsyncStepping"
     "MITestNoJMCExceptionBreakpoint"
+    "MITestSizeof"
     "VSCodeExampleTest"
     "VSCodeTestBreakpoint"
     "VSCodeTestFuncBreak"
@@ -75,6 +76,7 @@ ALL_TEST_NAMES=(
     "VSCodeTestNoJMCNoFilterStepping"
     "VSCodeTestNoJMCBreakpoint"
     "VSCodeTestNoJMCAsyncStepping"
+    "VSCodeTestSizeof"
 )
 
 # Skipped tests:
index 23599e3070592e78b1922f0e1e6f29711465be54..464ef61748a30cf7ff8affed1386433fabcf46d3 100644 (file)
@@ -60,6 +60,7 @@ EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestExitCode", "MITestExitCode\MITestExitCode.csproj", "{9308CF34-12C5-4D5B-A318-00AD7AC1907A}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestExitCode", "VSCodeTestExitCode\VSCodeTestExitCode.csproj", "{045EE2A3-F595-4D40-8E1A-734CA9CEB10C}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestEvalNotEnglish", "MITestEvalNotEnglish\MITestEvalNotEnglish.csproj", "{76D789CF-9499-4A12-9128-7378592B7BDC}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestEvalNotEnglish", "VSCodeTestEvalNotEnglish\VSCodeTestEvalNotEnglish.csproj", "{5FE6BDFF-AD0E-4E1C-A596-6D583D0777BC}"
@@ -67,6 +68,7 @@ EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITest中文目录", "MITest中文目录\MITest中文目录.csproj", "{6B76C4A1-D871-4A78-B284-FE8E2FCBA10D}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTest中文目录", "VSCodeTest中文目录\VSCodeTest中文目录.csproj", "{56BFF745-3A77-44BF-B068-3E13901295A1}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestSrcBreakpointResolve", "MITestSrcBreakpointResolve\MITestSrcBreakpointResolve.csproj", "{81372498-2551-49D6-8A36-4F57C4985E5E}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestSrcBreakpointResolve", "VSCodeTestSrcBreakpointResolve\VSCodeTestSrcBreakpointResolve.csproj", "{C4B66CFD-47AA-4B41-BE26-B6FE2282FF09}"
@@ -76,10 +78,11 @@ EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestEnum", "MITestEnum\MITestEnum.csproj", "{D52DD1E9-42C9-4378-B505-C94C6B282C49}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestEnum", "VSCodeTestEnum\VSCodeTestEnum.csproj", "{751C9FDC-5992-4734-ABD0-126148F3818D}"
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestAsyncStepping", "VSCodeTestAsyncStepping\VSCodeTestAsyncStepping.csproj", "{CDC2D04E-9433-4D2F-9A77-1839982F6834}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestAsyncStepping", "MITestAsyncStepping\MITestAsyncStepping.csproj", "{C1400CFC-3087-42E1-B580-DE8A00C3686B}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestAsyncStepping", "VSCodeTestAsyncStepping\VSCodeTestAsyncStepping.csproj", "{CDC2D04E-9433-4D2F-9A77-1839982F6834}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestBreak", "VSCodeTestBreak\VSCodeTestBreak.csproj", "{0EB5EE41-E73C-4946-8561-4C2BB0EB26BC}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestBreak", "MITestBreak\MITestBreak.csproj", "{954D72F6-BD7C-40EF-A3CA-DD76D26BC2FD}"
@@ -104,6 +107,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestNoJMCExceptionBre
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestExceptionBreakpoint", "VSCodeTestExceptionBreakpoint\VSCodeTestExceptionBreakpoint.csproj", "{1770637A-2007-4E96-A8E5-A32772831AD3}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestSizeof", "MITestSizeof\MITestSizeof.csproj", "{8FD648F2-8F88-4030-A622-823BFA1A3E1C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSCodeTestSizeof", "VSCodeTestSizeof\VSCodeTestSizeof.csproj", "{C8053627-4094-4913-8E9D-74AD38DCC39F}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -741,5 +748,29 @@ Global
                {1770637A-2007-4E96-A8E5-A32772831AD3}.Release|x64.Build.0 = Release|Any CPU
                {1770637A-2007-4E96-A8E5-A32772831AD3}.Release|x86.ActiveCfg = Release|Any CPU
                {1770637A-2007-4E96-A8E5-A32772831AD3}.Release|x86.Build.0 = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|x64.ActiveCfg = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|x64.Build.0 = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|x86.ActiveCfg = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Debug|x86.Build.0 = Debug|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|Any CPU.Build.0 = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|x64.ActiveCfg = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|x64.Build.0 = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|x86.ActiveCfg = Release|Any CPU
+               {8FD648F2-8F88-4030-A622-823BFA1A3E1C}.Release|x86.Build.0 = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|x64.ActiveCfg = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|x64.Build.0 = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|x86.ActiveCfg = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Debug|x86.Build.0 = Debug|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|Any CPU.Build.0 = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|x64.ActiveCfg = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|x64.Build.0 = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|x86.ActiveCfg = Release|Any CPU
+               {C8053627-4094-4913-8E9D-74AD38DCC39F}.Release|x86.Build.0 = Release|Any CPU
        EndGlobalSection
 EndGlobal