Skip to content

Commit a034bbd

Browse files
authored
Merge pull request #1339 from microsoft/main
Merge 'main' into 'release-cpptools'
2 parents b4bbd66 + 802aa14 commit a034bbd

File tree

10 files changed

+244
-54
lines changed

10 files changed

+244
-54
lines changed

build/package_versions.settings.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
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>
3535
<Microsoft_VisualStudio_TextManager_Interop_Version>17.0.0-previews-1-31410-258</Microsoft_VisualStudio_TextManager_Interop_Version>
36-
<Microsoft_VSSDK_BuildTools_Version>17.0.1600</Microsoft_VSSDK_BuildTools_Version>
36+
<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>
3939
</Project>

build/version.settings.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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>1</MinorVersion>
6+
<MinorVersion>4</MinorVersion>
77
<VersionZeroYear>2020</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 -->

src/MIDebugEngine/Engine.Impl/Variables.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,13 @@ private string StripFormatSpecifier(string exp, out string formatSpecifier)
431431
// TODO: could return '(T(*)[n])(exp)' but requires T
432432
var m = Regex.Match(trimmed, @"^\[?(\d+)\]?$");
433433
if (m.Success)
434+
{
435+
if (_engine.DebuggedProcess.MICommandFactory.Mode == MIMode.Gdb)
436+
return "*" + exp.Substring(0, lastComma) + "@" + trimmed; // this does not work for lldb
437+
434438
return exp.Substring(0, lastComma);
439+
}
440+
435441

436442
// array with dynamic size
437443
if (Regex.Match(trimmed, @"^\[([a-zA-Z_][a-zA-Z_\d]*)\]$").Success)
@@ -518,13 +524,8 @@ internal async Task Eval(uint radix, enum_EVALFLAGS dwFlags = 0, DAPEvalFlags dw
518524
string consoleResults = null;
519525

520526
consoleResults = await MIDebugCommandDispatcher.ExecuteCommand(consoleCommand, _debuggedProcess, ignoreFailures: true);
521-
Value = String.Empty;
527+
Value = consoleResults;
522528
this.TypeName = null;
523-
524-
if (!String.IsNullOrEmpty(consoleResults))
525-
{
526-
_debuggedProcess.WriteOutput(consoleResults);
527-
}
528529
}
529530
else
530531
{

src/MIDebugEngine/Natvis.Impl/Natvis.cs

Lines changed: 169 additions & 31 deletions
Large diffs are not rendered by default.

src/MIDebugEngine/ResourceStrings.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MIDebugEngine/ResourceStrings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@
156156
<data name="ModuleLoadedWithSymbols" xml:space="preserve">
157157
<value>Symbols loaded.</value>
158158
</data>
159+
<data name="MoreView" xml:space="preserve">
160+
<value>[More...]</value>
161+
</data>
159162
<data name="SymbolsLoadedInfo" xml:space="preserve">
160163
<value>Symbols loaded - {0}</value>
161164
</data>

src/OpenDebugAD7/AD7DebugSession.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ private void StepInternal(int threadId, enum_STEPKIND stepKind, SteppingGranular
811811
}
812812
}
813813

814-
BeforeContinue();
815814
ErrorBuilder builder = new ErrorBuilder(() => errorMessage);
816815
m_isStepping = true;
817816

@@ -837,6 +836,9 @@ private void StepInternal(int threadId, enum_STEPKIND stepKind, SteppingGranular
837836
m_isStopped = true;
838837
throw;
839838
}
839+
// The program should now be stepping, so it is safe to discard the
840+
// cached program state.
841+
BeforeContinue();
840842
}
841843

842844
private enum ClientId

test/CppTests/Tests/NatvisTests.cs

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@ public void TestIndexListItems(ITestSettings settings)
118118

119119
this.Comment("Verifying IndexListItems natvis");
120120
var arr = currentFrame.GetVariable("arr");
121-
Assert.Equal("{ size=15 }", arr.Value);
121+
Assert.Equal("{ size=52 }", arr.Value);
122122

123123
// Index element for IndexListItems
124124
// Natvis retrieves items in reverse order.
125-
Assert.Equal("196", arr.GetVariable("[0]").Value);
126-
Assert.Equal("16", arr.GetVariable("[10]").Value);
127-
Assert.Equal("0", arr.GetVariable("[14]").Value);
128-
// TODO: Add test below when we can support the [More..] expansion to handle >50 elements
125+
Assert.Equal("2601", arr.GetVariable("[0]").Value);
126+
Assert.Equal("1681", arr.GetVariable("[10]").Value);
127+
Assert.Equal("0", arr.GetVariable("[More...]").GetVariable("[51]").Value);
129128
}
130129

