Skip to content

Commit ec430af

Browse files
authored
Merge pull request #1434 from microsoft/main
Merge main into release-cpptools
2 parents a293696 + 4017519 commit ec430af

34 files changed

+531
-293
lines changed

build/package_versions.settings.targets

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
33
<Microsoft_VisualStudio_Debugger_Interop_Portable_Version>1.0.1</Microsoft_VisualStudio_Debugger_Interop_Portable_Version>
4-
<Microsoft_VisualStudio_Interop_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Interop_Version>
5-
<Newtonsoft_Json_Version>13.0.1</Newtonsoft_Json_Version>
4+
<Microsoft_VisualStudio_Interop_Version>17.8.37221</Microsoft_VisualStudio_Interop_Version>
5+
<Newtonsoft_Json_Version>13.0.3</Newtonsoft_Json_Version>
66
<Microsoft_VisualStudio_Shared_VSCodeDebugProtocol_Version>17.2.60629.1</Microsoft_VisualStudio_Shared_VSCodeDebugProtocol_Version>
77

88
<!-- Test Packages -->
@@ -19,20 +19,20 @@
1919
<PropertyGroup>
2020
<Microsoft_VisualStudio_ComponentModelHost_Version>17.0.28-g439d20ddd3</Microsoft_VisualStudio_ComponentModelHost_Version>
2121
<Microsoft_VisualStudio_Debugger_Engine_Version>17.0.1051901-preview</Microsoft_VisualStudio_Debugger_Engine_Version>
22-
<Microsoft_VisualStudio_Debugger_Interop_10_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_Interop_10_0_Version>
23-
<Microsoft_VisualStudio_Debugger_Interop_11_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_Interop_11_0_Version>
24-
<Microsoft_VisualStudio_Debugger_Interop_12_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_Interop_12_0_Version>
25-
<Microsoft_VisualStudio_Debugger_Interop_15_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_Interop_15_0_Version>
26-
<Microsoft_VisualStudio_Debugger_Interop_16_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_Interop_16_0_Version>
27-
<Microsoft_VisualStudio_Debugger_InteropA_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Debugger_InteropA_Version>
28-
<Microsoft_VisualStudio_Shell_15_0_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Shell_15_0_Version>
29-
<Microsoft_VisualStudio_Shell_Framework_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Shell_Framework_Version>
30-
<Microsoft_VisualStudio_Threading_Version>17.0.17-alpha</Microsoft_VisualStudio_Threading_Version>
31-
<Microsoft_VisualStudio_Utilities_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_Utilities_Version>
22+
<Microsoft_VisualStudio_Debugger_Interop_10_0_Version>17.5.33428.388</Microsoft_VisualStudio_Debugger_Interop_10_0_Version>
23+
<Microsoft_VisualStudio_Debugger_Interop_11_0_Version>17.5.33428.366</Microsoft_VisualStudio_Debugger_Interop_11_0_Version>
24+
<Microsoft_VisualStudio_Debugger_Interop_12_0_Version>17.5.33428.366</Microsoft_VisualStudio_Debugger_Interop_12_0_Version>
25+
<Microsoft_VisualStudio_Debugger_Interop_15_0_Version>17.5.33428.366</Microsoft_VisualStudio_Debugger_Interop_15_0_Version>
26+
<Microsoft_VisualStudio_Debugger_Interop_16_0_Version>17.5.33428.366</Microsoft_VisualStudio_Debugger_Interop_16_0_Version>
27+
<Microsoft_VisualStudio_Debugger_InteropA_Version>17.5.33428.366</Microsoft_VisualStudio_Debugger_InteropA_Version>
28+
<Microsoft_VisualStudio_Shell_15_0_Version>17.8.37221</Microsoft_VisualStudio_Shell_15_0_Version>
29+
<Microsoft_VisualStudio_Shell_Framework_Version>17.8.37221</Microsoft_VisualStudio_Shell_Framework_Version>
30+
<Microsoft_VisualStudio_Threading_Version>17.8.14</Microsoft_VisualStudio_Threading_Version>
31+
<Microsoft_VisualStudio_Utilities_Version>17.8.37221</Microsoft_VisualStudio_Utilities_Version>
3232
<Microsoft_VisualStudio_Shell_Interop_15_0_DesignTime_Version>15.0.26932</Microsoft_VisualStudio_Shell_Interop_15_0_DesignTime_Version>
3333
<Microsoft_VisualStudio_Workspace_Version>15.0.392</Microsoft_VisualStudio_Workspace_Version>
3434
<Microsoft_VisualStudio_Workspace_VSIntegration_Version>15.0.392</Microsoft_VisualStudio_Workspace_VSIntegration_Version>
35-
<Microsoft_VisualStudio_TextManager_Interop_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_TextManager_Interop_Version>
35+
<Microsoft_VisualStudio_TextManager_Interop_Version>17.8.37221</Microsoft_VisualStudio_TextManager_Interop_Version>
3636
<Microsoft_VSSDK_BuildTools_Version>17.3.2093</Microsoft_VSSDK_BuildTools_Version>
3737
<System_Runtime_Loader_Version>4.3.0</System_Runtime_Loader_Version>
3838
</PropertyGroup>

