Skip to content

Commit a05b8db

Browse files
authored
Merge pull request #1303 from microsoft/main
Merge 'main' into 'release-cpptools'
2 parents 340124c + 452572f commit a05b8db

27 files changed

+897
-191
lines changed

.github/workflows/Build-And-Test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ jobs:
145145
gdb --version
146146
147147
148-
- run: >
148+
- run: |
149+
set PATH="%PATH%;D:\a\_temp\msys64\mingw64\bin\"
149150
dotnet test ${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\CppTests.dll --logger "trx;LogFileName=${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\results.trx"
150151
151152
- name: 'Upload Test Results'

IL/Microsoft.Internal.VisualStudio.Interop.il

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,4 +918,64 @@
918918
.get instance class [mscorlib]System.Array Microsoft.Internal.VisualStudio.Shell.Interop.IVsTelemetryPropertyBag::get_AllPropertyNames()
919919
}
920920
}
921+
.class public interface abstract import IVsExtensionManagerPrivate
922+
{
923+
.custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = { string('753E55C6-E779-4A7A-BCD1-FD87181D52C0') }
924+
.custom instance void [mscorlib]System.Runtime.InteropServices.InterfaceTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.ComInterfaceType) = { int32(1) }
925+
.method public virtual hidebysig newslot abstract
926+
instance int32 GetEnabledExtensionContentLocations([in] string marshal(lpwstr) szContentTypeName, [in] uint32 cContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrUniqueExtensionStrings, [out] uint32& pcContentLocations)
927+
preservesig internalcall
928+
{
929+
.param [1]
930+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.LPCWSTR') }
931+
.param [2]
932+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
933+
.param [5]
934+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
935+
}
936+
.method public virtual hidebysig newslot abstract
937+
instance int32 GetEnabledExtensionContentLocationsWithNames([in] string marshal(lpwstr) szContentTypeName, [in] uint32 cContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrUniqueExtensionStrings, [out] string[] marshal(bstr[ + 1]) rgbstrExtensionNames, [out] uint32& pcContentLocations)
938+
preservesig internalcall
939+
{
940+
.param [1]
941+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.LPCWSTR') }
942+
.param [2]
943+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
944+
.param [6]
945+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
946+
}
947+
.method public virtual hidebysig newslot abstract
948+
instance int32 GetDisabledExtensionContentLocations([in] string marshal(lpwstr) szContentTypeName, [in] uint32 cContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrContentLocations, [out] string[] marshal(bstr[ + 1]) rgbstrUniqueExtensionStrings, [out] uint32& pcContentLocations)
949+
preservesig internalcall
950+
{
951+
.param [1]
952+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.LPCWSTR') }
953+
.param [2]
954+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
955+
.param [5]
956+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.ULONG') }
957+
}
958+
.method public virtual hidebysig newslot abstract
959+
instance int32 GetLastConfigurationChange([out] valuetype [mscorlib]System.DateTime[] marshal([]) pTimestamp)
960+
preservesig internalcall
961+
{
962+
}
963+
.method public virtual hidebysig newslot abstract
964+
instance int32 LogAllInstalledExtensions()
965+
preservesig internalcall
966+
{
967+
}
968+
.method public virtual hidebysig newslot abstract
969+
instance int32 GetUniqueExtensionString([in] string marshal(lpwstr) szExtensionIdentifier, [out] string& marshal(bstr) pbstrUniqueString)
970+
preservesig internalcall
971+
{
972+
.param [1]
973+
.custom instance void [mscorlib]System.Runtime.InteropServices.ComAliasNameAttribute::.ctor(string) = { string('OLE.LPCWSTR') }
974+
}
975+
}
976+
.class public interface abstract import SVsExtensionManager
977+
{
978+
.custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = { string('316F4DE6-3CA4-4F0D-B003-962D28F65238') }
979+
.custom instance void [mscorlib]System.Runtime.InteropServices.InterfaceTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.ComInterfaceType) = { int32(1) }
980+
}
921981
}

