SbFrame CreateMockStackFrame()
 {
     mockDebuggerStackFrame = Substitute.For <SbFrame>();
     mockDebuggerStackFrame.GetPC().Returns(TEST_PC);
     mockDebuggerStackFrame.GetThread().GetProcess().GetTarget().Returns(mockTarget);
     mockDebuggerStackFrame.GetFunction().GetStartAddress().GetLoadAddress(mockTarget)
     .Returns(FUNCTION_ADDRESS_MIN);
     mockDebuggerStackFrame.GetFunction().GetEndAddress().GetLoadAddress(mockTarget)
     .Returns(FUNCTION_ADDRESS_MAX);
     mockDebuggerStackFrame.GetSymbol().GetStartAddress().GetLoadAddress(mockTarget)
     .Returns(SYMBOL_ADDRESS_MIN);
     mockDebuggerStackFrame.GetSymbol().GetEndAddress().GetLoadAddress(mockTarget)
     .Returns(SYMBOL_ADDRESS_MAX);
     mockDebuggerStackFrame.GetFunctionName().Returns(NAME);
     return(mockDebuggerStackFrame);
 }
        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);
        }
        public void GetPhysicalStackRangeChecksSymbolAddressRange()
        {
            mockDebuggerStackFrame.GetFunction().GetEndAddress().Returns((SbAddress)null);
            mockDebuggerStackFrame.GetFunction().GetStartAddress().Returns((SbAddress)null);
            var result = stackFrame.GetPhysicalStackRange();

            Assert.NotNull(result);
            Assert.AreEqual(SYMBOL_ADDRESS_MIN, result.addressMin);
            Assert.AreEqual(SYMBOL_ADDRESS_MAX, result.addressMax);
        }
 public SbFunction GetFunction() => _sbFrame.GetFunction();