public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); childValues = new int[] { 20, 21, 22, 23, 24 }; remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", childValues); ulong elementSize = 4; var pointeeType = new SbTypeStub("int", TypeFlags.IS_INTEGER); pointeeType.SetByteSize(elementSize); var pointerType = new SbTypeStub("int*", TypeFlags.IS_POINTER, pointeeType); ulong address = 1234; pointerValue = RemoteValueFakeUtil.CreatePointer("int*", "myPtr", $"{address}"); pointerValue.SetTypeInfo(pointerType); for (uint i = 0; i < 5; i++) { pointerValue.SetCreateValueFromAddress( address + i * elementSize, RemoteValueFakeUtil.CreateSimpleInt($"[{i}]", (int)(i) + 20)); } }
public async Task ExpandFormatSpecifierOutOfRangeAsync() { int[] childValues = { 0, 1, 2, 3, 4 }; var remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("arr", childValues); var varInfo = CreateVarInfo(remoteValue, "expand(6)"); Assert.That(varInfo.Error, Is.EqualTo(true)); Assert.That(await varInfo.ValueAsync(), Is.EqualTo("<out-of-bounds child index in 'expand()' format specifier>")); }
public async Task ExpandFormatSpecifierAsync() { int[] childValues = { 0, 1, 2, 3, 4 }; var remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("arr", childValues); var varInfo = CreateVarInfo(remoteValue, "expand(3)"); Assert.That(_logSpy.GetOutput(), Does.Not.Contain("ERROR")); Assert.That(_logSpy.GetOutput(), Does.Not.Contain("WARNING")); Assert.That(await varInfo.ValueAsync(), Is.EqualTo("3")); }
public async Task IndexerAccessAsync() { RemoteValueFake remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", 3, 4, 5, 6); IVariableInformation varInfo = _varInfoFactory.Create(remoteValue); IVariableInformation exprVarInfo = await _evaluator.EvaluateExpressionAsync("[3]", varInfo, new NatvisScope(), null); Assert.That(exprVarInfo.DisplayName, Is.EqualTo("[3]")); Assert.That(await exprVarInfo.ValueAsync(), Is.EqualTo("6")); }
void SetupRegisters() { var registerSet1 = RemoteValueFakeUtil.CreateSimpleIntArray( "General Purpose Registers", 0x01, 0x02); var registerSet2 = RemoteValueFakeUtil.CreateSimpleArray( "Floating Point Registers", "Register Set", (_, value) => new RemoteValueFake($"xmm{value}", "0x00"), 0, 1); _mockRemoteFrame.GetRegisters().Returns( new List <RemoteValue> { registerSet1, registerSet2 }); }
public async Task Build_ArrayLimitsOutputSizeAsync() { const int size = 100; _childValues = Enumerable.Range(0, size - 1).ToArray(); _remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", _childValues); IVariableInformation varInfo = CreateVarInfo(_remoteValue, size.ToString()); string result = await ValueStringBuilder.BuildAsync(varInfo); Assert.That( result, Is.EqualTo( "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20," + " 21, ...}")); }
public async Task IndexerAccessWithTokenReplacementAsync() { RemoteValueFake remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", 3, 4, 5, 6); var natvisScope = new NatvisScope(); natvisScope.AddScopedName("$i", "2"); IVariableInformation varInfo = _varInfoFactory.Create(remoteValue); IVariableInformation exprVarInfo = await _evaluator.EvaluateExpressionAsync("[$i]", varInfo, natvisScope, null); Assert.That(exprVarInfo.DisplayName, Is.EqualTo("[2]")); Assert.That(await exprVarInfo.ValueAsync(), Is.EqualTo("5")); }
public async Task ExpandFormatSpecifierReturnsChildAsync() { int[] grandChildValues = { 0, 1 }; var child = RemoteValueFakeUtil.CreateSimpleIntArray("arr", grandChildValues); var remoteValue = RemoteValueFakeUtil.CreatePointer("int**", "ptr", _memAddress1); remoteValue.AddChild(child); var varInfo = CreateVarInfo(remoteValue, "expand(0)"); var children = await varInfo.GetAllChildrenAsync(); Assert.That(_logSpy.GetOutput(), Does.Not.Contain("ERROR")); Assert.That(_logSpy.GetOutput(), Does.Not.Contain("WARNING")); Assert.That(children.Length, Is.EqualTo(2)); Assert.That(await children[0].ValueAsync(), Is.EqualTo("0")); Assert.That(await children[1].ValueAsync(), Is.EqualTo("1")); }
public void SetUp() { _compRoot = new MediumTestDebugEngineFactoryCompRoot(new JoinableTaskContext()); _childValues = new int[] { 20, 21, 22, 23, 24 }; _remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", _childValues); ulong elementSize = 4; var pointeeType = new SbTypeStub("int", TypeFlags.IS_INTEGER); pointeeType.SetByteSize(elementSize); var pointerType = new SbTypeStub("int*", TypeFlags.IS_POINTER, pointeeType); _pointerValue = RemoteValueFakeUtil.CreatePointer("int*", "myPtr", $"{_pointerAddress}"); _pointerValue.SetTypeInfo(pointerType); for (uint i = 0; i < 5; i++) { _pointerValue.SetCreateValueFromAddress( _pointerAddress + i * elementSize, RemoteValueFakeUtil.CreateSimpleInt($"[{i}]", (int)(i) + 20)); } }