public void BindFunctionBreakpointWithOffset() { SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(1); MockFunctionPosition(TEST_FUNCTION_NAME_WITH_OFFSET); uint offset = 10; mockTarget.CreateFunctionOffsetBreakpoint(TEST_FUNCTION_NAME, offset).Returns( new BreakpointErrorPair(mockLldbBreakpoint, BreakpointError.Success)); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(1, boundBreakpoints.Count); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }
public void BindPassCount() { // Set a pass count on the request, and create a new pending breakpoint. const uint PASS_COUNT = 3u; SetPassCount(enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL, PASS_COUNT); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); List <SbBreakpointLocation> mockBreakpointLocations = CreateMockBreakpointLocations(1); MockBreakpoint(mockBreakpointLocations); MockDocumentPosition(TEST_FILE_NAME, LINE_NUMBER, COLUMN_NUMBER); var mockBoundBreakpoint = Substitute.For <IBoundBreakpoint>(); mockBoundBreakpointFactory.Create(pendingBreakpoint, mockBreakpointLocations[0], mockProgram, Guid.Empty).Returns(mockBoundBreakpoint); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(1, boundBreakpoints.Count); Assert.AreSame(mockBoundBreakpoint, boundBreakpoints[0]); mockBoundBreakpoint.Received().SetPassCount(requestInfo.bpPassCount); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }
public void BindUnsupportedType() { // Set a unsupported breakpoint type and create a new pending breakpoint. SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_NONE); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); mockBreakpointManager.Received().ReportBreakpointError( Arg.Any <DebugBreakpointError>()); Assert.AreNotEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_FALSE, result); }
public void BindInvalidFunction() { // Set a function breakpoint type and create a new pending breakpoint. SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(1); MockFunctionPosition(null); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); mockBreakpointManager.Received().ReportBreakpointError( Arg.Any <DebugBreakpointError>()); Assert.AreNotEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_FALSE, result); }
public void GetNumLocations() { int numLocations = 8; // Set a function breakpoint type and create a new pending breakpoint. SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(numLocations); MockFunctionPosition(TEST_FUNCTION_NAME); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); Assert.AreEqual(numLocations, pendingBreakpoint.GetNumLocations()); }
public void BindFunctionBreakpoint() { // Set a function breakpoint type and create a new pending breakpoint. SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(1); MockFunctionPosition(TEST_FUNCTION_NAME); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(1, boundBreakpoints.Count); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }
public void BindCodeAddressBreakpoint() { // Set code address breakpoint type and create a new pending breakpoint. SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_ADDRESS); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockAssemblyBreakpoint(1); MockCodeAddress(STR_TEST_ADDRESS); var result = pendingBreakpoint.Bind(); mockTarget.Received(1).BreakpointCreateByAddress(TEST_ADDRESS); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(1, boundBreakpoints.Count); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }
public void BindFunctionBreakpointWithoutOffset() { SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(1); MockFunctionPosition(TEST_FUNCTION_NAME_WITHOUT_OFFSET); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); mockTarget.Received().BreakpointCreateByName(TEST_FUNCTION_NAME); Assert.AreEqual(1, boundBreakpoints.Count); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); mockTarget.DidNotReceive().BreakpointDelete(Arg.Any <int>()); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }
public void BindInvalidFunctionBreakpointWithOffset() { SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); MockFunctionBreakpoint(1); MockFunctionPosition(TEST_FUNCTION_NAME_WITH_OFFSET); // OffsetBreakpoint returns null when it fails //mockLldbBreakpoint.OffsetBreakpoint(offset).Returns((RemoteBreakpoint)null); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(0, boundBreakpoints.Count); mockBreakpointManager.DidNotReceive().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreNotEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_FALSE, result); }
public void Bind() { Assert.AreEqual(AD7Constants.E_BP_DELETED, pendingBreakpoint.Bind()); }
public void BindLineBreakpoint() { MockBreakpoint(1); MockDocumentPosition(TEST_FILE_NAME, LINE_NUMBER, COLUMN_NUMBER); var result = pendingBreakpoint.Bind(); IDebugErrorBreakpoint2 breakpointError = GetBreakpointError(); var boundBreakpoints = GetBoundBreakpoints(); Assert.AreEqual(1, boundBreakpoints.Count); mockBreakpointManager.Received().RegisterPendingBreakpoint(pendingBreakpoint); Assert.AreEqual(null, breakpointError); Assert.AreEqual(VSConstants.S_OK, result); }