diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 43305004f..45a0003ef 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -116,6 +116,7 @@ jobs: which gdb echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope # TODO: Try to make core dumps work + # Related CoreDump Tests: https://github.com/microsoft/MIEngine/issues/1170 # echo 1 | sudo tee /proc/sys/kernel/core_uses_pid # ulimit -S -c unlimited # sudo sysctl -w kernel.core_pattern=${{ github.workspace }}/core.%e @@ -150,4 +151,19 @@ jobs: run: dotnet build ${{ github.workspace }}/src/MIDebugEngine-Unix.sln - run: | - ${{ github.workspace }}/PublishOpenDebugAD7.sh -c Debug -o ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters \ No newline at end of file + ${{ github.workspace }}/PublishOpenDebugAD7.sh -c Debug -o ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters + cp ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/TestConfigurations/config_lldb.xml ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/config.xml + + - name: Download LLDB-MI + run: | + ${{ github.workspace }}/tools/DownloadLldbMI.sh ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters + + - run: | + dotnet test ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll --logger "trx;LogFileName=${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx" + + - name: 'Upload Test Results' + uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: osx_x64_results + path: ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx \ No newline at end of file diff --git a/src/OpenDebugAD7/AD7DebugSession.cs b/src/OpenDebugAD7/AD7DebugSession.cs index 13bd8790f..e01611c36 100644 --- a/src/OpenDebugAD7/AD7DebugSession.cs +++ b/src/OpenDebugAD7/AD7DebugSession.cs @@ -238,7 +238,7 @@ private void SetCommonMISettings(Dictionary args) else { // If lldb and there is no miDebuggerPath, set it. - bool hasMiDebuggerPath = args.ContainsKey("miDebuggerPath"); + bool hasMiDebuggerPath = args.ContainsKey("miDebuggerPath") && !string.IsNullOrEmpty(args["miDebuggerPath"].ToString()); if (miMode == "lldb" && !hasMiDebuggerPath) { args["miDebuggerPath"] = MILaunchOptions.GetLLDBMIPath(); diff --git a/test/CppTests/TestConfigurations/config_lldb.xml b/test/CppTests/TestConfigurations/config_lldb.xml new file mode 100644 index 000000000..f5fd0de50 --- /dev/null +++ b/test/CppTests/TestConfigurations/config_lldb.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/CppTests/Tests/BreakpointTests.cs b/test/CppTests/Tests/BreakpointTests.cs index 6ef794c82..40a99c9e8 100644 --- a/test/CppTests/Tests/BreakpointTests.cs +++ b/test/CppTests/Tests/BreakpointTests.cs @@ -157,8 +157,10 @@ public void FunctionBreakpointsBasic(ITestSettings settings) [Theory] [DependsOnTest(nameof(CompileKitchenSinkForBreakpointTests))] [RequiresTestSettings] - // TODO: Re-enable for Gdb_Gnu - [UnsupportedDebugger(SupportedDebugger.Gdb_Gnu | SupportedDebugger.Gdb_Cygwin | SupportedDebugger.Gdb_MinGW, SupportedArchitecture.x64 | SupportedArchitecture.x86)] + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - gdb_gnu + // - lldb + [UnsupportedDebugger(SupportedDebugger.Lldb | SupportedDebugger.Gdb_Gnu | SupportedDebugger.Gdb_Cygwin | SupportedDebugger.Gdb_MinGW, SupportedArchitecture.x64 | SupportedArchitecture.x86)] public void RunModeBreakpoints(ITestSettings settings) { this.TestPurpose("Tests setting breakpoints while in run mode"); diff --git a/test/CppTests/Tests/CoreDumpTests.cs b/test/CppTests/Tests/CoreDumpTests.cs index 08e04dc7d..f1a6e00e7 100644 --- a/test/CppTests/Tests/CoreDumpTests.cs +++ b/test/CppTests/Tests/CoreDumpTests.cs @@ -51,7 +51,8 @@ public CoreDumpTests(ITestOutputHelper outputHelper) : base(outputHelper) [Theory] [RequiresTestSettings] [SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)] - // TODO: Re-enable for Gdb_Gnu + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - gdb_gnu [UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)] public void CoreDumpBasic(ITestSettings settings) { @@ -68,7 +69,8 @@ public void CoreDumpBasic(ITestSettings settings) [Theory] [RequiresTestSettings] [SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)] - // TODO: Re-enable for Gdb_Gnu + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - gdb_gnu [UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)] public void CoreDumpBasicMismatchedSourceAndSymbols(ITestSettings settings) { @@ -88,7 +90,8 @@ public void CoreDumpBasicMismatchedSourceAndSymbols(ITestSettings settings) [Theory] [RequiresTestSettings] [SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)] - // TODO: Re-enable for Gdb_Gnu + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - gdb_gnu [UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)] public void CoreDumpVerifyActions(ITestSettings settings) { diff --git a/test/CppTests/Tests/ExpressionTests.cs b/test/CppTests/Tests/ExpressionTests.cs index 0a82e9795..8fab44e6c 100644 --- a/test/CppTests/Tests/ExpressionTests.cs +++ b/test/CppTests/Tests/ExpressionTests.cs @@ -199,6 +199,9 @@ public void DataTipBasic(ITestSettings settings) [Theory] [DependsOnTest(nameof(CompileKitchenSinkForExpressionTests))] + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - lldb + [UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)] [RequiresTestSettings] public void CallStackBasic(ITestSettings settings) { @@ -328,6 +331,9 @@ public void EvaluateOnFrames(ITestSettings settings) [Theory] [DependsOnTest(nameof(CompileKitchenSinkForExpressionTests))] + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - lldb + [UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)] [RequiresTestSettings] public void EvaluateInvalidExpression(ITestSettings settings) { diff --git a/test/CppTests/Tests/SharedLibTests.cs b/test/CppTests/Tests/SharedLibTests.cs index 54ea92608..186c79f9d 100644 --- a/test/CppTests/Tests/SharedLibTests.cs +++ b/test/CppTests/Tests/SharedLibTests.cs @@ -54,7 +54,9 @@ public void CompileSharedLibDebuggee(ITestSettings settings) [Theory] [DependsOnTest(nameof(CompileSharedLibDebuggee))] - [UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)] + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - lldb + [UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)] [RequiresTestSettings] public void SharedLibBasic(ITestSettings settings) { @@ -66,7 +68,9 @@ public void SharedLibBasic(ITestSettings settings) } [Theory] - [UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)] + // TODO: https://github.com/microsoft/MIEngine/issues/1170 + // - lldb + [UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)] [RequiresTestSettings] public void SharedLibMismatchSourceAndSymbols(ITestSettings settings) { diff --git a/tools/DownloadLldbMI.sh b/tools/DownloadLldbMI.sh new file mode 100755 index 000000000..330c1f641 --- /dev/null +++ b/tools/DownloadLldbMI.sh @@ -0,0 +1,44 @@ +#! /bin/bash +lldbMIDownloadLink="https://download.visualstudio.microsoft.com/download/pr/173e6ced-0717-401d-87fc-169ca3424c72/f1228fd847c140b7f9839612f497bb7a/lldb-mi-10.0.0.zip" +toolsDirectory=$(dirname "$0") + +# Go to root project folder +pushd "$toolsDirectory/.." > /dev/null 2>&1 || exit 1 + +if [ -z "$1" ] || [ "$1" == "-h" ]; then + echo "Please pass in output folder of publish" + echo "Example: $0 $(pwd)/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters" + exit 1 +fi + +if [ ! -f "$1/OpenDebugAD7" ]; then + echo "Please build MIDebugEngine-Unix.sln and run PublishOpenDebugAD7.sh before running DownloadLldbMI.sh" + popd || exit + exit 1 +fi + +# Download the latest version of lldb-ui that vscode-cpptools uses. +if ! `curl $lldbMIDownloadLink --output ./lldb-mi-10.0.0.zip > /dev/null 2>&1` ; then + echo "Failed to download lldb-mi." + exit 1 +fi + +unzip -o ./lldb-mi-10.0.0.zip > /dev/null 2>&1 + +if [ ! -f ./debugAdapters/lldb-mi/bin/lldb-mi ]; then + echo "Failed to unzip." +fi + +# Ensure we can run it or we will get permission denied. +if ! `sudo chmod 755 ./debugAdapters/lldb-mi/bin/lldb-mi` ; then + echo "Failed to change permissions for lldb-mi." + exit 1 +fi + +# place lldb-mi folder in output's debugAdapters folder +mv ./debugAdapters/lldb-mi $1/../. + +# Clean up unused zip +rm ./lldb-mi-10.0.0.zip + +popd > /dev/null 2>&1 || exit \ No newline at end of file