131130
runner.Expects.ExitedEvent(exitCode: 0).TerminatedEvent().AfterContinue();
@@ -168,14 +167,14 @@ public void TestArrayItems(ITestSettings settings)
168167

169168
this.Comment("Verifying ArrayItems natvis");
170169
var ll = currentFrame.GetVariable("vec");
171-
Assert.Equal("{ size=10 }", ll.Value);
170+
Assert.Equal("{ size=52 }", ll.Value);
172171

173172
// Custom Item in natvis
174-
Assert.Equal("10", ll.GetVariable("Size").Value);
173+
Assert.Equal("52", ll.GetVariable("Size").Value);
175174

176175
// Index element for ArrayItems
177176
Assert.Equal("20", ll.GetVariable("[5]").Value);
178-
// TODO: Add test below when we can support the [More..] expansion to handle >50 elements
177+
Assert.Equal("0", ll.GetVariable("[More...]").GetVariable("[51]").Value);
179178
}
180179

181180
runner.Expects.ExitedEvent(exitCode: 0).TerminatedEvent().AfterContinue();
@@ -220,8 +219,7 @@ public void TestLinkedListItems(ITestSettings settings)
220219

221220
// Index element for LinkedListItems
222221
Assert.Equal("5", ll.GetVariable("[5]").Value);
223-
// TODO: Uncomment line below when we can support the [More..] expansion to handle >50 elements
224-
// Assert.Equal("75", ll.GetVariable("[More...]").GetVariable("[75]").Value);
222+
Assert.Equal("75", ll.GetVariable("[More...]").GetVariable("[75]").Value);
225223
}
226224

227225
runner.Expects.ExitedEvent(exitCode: 0).TerminatedEvent().AfterContinue();
@@ -330,6 +328,45 @@ public void TestThisConditional(ITestSettings settings)
330328
}
331329
}
332330

331+
[Theory]
332+
[DependsOnTest(nameof(CompileNatvisDebuggee))]
333+
[RequiresTestSettings]
334+
// Disable on macOS
335+
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
336+
public void TestArrayPointer(ITestSettings settings)
337+
{
338+
this.TestPurpose("This test checks if the comma format specifier is visualized.");
339+
this.WriteSettings(settings);
340+
341+
IDebuggee debuggee = Debuggee.Open(this, settings.CompilerSettings, NatvisName, DebuggeeMonikers.Natvis.Default);
342+
343+
this.Comment("Run the debuggee, check argument count");
344+
using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings))
345+
{
346+
this.Comment("Configure launch");
347+
LaunchCommand launch = new LaunchCommand(settings.DebuggerSettings, debuggee.OutputPath);
348+
runner.RunCommand(launch);
349+
350+
this.Comment("Set Breakpoint");
351+
SourceBreakpoints writerBreakpoints = debuggee.Breakpoints(NatvisSourceName, ReturnSourceLine);
352+
runner.SetBreakpoints(writerBreakpoints);
353+
354+
runner.Expects.StoppedEvent(StoppedReason.Breakpoint).AfterConfigurationDone();
355+
356+
using (IThreadInspector threadInspector = runner.GetThreadInspector())
357+
{
358+
IFrameInspector currentFrame = threadInspector.Stack.First();
359+
360+
this.Comment("Verifying comma format specifier");
361+
int[] expected = { 0, 1, 4, 9 };
362+
currentFrame.AssertEvaluateAsIntArray("arr._array,4", EvaluateContext.Watch, expected);
363+
}
364+
365+
runner.Expects.ExitedEvent(exitCode: 0).TerminatedEvent().AfterContinue();
366+
runner.DisconnectAndVerify();
367+
}
368+
}
369+
333370
#endregion
334371
}
335372
}

test/CppTests/debuggees/natvis/src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int main(int argc, char** argv)
1414
{
1515
SimpleDisplayObject obj_1;
1616

17-
SimpleVector vec(10);
17+
SimpleVector vec(52);
1818
vec.Set(5, 20);
1919

2020
SimpleLinkedList ll;
@@ -32,8 +32,8 @@ int main(int argc, char** argv)
3232
map.Insert(4);
3333
map.Insert(-72);
3434

35-
SimpleArray arr(15);
36-
for (int i = 0 ; i < 15; i++)
35+
SimpleArray arr(52);
36+
for (int i = 0 ; i < 52; i++)
3737
{
3838
arr[i] = i * i;
3939
}

test/DebugAdapterRunner/DebugAdapterRunner.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<releaseNotes>https://go.microsoft.com/fwlink/?LinkID=746387</releaseNotes>
1515
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
1616
<dependencies>
17-
<dependency id="Newtonsoft.Json" version="12.0.2" />
17+
<dependency id="Newtonsoft.Json" version="13.0.1" />
1818
</dependencies>
1919
</metadata>
2020
<files>

0 commit comments

Comments
 (0)