Skip to content

Commit

Permalink
Merge pull request #1194 from microsoft/main
Browse files Browse the repository at this point in the history
Merge 'main' into 'release-cpptools'
  • Loading branch information
WardenGnaw authored Aug 11, 2021
2 parents 8abca80 + d3b2415 commit c3aefaa
Show file tree
Hide file tree
Showing 43 changed files with 390 additions and 191 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
${{ 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
15 changes: 10 additions & 5 deletions build/Debugger.PIAs.Portable.Packages.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- 'package_versions.settings.targets' must have been imported before importing this file. -->

<PropertyGroup>
<!-- Ignore the PIA imported files not being found. -->
<NoWarn>$(NoWarn);3106</NoWarn>
</PropertyGroup>

<ItemGroup Label="Debugger.PIAs.Portable.Packages.props Package References">
<Reference Include="$(MIDefaultOutputPath)\PIA\drop\Microsoft.VisualStudio.Debugger.Interop.10.0.dll" />
<Reference Include="$(MIDefaultOutputPath)\PIA\drop\Microsoft.VisualStudio.Debugger.Interop.11.0.dll" />
<Reference Include="$(MIDefaultOutputPath)\PIA\drop\Microsoft.VisualStudio.Debugger.Interop.12.0.dll" />
<Reference Include="$(MIDefaultOutputPath)\PIA\drop\Microsoft.VisualStudio.Debugger.InteropA.dll" />
<Reference Include="$(MIDefaultOutputPath)\PIA\drop\Microsoft.VisualStudio.Interop.dll" />
<Reference Include="$(MIDefaultOutputPath)PIA\drop\Microsoft.VisualStudio.Debugger.Interop.10.0.dll" />
<Reference Include="$(MIDefaultOutputPath)PIA\drop\Microsoft.VisualStudio.Debugger.Interop.11.0.dll" />
<Reference Include="$(MIDefaultOutputPath)PIA\drop\Microsoft.VisualStudio.Debugger.Interop.12.0.dll" />
<Reference Include="$(MIDefaultOutputPath)PIA\drop\Microsoft.VisualStudio.Debugger.InteropA.dll" />
<Reference Include="$(MIDefaultOutputPath)PIA\drop\Microsoft.VisualStudio.Interop.dll" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/DebugEngineHost.VSCode/DebugEngineHost.VSCode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>

<ItemGroup Label="Compile Shared Interfaces">
<Compile Include="$(MIEngineRoot)\src\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.DAP.cs" />
</ItemGroup>

<ItemGroup>
<Compile Update="HostResources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
6 changes: 6 additions & 0 deletions src/DebugEngineHost/DebugEngineHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<MicrosoftVisualStudioDebuggerEnginePath>$(VSSDKRoot)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Debugger.Engine.dll</MicrosoftVisualStudioDebuggerEnginePath>
</PropertyGroup>

<ItemGroup Label="Compile Shared Interfaces">
<Compile Include="$(MIEngineRoot)\src\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.DAP.cs" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resource.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -68,6 +72,8 @@
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.0.16-alpha" />
</ItemGroup>

<ItemGroup Label="Assembly to Generate">
Expand Down
11 changes: 7 additions & 4 deletions src/DebugEngineHost/HostNatvisProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ internal enum VSENUMPROJFLAGS
private static IVsFolderWorkspaceService GetWorkspaceService()
{
IComponentModel componentModel = ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel).GUID) as IComponentModel;
var workspaceServices = componentModel.DefaultExportProvider.GetExports<IVsFolderWorkspaceService>();

if (workspaceServices != null && workspaceServices.Any())
if (componentModel != null)
{
return workspaceServices.First().Value;
var workspaceServices = componentModel.DefaultExportProvider.GetExports<IVsFolderWorkspaceService>();

if (workspaceServices != null && workspaceServices.Any())
{
return workspaceServices.First().Value;
}
}
return null;
}
Expand Down
9 changes: 9 additions & 0 deletions src/MICore/JsonLaunchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ public abstract partial class BaseOptions
[JsonProperty("setupCommands", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<SetupCommand> SetupCommands { get; protected set; }

/// <summary>
/// One or more commands to execute in order to setup underlying debugger after debugger has been attached. i.e. flashing and resetting the board
/// </summary>
[JsonProperty("postRemoteConnectCommands", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<SetupCommand> PostRemoteConnectCommands { get; protected set; }

/// <summary>
/// Explicitly control whether hardware breakpoints are used. If an optional limit is provided, additionally restrict the number of hardware breakpoints for remote targets. Example: "hardwareBreakpoints": { "require": true, "limit": 5 }.
/// </summary>
Expand Down Expand Up @@ -360,6 +366,7 @@ public LaunchOptions()
{
this.Args = new List<string>();
this.SetupCommands = new List<SetupCommand>();
this.PostRemoteConnectCommands = new List<SetupCommand>();
this.CustomLaunchSetupCommands = new List<SetupCommand>();
this.Environment = new List<Environment>();
this.SourceFileMap = new Dictionary<string, object>();
Expand All @@ -372,6 +379,7 @@ public LaunchOptions(
string targetArchitecture = null,
string cwd = null,
List<SetupCommand> setupCommands = null,
List<SetupCommand> postRemoteConnectCommands = null,
List<SetupCommand> customLaunchSetupCommands = null,
LaunchCompleteCommand? launchCompleteCommand = null,
string visualizerFile = null,
Expand Down Expand Up @@ -402,6 +410,7 @@ public LaunchOptions(
this.TargetArchitecture = targetArchitecture;
this.Cwd = cwd;
this.SetupCommands = setupCommands;
this.PostRemoteConnectCommands = postRemoteConnectCommands;
this.CustomLaunchSetupCommands = customLaunchSetupCommands;
this.LaunchCompleteCommand = launchCompleteCommand;
this.VisualizerFile = visualizerFile;
Expand Down
20 changes: 20 additions & 0 deletions src/MICore/LaunchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,24 @@ public ReadOnlyCollection<LaunchCommand> SetupCommands
}
}

private ReadOnlyCollection<LaunchCommand> _postRemoteConnectCommands;

/// <summary>
/// [Required] Additional commands used to setup debugging once the remote connection has been made. May be an empty collection
/// </summary>
public ReadOnlyCollection<LaunchCommand> PostRemoteConnectCommands
{
get { return _postRemoteConnectCommands; }
set
{
if (value == null)
throw new ArgumentNullException("PostRemoteConnectCommands");

VerifyCanModifyProperty(nameof(PostRemoteConnectCommands));
_postRemoteConnectCommands = value;
}
}


private ReadOnlyCollection<LaunchCommand> _customLaunchSetupCommands;

Expand Down Expand Up @@ -1416,6 +1434,7 @@ public static LaunchOptions CreateForAttachRequest(Microsoft.VisualStudio.Debugg

options.ProcessId = processId;
options.SetupCommands = new ReadOnlyCollection<LaunchCommand>(new LaunchCommand[] { });
options.PostRemoteConnectCommands = new ReadOnlyCollection<LaunchCommand>(new LaunchCommand[] { });
if (attachOptions != null)
{
options.Merge(attachOptions);
Expand Down Expand Up @@ -1753,6 +1772,7 @@ protected void InitializeCommonOptions(Json.LaunchOptions.BaseOptions options)
}

this.SetupCommands = LaunchCommand.CreateCollection(options.SetupCommands);
this.PostRemoteConnectCommands = LaunchCommand.CreateCollection(options.PostRemoteConnectCommands);

this.RequireHardwareBreakpoints = options.HardwareBreakpointInfo?.Require ?? false;
this.HardwareBreakpointLimit = options.HardwareBreakpointInfo?.Limit ?? 0;
Expand Down
13 changes: 0 additions & 13 deletions src/MIDebugEngine-Unix.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MakePIAPortable", "MakePIAP
{CC5BDD33-7EB1-4FB9-BC67-806773018989} = {CC5BDD33-7EB1-4FB9-BC67-806773018989}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Debugger.Interop.DAP", "Microsoft.VisualStudio.Debugger.Interop.DAP\Microsoft.VisualStudio.Debugger.Interop.DAP.csproj", "{23DE943C-1F84-4E23-9490-50FE1DEDE858}"
ProjectSection(ProjectDependencies) = postProject
{114039A0-87B5-425B-90C9-6AFC1960A247} = {114039A0-87B5-425B-90C9-6AFC1960A247}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DebugAdapterProtocolTests", "DebugAdapterProtocolTests", "{9D97EF1A-BCD5-4932-BBCC-98194CF8A841}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CppTests", "..\test\CppTests\CppTests.csproj", "{FCE5D242-33FC-4570-88F3-A3DDE8C27643}"
Expand Down Expand Up @@ -137,14 +132,6 @@ Global
{114039A0-87B5-425B-90C9-6AFC1960A247}.Lab.Release|Any CPU.Build.0 = Lab.Release|Any CPU
{114039A0-87B5-425B-90C9-6AFC1960A247}.Release|Any CPU.ActiveCfg = Release|Any CPU
{114039A0-87B5-425B-90C9-6AFC1960A247}.Release|Any CPU.Build.0 = Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Debug|Any CPU.ActiveCfg = Lab.Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Debug|Any CPU.Build.0 = Lab.Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Release|Any CPU.ActiveCfg = Lab.Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Release|Any CPU.Build.0 = Lab.Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Release|Any CPU.Build.0 = Release|Any CPU
{FCE5D242-33FC-4570-88F3-A3DDE8C27643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCE5D242-33FC-4570-88F3-A3DDE8C27643}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCE5D242-33FC-4570-88F3-A3DDE8C27643}.Lab.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
13 changes: 0 additions & 13 deletions src/MIDebugEngine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MakePIAPortable", "MakePIAP
{CC5BDD33-7EB1-4FB9-BC67-806773018989} = {CC5BDD33-7EB1-4FB9-BC67-806773018989}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Debugger.Interop.DAP", "Microsoft.VisualStudio.Debugger.Interop.DAP\Microsoft.VisualStudio.Debugger.Interop.DAP.csproj", "{23DE943C-1F84-4E23-9490-50FE1DEDE858}"
ProjectSection(ProjectDependencies) = postProject
{114039A0-87B5-425B-90C9-6AFC1960A247} = {114039A0-87B5-425B-90C9-6AFC1960A247}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MIDebugPackage", "MIDebugPackage\MIDebugPackage.csproj", "{A8D8E02F-4258-4F2E-88B6-A50FEBD5AD8C}"
ProjectSection(ProjectDependencies) = postProject
{15BCBEF4-1C2B-412B-925B-34A049097E62} = {15BCBEF4-1C2B-412B-925B-34A049097E62}
Expand Down Expand Up @@ -243,14 +238,6 @@ Global
{114039A0-87B5-425B-90C9-6AFC1960A247}.Lab.Release|Any CPU.Build.0 = Lab.Release|Any CPU
{114039A0-87B5-425B-90C9-6AFC1960A247}.Release|Any CPU.ActiveCfg = Release|Any CPU
{114039A0-87B5-425B-90C9-6AFC1960A247}.Release|Any CPU.Build.0 = Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Debug|Any CPU.ActiveCfg = Lab.Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Debug|Any CPU.Build.0 = Lab.Debug|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Release|Any CPU.ActiveCfg = Lab.Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Lab.Release|Any CPU.Build.0 = Lab.Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23DE943C-1F84-4E23-9490-50FE1DEDE858}.Release|Any CPU.Build.0 = Release|Any CPU
{A8D8E02F-4258-4F2E-88B6-A50FEBD5AD8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8D8E02F-4258-4F2E-88B6-A50FEBD5AD8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8D8E02F-4258-4F2E-88B6-A50FEBD5AD8C}.Lab.Debug|Any CPU.ActiveCfg = Lab.Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion src/MIDebugEngine/AD7.Impl/AD7Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS
propertyInfo.dwAttrib |= (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_HAS_DATA_BREAKPOINT;
}
}
catch (Exception e) { }
catch (Exception) { }
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ private async Task<List<LaunchCommand>> GetInitializeCommands()
commands.Add(new LaunchCommand("-target-attach " + _launchOptions.ProcessId.Value.ToString(CultureInfo.InvariantCulture), ignoreFailures: false, failureHandler: failureHandler));
}

commands.AddRange(_launchOptions.PostRemoteConnectCommands);

if (this.MICommandFactory.Mode == MIMode.Lldb)
{
// LLDB finishes attach in break mode. Gdb does finishes in run mode. Issue a continue in lldb to match the gdb behavior
Expand Down Expand Up @@ -824,13 +826,13 @@ private async Task<List<LaunchCommand>> GetInitializeCommands()
if (!string.IsNullOrWhiteSpace(destination))
{
commands.Add(new LaunchCommand("-target-select remote " + destination, string.Format(CultureInfo.CurrentCulture, ResourceStrings.ConnectingMessage, destination)));

if (localLaunchOptions.RequireHardwareBreakpoints && localLaunchOptions.HardwareBreakpointLimit > 0) {
commands.Add(new LaunchCommand(string.Format(CultureInfo.InvariantCulture, "-interpreter-exec console \"set remote hardware-breakpoint-limit {0}\"", localLaunchOptions.HardwareBreakpointLimit.ToString(CultureInfo.InvariantCulture))));
}
}

}
commands.AddRange(_launchOptions.PostRemoteConnectCommands);

// Environment variables are set for the debuggee only with the modes that support that
foreach (EnvironmentEntry envEntry in _launchOptions.Environment)
Expand Down
5 changes: 0 additions & 5 deletions src/MIDebugEngine/MIDebugEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
<Project>{54c33afa-438d-4932-a2f0-d0f2bb2fadc9}</Project>
<Name>MICore</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.VisualStudio.Debugger.Interop.DAP\Microsoft.VisualStudio.Debugger.Interop.DAP.csproj">
<Project>{23DE943C-1F84-4E23-9490-50FE1DEDE858}</Project>
<Name>Microsoft.VisualStudio.Debugger.Interop.DAP</Name>
<EmbedInteropTypes>True</EmbedInteropTypes>
</ProjectReference>
<ProjectReference Include="..\Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier\Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier.DesignTime.csproj">
<Project>{7654cfbb-30db-4c20-bde3-a960cba2036c}</Project>
<Name>Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier.DesignTime</Name>
Expand Down
2 changes: 2 additions & 0 deletions src/MIDebugPackage/MIDebugPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(Microsoft_VisualStudio_Shell_15_0_Version)" />
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="17.0.0-previews-1-31410-258" />

<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.0.16-alpha" />

<PackageReference Include="Microsoft.VisualStudio.Debugger.Interop.16.0" Version="$(Microsoft_VisualStudio_Debugger_Interop_16_0_Version)">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Loading

0 comments on commit c3aefaa

Please sign in to comment.