build/version.settings.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<!--SxS: These three properties should be changed at the start of a new version, VersionZeroYear should be the year
44
before the start of the project.-->
55
<MajorVersion>17</MajorVersion>
6-
<MinorVersion>4</MinorVersion>
7-
<VersionZeroYear>2020</VersionZeroYear>
6+
<MinorVersion>8</MinorVersion>
7+
<VersionZeroYear>2022</VersionZeroYear>
88
<!-- Note: for compatibility, we leave the default assembly version of the repo at 14.0.
99
If we ever decide to change this, make sure that you notify partner teams such as C++ IOT -->
1010
<AssemblyVersion Condition="'$(AssemblyVersion)'==''">14.0.0.0</AssemblyVersion>

src/DebugEngineHost/DebugEngineHost.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@
8888
<IncludeAssets>compile</IncludeAssets>
8989
<PrivateAssets>all</PrivateAssets>
9090
</PackageReference>
91-
92-
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="17.0.16-alpha" />
9391
</ItemGroup>
9492

9593
<ItemGroup Label="Assembly to Generate">

src/DebugEngineHost/HostLogger.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public static ILogChannel GetNatvisLogChannel()
5454

5555
public static void Reset()
5656
{
57+
s_natvisLogChannel?.Close();
5758
s_natvisLogChannel = null;
59+
s_engineLogChannel?.Close();
5860
s_engineLogChannel = null;
5961
}
6062
}

src/MICore/LaunchOptions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public static ReadOnlyCollection<SourceMapEntry> CreateCollection(Xml.LaunchOpti
370370

371371
public static ReadOnlyCollection<SourceMapEntry> CreateCollection(Dictionary<string, object> source)
372372
{
373-
IList<SourceMapEntry> sourceMaps = new List<SourceMapEntry>(source.Keys.Count);
373+
var sourceMaps = new List<SourceMapEntry>(source.Keys.Count);
374374

375375
foreach (var item in source)
376376
{
@@ -416,6 +416,11 @@ public static ReadOnlyCollection<SourceMapEntry> CreateCollection(Dictionary<str
416416
throw new InvalidLaunchOptionsException(String.Format(CultureInfo.CurrentCulture, MICoreResources.Error_SourceFileMapInvalidEditorPath));
417417
}
418418
}
419+
420+
// Ensure the map is sorted such that more specific directories are in front of less specific by sorting the map
421+
// in descending order of the compile time path
422+
sourceMaps.Sort((x, y) => string.CompareOrdinal(y.CompileTimePath, x.CompileTimePath));
423+
419424
return new ReadOnlyCollection<SourceMapEntry>(sourceMaps);
420425
}
421426
}

src/MICore/Logger.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static void Reset()
9797
{
9898
HostLogger.Reset();
9999
s_isEnabled = false;
100+
s_isInitialized = false;
100101
}
101102
}
102103

src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs

