Skip to content

Commit e5817eb

Browse files
Merge branch 'main' into bugfix/natvis-template-constant
2 parents 35576ad + 43011de commit e5817eb

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

src/MIDebugEngine/Natvis.Impl/Natvis.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,9 @@ private IVariableInformation[] ExpandVisualized(IVariableInformation variable)
646646
{
647647
continue;
648648
}
649-
// Creates an expression: (T[50])*(<ValuePointer> + 50)
650-
// This evaluates for 50 elements of type T, starting at <ValuePointer> with an offet of 50 elements.
649+
650+
// Creates a dereferenced pointer-to-array expression: (*(T(*)[50])(ValuePointer + 50))
651+
// This evaluates for 50 elements of type T, starting at <ValuePointer> with an offset of 50 elements.
651652
// E.g. This will grab elements 50 - 99 from <ValuePointer>.
652653
// Note:
653654
// If requestedSize > 1000, the evaluation will only grab the first 1000 elements.
@@ -656,15 +657,15 @@ private IVariableInformation[] ExpandVisualized(IVariableInformation variable)
656657
uint requestedSize = Math.Min(MAX_EXPAND, totalSize - startIndex);
657658

658659
StringBuilder arrayBuilder = new StringBuilder();
659-
arrayBuilder.Append('(');
660+
arrayBuilder.Append("(*(");
660661
arrayBuilder.Append(typename);
661-
arrayBuilder.Append('[');
662+
arrayBuilder.Append("(*)[");
662663
arrayBuilder.Append(requestedSize);
663-
arrayBuilder.Append("])*(");
664+
arrayBuilder.Append("])(");
664665
arrayBuilder.Append(vp.Value);
665666
arrayBuilder.Append('+');
666667
arrayBuilder.Append(startIndex);
667-
arrayBuilder.Append(')');
668+
arrayBuilder.Append("))");
668669
string arrayStr = arrayBuilder.ToString();
669670

670671
IVariableInformation arrayExpr = GetExpression(arrayStr, variable, visualizer.ScopedNames);

test/CppTests/Tests/NatvisTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ public void TestIndexListItems(ITestSettings settings)
138138
[Theory]
139139
[DependsOnTest(nameof(CompileNatvisDebuggee))]
140140
[RequiresTestSettings]
141-
// Disable on macOS
142-
// Error:
143-
// C-style cast from 'int' to 'int [10]' is not allowed
144-
// (int[10])*(((vec)._start))
145-
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
146141
public void TestArrayItems(ITestSettings settings)
147142
{
148143
this.TestPurpose("This test checks if ArrayItems are visualized.");
@@ -193,11 +188,6 @@ public void TestArrayItems(ITestSettings settings)
193188
[Theory]
194189
[DependsOnTest(nameof(CompileNatvisDebuggee))]
195190
[RequiresTestSettings]
196-
// Disable on macOS
197-
// Error:
198-
// C-style cast from 'int' to 'int [10]' is not allowed
199-
// (int[10])*(((vec)._start))
200-
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
201191
public void Test2000ArrayItems(ITestSettings settings)
202192
{
203193
this.TestPurpose("This test checks if ArrayItems can be visualized past 1000 elements.");
@@ -484,11 +474,6 @@ public void TestCommaFormatWithSquareBrackets(ITestSettings settings)
484474
[Theory]
485475
[DependsOnTest(nameof(CompileNatvisDebuggee))]
486476
[RequiresTestSettings]
487-
// Disable on macOS
488-
// Error:
489-
// C-style cast from 'int' to 'int [10]' is not allowed
490-
// (int[10])*(((vec)._start))
491-
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
492477
public void TestMultipleNatvisFiles(ITestSettings settings)
493478
{
494479
this.TestPurpose("This test checks if multiple Natvis files can be used.");

0 commit comments

Comments
 (0)