Пример #1
0
        public void SetUp()
        {
            var breakpointFactory = new RemoteBreakpointFactory();

            mockBreakpoint   = Substitute.For <SbBreakpoint>();
            remoteBreakpoint = breakpointFactory.Create(mockBreakpoint);
            mockTarget       = Substitute.For <SbTarget>();
            remoteTarget     = new RemoteTargetFactory(breakpointFactory).Create(mockTarget);
            mockFunction     = Substitute.For <SbFunction>();
        }
Пример #2
0
        public void SetUp()
        {
            mockTarget   = Substitute.For <SbTarget>();
            remoteTarget = new RemoteTargetFactory(new RemoteBreakpointFactory())
                           .Create(mockTarget);
            mockAddress      = Substitute.For <SbAddress>();
            mockProcess      = Substitute.For <SbProcess>();
            mockMemoryRegion = Substitute.For <SbMemoryRegionInfo>();
            mockError        = Substitute.For <SbError>();
            mockBreakpoint   = Substitute.For <SbBreakpoint>();
            remoteBreakpoint = new RemoteBreakpointFactory().Create(mockBreakpoint);
            mockFunction     = Substitute.For <SbFunction>();

            mockTarget.GetProcess().Returns(mockProcess);
        }
Пример #3
0
        public void SetUp()
        {
            mockTarget             = Substitute.For <SbTarget>();
            mockDebuggerStackFrame = CreateMockStackFrame();

            var mockArgument1 = Substitute.For <SbValue>();

            mockArgument1.GetValue().Returns(ARG1_VALUE);

            var mockArgument2 = Substitute.For <SbValue>();

            mockArgument2.GetValue().Returns(ARG2_VALUE);

            var functionArguments = new List <SbValue>();

            functionArguments.Add(mockArgument1);
            functionArguments.Add(mockArgument2);

            mockDebuggerStackFrame.GetVariables(true, false, false, false).Returns(
                functionArguments);

            mockDebuggerStackFrame.GetFunction().GetArgumentName(0).Returns(ARG1_NAME);
            mockDebuggerStackFrame.GetFunction().GetArgumentName(1).Returns(ARG2_NAME);

            var mockArgTypeList = Substitute.For <SbTypeList>();

            mockArgTypeList.GetSize().Returns(2u);
            mockArgTypeList.GetTypeAtIndex(0u).GetName().Returns(ARG1_TYPE_NAME);
            mockArgTypeList.GetTypeAtIndex(1u).GetName().Returns(ARG2_TYPE_NAME);

            var mockFunctionType = Substitute.For <SbType>();

            mockFunctionType.GetFunctionArgumentTypes().Returns(mockArgTypeList);

            mockDebuggerStackFrame.GetFunction().GetType().Returns(mockFunctionType);

            var optionsFactory = Substitute.For <ILldbExpressionOptionsFactory>();
            var valueFactory   = new RemoteValueImpl.Factory(optionsFactory);

            stackFrame = new RemoteFrameImpl.Factory(valueFactory, optionsFactory)
                         .Create(mockDebuggerStackFrame);
        }
Пример #4
0
        bool GetSymbolAddressRange(out ulong addressMin, out ulong addressMax, SbTarget target)
        {
            addressMin = 0;
            addressMax = 0;
            var symbol = _sbFrame.GetSymbol();

            if (symbol == null || target == null)
            {
                return(false);
            }

            var startAddress = symbol.GetStartAddress();
            var endAddress   = symbol.GetEndAddress();

            if (startAddress == null || endAddress == null)
            {
                return(false);
            }
            addressMin = startAddress.GetLoadAddress(target);
            addressMax = endAddress.GetLoadAddress(target);
            return(true);
        }
Пример #5
0
        bool GetFunctionAddressRange(out ulong addressMin, out ulong addressMax, SbTarget target)
        {
            addressMin = 0;
            addressMax = 0;
            var function = _sbFrame.GetFunction();

            if (function == null || target == null)
            {
                return(false);
            }

            var startAddress = function.GetStartAddress();
            var endAddress   = function.GetEndAddress();

            if (startAddress == null || endAddress == null)
            {
                return(false);
            }
            addressMin = startAddress.GetLoadAddress(target);
            addressMax = endAddress.GetLoadAddress(target);
            return(true);
        }
        /// <summary>
        /// Create a new LLDB SBTarget locally, and return a GrpcSbTarget object to the client.
        /// Locally we then map GrpcSbTarget objects to RemoteTarget objects.
        /// </summary>
        public override Task <CreateTargetResponse> CreateTarget(CreateTargetRequest request,
                                                                 ServerCallContext context)
        {
            SbDebuggerPreconditionCheck();
            SbTarget sbTarget = sbDebugger.CreateTarget(request.Filename);

            if (sbTarget == null)
            {
                ErrorUtils.ThrowError(StatusCode.Internal, "Could not create SBTarget.");
            }
            if (!targetStore.TryAdd(sbTarget.GetId(), remoteTargetFactory.Create(sbTarget)))
            {
                ErrorUtils.ThrowError(
                    StatusCode.Internal, "Could not add target to store: " + sbTarget.GetId());
            }
            var grpcSbTarget = new GrpcSbTarget {
                Id = sbTarget.GetId()
            };
            var response = new CreateTargetResponse {
                GrpcSbTarget = grpcSbTarget
            };

            return(Task.FromResult(response));
        }
Пример #7
0
 internal RemoteTargetImpl(SbTarget sbTarget, RemoteBreakpointFactory breakpointFactory)
 {
     _sbTarget          = sbTarget;
     _breakpointFactory = breakpointFactory;
 }
Пример #8
0
 public RemoteTarget Create(SbTarget sbTarget) =>
 sbTarget != null ? new RemoteTargetImpl(sbTarget, _breakpointFactory) : null;