Exemplo n.º 1
0
        static IEnumerable <RemoteValue> GetRemoteValueChildren(RemoteValue remoteValue, int offset,
                                                                int count)
        {
            var  result      = new List <RemoteValue>();
            uint childOffset = (uint)offset;
            uint endIndex    = (uint)(offset + count);
            uint numChildren = remoteValue.GetNumChildren();

            while (childOffset < endIndex)
            {
                // Fetch children in batches for performance reasons.
                uint batchSize = System.Math.Min(endIndex - childOffset, _maxChildBatchSize);
                List <RemoteValue> currentBatch = remoteValue.GetChildren(childOffset, batchSize);

                for (int n = 0; n < batchSize; ++n)
                {
                    RemoteValue childValue = currentBatch[n];
                    if (childValue != null)
                    {
                        result.Add(childValue);
                    }
                    else if (n + childOffset < numChildren)
                    {
                        // There were times when LLDB was returning an error and thus a null child
                        // value. ex: Children[1] for a CustomType&* type.
                        Trace.WriteLine(
                            $"WARNING: No child found at index {n + childOffset} of " +
                            $"({remoteValue.GetTypeName()}){remoteValue.GetFullName()} even " +
                            $"though there are {numChildren} children.");
                    }
                }
                childOffset += batchSize;
            }
            return(result);
        }
Exemplo n.º 2
0
        private GrpcValueInfo CreateValueInfoAndUpdateStores(RemoteValue remoteValue)
        {
            if (remoteValue == null)
            {
                return(null);
            }

            string expressionPath;
            var    hasExpressionPath = remoteValue.GetExpressionPath(out expressionPath);
            var    valueInfo         = new GrpcValueInfo
            {
                ExpressionPath    = expressionPath ?? "",
                HasExpressionPath = hasExpressionPath,
                NumChildren       = remoteValue.GetNumChildren(),
                Summary           = remoteValue.GetSummary() ?? "",
                TypeName          = remoteValue.GetTypeName() ?? "",
                Value             = remoteValue.GetValue() ?? "",
                ValueType         = EnumUtil.ConvertTo <Debugger.Common.ValueType>(
                    remoteValue.GetValueType()),
                IsPointerType = remoteValue.TypeIsPointerType(),
                ByteSize      = remoteValue.GetByteSize(),
            };
            var typeInfo = remoteValue.GetTypeInfo();

            if (typeInfo != null)
            {
                valueInfo.Type = GrpcFactoryUtils.CreateType(
                    typeInfo, typeStore.AddObject(typeInfo));
            }
            return(valueInfo);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            mockFrame = Substitute.For <RemoteFrame>();

            var childAdapterFactory = new RemoteValueChildAdapter.Factory();
            var varInfoFactory      = new LLDBVariableInformationFactory(childAdapterFactory);
            var varInfoBuilder      = new VarInfoBuilder(varInfoFactory);

            varInfoFactory.SetVarInfoBuilder(varInfoBuilder);
            var registerSetsBuilderFactory = new RegisterSetsBuilder.Factory(varInfoFactory);

            registerSetsBuilder = registerSetsBuilderFactory.Create(mockFrame);

            generalPurposeRegisters = Substitute.For <RemoteValue>();
            generalPurposeRegisters.GetName().Returns("General Purpose Registers");
            generalPurposeRegisters.GetNumChildren().Returns(0u);

            floatingPointRegisters = Substitute.For <RemoteValue>();
            floatingPointRegisters.GetName().Returns("Floating Point Registers");
            floatingPointRegisters.GetNumChildren().Returns(3u);
            xmm0 = Substitute.For <RemoteValue>();
            xmm0.GetName().Returns("xmm0");
            xmm8 = Substitute.For <RemoteValue>();
            xmm8.GetName().Returns("xmm8");
            other = Substitute.For <RemoteValue>();
            other.GetName().Returns("other");
            floatingPointRegisters.GetChildren(0, 3).Returns(
                new List <RemoteValue>()
            {
                xmm0, xmm8, other
            });
        }
Exemplo n.º 4
0
 public virtual uint GetNumChildren(RemoteValue remoteValue)
 {
     if (_sizeSpecifier is uint childCount)
     {
         return(GetNumPointerOrArrayChildren(childCount, remoteValue));
     }
     return(remoteValue.GetNumChildren());
 }
Exemplo n.º 5
0
 uint GetNumPointerOrArrayChildren(uint size, RemoteValue remoteValue) =>
 remoteValue.TypeIsPointerType() ? size : Math.Min(size, remoteValue.GetNumChildren());
Exemplo n.º 6
0
 public virtual uint GetNumChildren()
 {
     return(value.GetNumChildren());
 }