public int GetRequestInfo(enum_BPREQI_FIELDS dwFields, BP_REQUEST_INFO[] pBPRequestInfo) { pBPRequestInfo[0].dwFields = enum_BPREQI_FIELDS.BPREQI_BPLOCATION; if ((dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0) { if (DocumentPosition != null) { pBPRequestInfo[0].bpLocation.bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE; pBPRequestInfo[0].bpLocation.unionmember2 = HostMarshal.RegisterDocumentPosition(DocumentPosition); } else if (FunctionPosition != null) { pBPRequestInfo[0].bpLocation.bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET; pBPRequestInfo[0].bpLocation.unionmember2 = HostMarshal.RegisterFunctionPosition(FunctionPosition); } } if ((dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0 && !string.IsNullOrWhiteSpace(Condition)) { // VSCode only support when true condition for now pBPRequestInfo[0].dwFields |= enum_BPREQI_FIELDS.BPREQI_CONDITION; pBPRequestInfo[0].bpCondition.bstrCondition = Condition; pBPRequestInfo[0].bpCondition.styleCondition = enum_BP_COND_STYLE.BP_COND_WHEN_TRUE; } if ((dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0) { // not supported } return(0); }
public void SetUp() { var taskContext = new JoinableTaskContext(); mockBreakpointManager = Substitute.For <IBreakpointManager>(); mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>(); mockTarget = Substitute.For <RemoteTarget>(); mockProgram = Substitute.For <IDebugProgram2>(); mockMarshal = Substitute.For <Marshal>(); mockLldbBreakpoint = Substitute.For <RemoteBreakpoint>(); requestInfo = new BP_REQUEST_INFO(); mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(), Arg.Any <BP_REQUEST_INFO[]>()).Returns(x => { enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0]; BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1]; if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0) { return(1); } return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0])); }); mockLldbBreakpoint.GetId().Returns(EXPECTED_ID); SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE); mockBoundBreakpointFactory = Substitute.For <DebugBoundBreakpoint.Factory>(); debugPendingBreakpointFactory = new DebugPendingBreakpoint.Factory(taskContext, mockBoundBreakpointFactory, new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory()); pendingBreakpoint = debugPendingBreakpointFactory.Create( mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget, mockMarshal); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetRequestInfo(enum_BPREQI_FIELDS dwFields, BP_REQUEST_INFO [] pBPRequestInfo) { LoggingUtils.PrintFunction(); pBPRequestInfo [0] = m_requestInfo; return(Constants.S_OK); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetRequestInfo (enum_BPREQI_FIELDS dwFields, BP_REQUEST_INFO [] pBPRequestInfo) { LoggingUtils.PrintFunction (); pBPRequestInfo [0] = m_requestInfo; return Constants.S_OK; }
public void SetUp() { var taskContext = new JoinableTaskContext(); mockBreakpointManager = Substitute.For <IBreakpointManager>(); mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>(); mockProgram = Substitute.For <IDebugProgram2>(); mockResolution = Substitute.For <IDebugBreakpointResolution2>(); mockResolutionFactory = Substitute.For <DebugWatchpointResolution.Factory>(); mockResolutionFactory.Create(TEST_ADDRESS_STR, mockProgram).Returns(mockResolution); mockTarget = Substitute.For <RemoteTarget>(); SbError error; mockError = Substitute.For <SbError>(); mockTarget.WatchAddress(TEST_ADDRESS, WATCH_SIZE, false, true, out error).Returns(x => { x[4] = mockError; return(mockLldbWatchpoint); }); mockMarshal = Substitute.For <Marshal>(); mockMarshal.GetStringFromIntPtr(Arg.Any <IntPtr>()).Returns(TEST_ADDRESS_STR); mockLldbWatchpoint = Substitute.For <SbWatchpoint>(); requestInfo = new BP_REQUEST_INFO(); requestInfo.bpLocation.unionmember4 = (IntPtr)4; mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(), Arg.Any <BP_REQUEST_INFO[]>()).Returns(x => { enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0]; BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1]; if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0) { return(1); } return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0])); }); mockLldbWatchpoint.GetId().Returns(EXPECTED_ID); SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_DATA_STRING); watchpointFactory = new DebugWatchpoint.Factory(taskContext, mockResolutionFactory, new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory()); watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest, mockTarget, mockProgram, mockMarshal); }
public int GetRequestInfo(enum_BPREQI_FIELDS fields, BP_REQUEST_INFO[] requestInfo) { if (requestInfo.Length != 1) { throw new ArgumentException($"Expected {nameof(requestInfo)} to have " + $"length = 1; was {requestInfo.Length}."); } var info = new BP_REQUEST_INFO() { bpLocation = new BP_LOCATION() { bpLocationType = (int)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE, unionmember2 = docPosition }, bpPassCount = new BP_PASSCOUNT() { dwPassCount = 1 } }; requestInfo[0] = info; return(VSConstants.S_OK); }
private int BuildBreakpointRequestInfo(enum_BPREQI_FIELDS fields, out BP_REQUEST_INFO breakpointRequestInfo) { breakpointRequestInfo = new BP_REQUEST_INFO(); if ((fields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0 && (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0) { breakpointRequestInfo.dwFields |= enum_BPREQI_FIELDS.BPREQI_BPLOCATION; breakpointRequestInfo.bpLocation = requestInfo.bpLocation; } if ((fields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0 && (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0) { breakpointRequestInfo.dwFields |= enum_BPREQI_FIELDS.BPREQI_CONDITION; breakpointRequestInfo.bpCondition = requestInfo.bpCondition; } if ((fields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0 && (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0) { breakpointRequestInfo.dwFields |= enum_BPREQI_FIELDS.BPREQI_PASSCOUNT; breakpointRequestInfo.bpPassCount = requestInfo.bpPassCount; } return(0); }