src/DebugEngineHost.Stub/DebugEngineHost.ref.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,11 @@ public static class HostNatvisProject
385385
public delegate void NatvisLoader(string path);
386386

387387
/// <summary>
388-
/// Searches the solution for natvis files, invoking the loader on any which are found.
388+
/// Searches the solution and VSIXs for natvis files, invoking the loader on any which are found.
389389
/// </summary>
390390
/// <param name="loader">Natvis loader method to invoke</param>
391391
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Natvis")]
392-
public static void FindNatvisInSolution(NatvisLoader loader)
392+
public static void FindNatvis(NatvisLoader loader)
393393
{
394394
throw new NotImplementedException();
395395
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// // Copyright (c) Microsoft. All rights reserved.
2+
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
namespace Microsoft.VisualStudio.Debugger.Interop.MI
8+
{
9+
/// <summary>
10+
/// IDebugProperty for MIEngine
11+
/// </summary>
12+
[ComImport()]
13+
[ComVisible(true)]
14+
[Guid("27F5EFAF-9DBA-4AC0-A456-1F97E50F3CDA")]
15+
[InterfaceType(1)]
16+
public interface IDebugMIEngineProperty
17+
{
18+
/// <summary>
19+
/// Get the expression context for the property
20+
/// </summary>
21+
[PreserveSig]
22+
int GetExpressionContext([Out, MarshalAs(UnmanagedType.Interface)] out IDebugExpressionContext2 ppExpressionContext);
23+
}
24+
}

src/DebugEngineHost.VSCode/DebugEngineHost.VSCode.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<ItemGroup Label="Compile Shared Interfaces">
2424
<Compile Include="$(MIEngineRoot)\src\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.DAP.cs" />
25+
<Compile Include="..\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.MI.cs" Link="Microsoft.VisualStudio.Debugger.Interop.MI.cs" />
2526
</ItemGroup>
2627

2728
<ItemGroup>

src/DebugEngineHost.VSCode/HostNatvisProject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static class HostNatvisProject
99
{
1010
public delegate void NatvisLoader(string path);
1111

12-
public static void FindNatvisInSolution(NatvisLoader loader)
12+
public static void FindNatvis(NatvisLoader loader)
1313
{
1414
// In-solution natvis is not supported for VS Code now, so do nothing.
1515
}

src/DebugEngineHost/DebugEngineHost.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<ItemGroup Label="Compile Shared Interfaces">
3030
<Compile Include="$(MIEngineRoot)\src\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.DAP.cs" />
31+
<Compile Include="$(MIEngineRoot)\src\DebugEngineHost.Stub\Shared\Microsoft.VisualStudio.Debugger.Interop.MI.cs" />
3132
</ItemGroup>
3233

3334
<ItemGroup>

src/DebugEngineHost/HostNatvisProject.cs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Linq;
1010
using System.Threading;
1111
using System.Threading.Tasks;
12+
using Microsoft.Internal.VisualStudio.Shell.Interop;
1213
using Microsoft.VisualStudio;
1314
using Microsoft.VisualStudio.ComponentModelHost;
1415
using Microsoft.VisualStudio.Shell.Interop;
@@ -29,17 +30,18 @@ public static class HostNatvisProject
2930
public delegate void NatvisLoader(string path);
3031

3132
/// <summary>
32-
/// Searches the solution for natvis files, invoking the loader on any which are found.
33+
/// Searches the solution and VSIXs for natvis files, invoking the loader on any which are found.
3334
/// </summary>
3435
/// <param name="loader">Natvis loader method to invoke</param>
35-
public static void FindNatvisInSolution(NatvisLoader loader)
36+
public static void FindNatvis(NatvisLoader loader)
3637
{
3738
List<string> paths = new List<string>();
3839
try
3940
{
40-
ThreadHelper.JoinableTaskFactory.Run(async () =>
41-
await Internal.FindNatvisInSolutionImplAsync(paths)
42-
);
41+
ThreadHelper.JoinableTaskFactory.Run(async () => {
42+
await Internal.FindNatvisInSolutionImplAsync(paths);
43+
Internal.FindNatvisInVSIXImpl(paths);
44+
});
4345
}
4446
catch (Exception)
4547
{
@@ -193,6 +195,17 @@ public async static System.Threading.Tasks.Task FindNatvisInSolutionImplAsync(Li
193195
}
194196
}
195197

198+
public static void FindNatvisInVSIXImpl(List<string> paths)
199+
{
200+
var extManager = (IVsExtensionManagerPrivate)Package.GetGlobalService(typeof(SVsExtensionManager));
201+
if (extManager == null)
202+
{
203+
return; // failed to find the extension manager
204+
}
205+
206+
BuildEnvironmentPath("NativeCrossPlatformVisualizer", extManager, paths);
207+
}
208+
196209
public static string FindSolutionRootImpl()
197210
{
198211
string root = null;
@@ -207,6 +220,23 @@ public static string FindSolutionRootImpl()
207220
return root;
208221
}
209222

223+
private static void BuildEnvironmentPath(string name, IVsExtensionManagerPrivate pem, List<string> paths)
224+
{
225+
pem.GetEnabledExtensionContentLocations(name, 0, null, null, out var contentLocations);
226+
if (contentLocations > 0)
227+
{
228+
var rgStrings = new string[contentLocations];
229+
var rgbstrContentLocations = new string[contentLocations];
230+
var rgbstrUniqueStrings = new string[contentLocations];
231+
232+
var hr = pem.GetEnabledExtensionContentLocations(name, contentLocations, rgbstrContentLocations, rgbstrUniqueStrings, out var actualContentLocations);
233+
if (hr == VSConstants.S_OK && actualContentLocations > 0)
234+
{
235+
paths.AddRange(rgbstrContentLocations);
236+
}
237+
}
238+
}
239+
210240
private static void LoadNatvisFromProject(IVsHierarchy hier, List<string> paths, bool solutionLevel)
211241
{
212242
IVsProject4 proj = hier as IVsProject4;

src/MICore/Debugger.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,10 +1253,10 @@ public void ProcessStdOutLine(string line)
12531253
{
12541254
WaitingOperationDescriptor waitingOperation;
12551255
if (_waitingOperations.TryGetValue(id, out waitingOperation) &&
1256-
!waitingOperation.EchoReceived &&
12571256
line == waitingOperation.Command)
12581257
{
12591258
// This is just the echo. Ignore.
1259+
// Sometimes with lldb we are seeing 2 command echos
12601260
waitingOperation.EchoReceived = true;
12611261
return;
12621262
}
@@ -1267,6 +1267,7 @@ public void ProcessStdOutLine(string line)
12671267
switch (c)
12681268
{
12691269
case '~':
1270+
case '@':
12701271
OnDebuggeeOutput(noprefix); // Console stream
12711272
break;
12721273
case '^':

src/MICore/Transports/PipeTransport.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ private void KillPipeProcessAndChildren(Process p)
158158

159159
public override void Close()
160160
{
161+
if (_process != null)
162+
{
163+
_process.EnableRaisingEvents = false;
164+
_process.Exited -= OnProcessExit;
165+
}
166+
161167
if (_writer != null)
162168
{
163169
try
@@ -168,6 +174,15 @@ public override void Close()
168174
{
169175
// Ignore errors if logout couldn't be written
170176
}
177+
178+
try
179+
{
180+
_writer?.Close();
181+
}
182+
catch (IOException)
183+
{
184+
// There are IO Issues with the writer, ignore since its shutting down.
185+
}
171186
}
172187

173188
base.Close();
@@ -181,8 +196,6 @@ public override void Close()
181196

182197
if (_process != null)
183198
{
184-
_process.EnableRaisingEvents = false;
185-
_process.Exited -= OnProcessExit;
186199
if (_killOnClose && !_process.HasExited)
187200
{
188201
try

0 commit comments

Comments
 (0)