100644100755
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ public int GetCodeContext(ulong uCodeLocationId, out IDebugCodeContext2 ppCodeCo
3434
public int GetCodeLocationId(IDebugCodeContext2 pCodeContext, out ulong puCodeLocationId)
3535
{
3636
AD7MemoryAddress addr = pCodeContext as AD7MemoryAddress;
37-
puCodeLocationId = addr.Address;
38-
return Constants.S_OK;
37+
if (addr != null)
38+
{
39+
puCodeLocationId = addr.Address;
40+
return Constants.S_OK;
41+
}
42+
43+
puCodeLocationId = 0;
44+
return Constants.E_FAIL;
3945
}
4046

4147
public int GetCurrentLocation(out ulong puCodeLocationId)

src/MIDebugEngine/AD7.Impl/AD7Engine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public int Attach(IDebugProgram2[] portProgramArray, IDebugProgramNode2[] progra
189189
{
190190
Debug.Assert(_ad7ProgramId == Guid.Empty);
191191

192-
Logger.LoadMIDebugLogger();
192+
Logger.EnsureInitialized();
193193

194194
if (celtPrograms != 1)
195195
{
@@ -539,7 +539,7 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri
539539
Debug.Assert(_ad7ProgramId == Guid.Empty);
540540

541541
// Check if the logger was enabled late.
542-
Logger.LoadMIDebugLogger();
542+
Logger.EnsureInitialized();
543543

544544
process = null;
545545

src/MIDebugEngine/AD7.Impl/AD7Property.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,37 @@ public int GetMemoryContext(out IDebugMemoryContext2 ppMemory)
229229
{
230230
return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
231231
}
232-
v = v.Trim();
232+
233+
if ((v[0] == '[') && (v[v.Length-1] == ']'))
234+
{
235+
// this is an array evaluation result from GDB, which does not contain an address
236+
// VS on the other hand supports direct array evaluations without address operator
237+
// therefore we need to re-evaluate with an address operator
238+
//
239+
VariableInformation viArray = new VariableInformation("&(" + _variableInformation.FullName() + ")", (VariableInformation)_variableInformation);
240+
viArray.SyncEval();
241+
if (viArray.Error)
242+
{
243+
return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
244+
}
245+
v = viArray.Value;
246+
v.Trim();
247+
if (v.Length == 0)
248+
{
249+
return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
250+
}
251+
}
252+
233253
if (v[0] == '{')
234254
{
255+
var index = v.IndexOf('}');
256+
if (index == -1)
257+
{
258+
// syntax error!
259+
return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
260+
}
235261
// strip type name and trailing spaces
236-
v = v.Substring(v.IndexOf('}') + 1);
262+
v = v.Substring(index+1);
237263
v = v.Trim();
238264
}
239265
int i = v.IndexOf(' ');

src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -690,17 +690,11 @@ private async Task<List<LaunchCommand>> GetInitializeCommands()
690690
LocalLaunchOptions localLaunchOptions = _launchOptions as LocalLaunchOptions;
691691
if (this.IsCoreDump)
692692
{
693-
// Add executable information
694-
this.AddExecutablePathCommand(commands);
693+
// Load executable and core dump
694+
this.AddExecutableAndCorePathCommand(commands);
695695

696-
// Important: this must occur after file-exec-and-symbols but before anything else.
696+
// Important: this must occur after executable load but before anything else.
697697
this.AddGetTargetArchitectureCommand(commands);
698-
699-
// Add core dump information (linux/mac does not support quotes around this path but spaces in the path do work)
700-
string coreDump = this.UseUnixPathSeparators ? _launchOptions.CoreDumpPath : this.EnsureProperPathSeparators(_launchOptions.CoreDumpPath, true);
701-
string coreDumpCommand = _launchOptions.DebuggerMIMode == MIMode.Lldb ? String.Concat("target create --core ", coreDump) : String.Concat("-target-select core ", coreDump);
702-
string coreDumpDescription = String.Format(CultureInfo.CurrentCulture, ResourceStrings.LoadingCoreDumpMessage, _launchOptions.CoreDumpPath);
703-
commands.Add(new LaunchCommand(coreDumpCommand, coreDumpDescription, ignoreFailures: false));
704698
}
705699
else if (_launchOptions.ProcessId.HasValue)
706700
{
@@ -918,6 +912,30 @@ private void AddExecutablePathCommand(IList<LaunchCommand> commands)
918912
commands.Add(new LaunchCommand("-file-exec-and-symbols " + exe, description, ignoreFailures: false, failureHandler: failureHandler));
919913
}
920914

915+
private void AddExecutableAndCorePathCommand(IList<LaunchCommand> commands)
916+
{
917+
string command;
918+
if (_launchOptions.DebuggerMIMode == MIMode.Lldb)
919+
{
920+
// LLDB requires loading the executable and the core into the same target, using one command. Quotes in the path are supported.
921+
string exePath = this.EnsureProperPathSeparators(_launchOptions.ExePath, true);
922+
string corePath = this.EnsureProperPathSeparators(_launchOptions.CoreDumpPath, true);
923+
command = String.Concat("file ", exePath, " -c ", corePath);
924+
}
925+
else
926+
{
927+
// GDB requires loading the executable and core separately.
928+
// Note: Linux/mac do not support quotes around this path, but spaces in the path do work.
929+
this.AddExecutablePathCommand(commands);
930+
string corePathNoQuotes = this.EnsureProperPathSeparators(_launchOptions.CoreDumpPath, true, true);
931+
command = String.Concat("-target-select core ", corePathNoQuotes);
932+
}
933+
934+
// Load core dump information
935+
string description = String.Format(CultureInfo.CurrentCulture, ResourceStrings.LoadingCoreDumpMessage, _launchOptions.CoreDumpPath);
936+
commands.Add(new LaunchCommand(command, description, ignoreFailures: false));
937+
}
938+
921939
private void DetermineAndAddExecutablePathCommand(IList<LaunchCommand> commands, UnixShellPortLaunchOptions launchOptions)
922940
{
923941
// TODO: connecting to OSX via SSH doesn't work yet. Show error after connection manager dialog gets dismissed.

0 commit comments

Comments
 (0)