/// <summary> /// A helper method used to construct a new pending breakpoint. /// </summary> /// <param name="pBPRequest"> An IDebugBreakpointRequest2 object that describes the pending breakpoint to create. </param> /// <param name="ppPendingBP"> Returns an IDebugPendingBreakpoint2 object that represents the pending breakpoint. </param> public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP) { AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, m_engine, this); ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint; m_pendingBreakpoints.Add(pendingBreakpoint); }
/// <summary> /// Constructor. /// </summary> /// <param name="pendingBreakpoint"> The AD7PendingBreakpoint object that represents the pending breakpoint being bound. </param> /// <param name="boundBreakpoint"> The AD7BoundBreakpoint object that represents the breakpoint being bound. </param> public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint) { m_pendingBreakpoint = pendingBreakpoint; m_boundBreakpoint = boundBreakpoint; }
/// <summary> /// AD7BoundBreakpoint constructor for file/line breaks. /// </summary> /// <param name="engine"> AD7 Engine. </param> /// <param name="bpReqInfo"> Contains the information required to implement a breakpoint. </param> /// <param name="pendingBreakpoint"> Associated pending breakpoint. </param> public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7PendingBreakpoint pendingBreakpoint) { if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE) { string documentName; // Get Decument Position and File Name IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2)); docPosition.GetFileName(out documentName); // Need to shorten the path we send to GDB. StringBuilder shortPath = new StringBuilder(1024); GetShortPathName(documentName, shortPath, shortPath.Capacity); // Get the location in the document that the breakpoint is in. TEXT_POSITION[] startPosition = new TEXT_POSITION[1]; TEXT_POSITION[] endPosition = new TEXT_POSITION[1]; docPosition.GetRange(startPosition, endPosition); m_engine = engine; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE; m_filename = shortPath.ToString(); m_line = startPosition[0].dwLine + 1; m_pendingBreakpoint = pendingBreakpoint; m_enabled = true; m_deleted = false; m_hitCount = 0; m_remoteID = m_engine.BPMgr.RemoteAdd(this); } else if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET) { string func; IDebugFunctionPosition2 funcPosition = (IDebugFunctionPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2)); funcPosition.GetFunctionName(out func); m_engine = engine; m_func = func; m_enabled = true; m_deleted = false; m_hitCount = 0; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET; m_pendingBreakpoint = pendingBreakpoint; m_remoteID = m_engine.BPMgr.RemoteAdd(this); } // if ((m_remoteID == 0) && (VSNDK.AddIn.VSNDKAddIn.isDebugEngineRunning == false)) if (m_remoteID == 0) { return; } // Set the hit count and condition if (bpReqInfo.bpPassCount.stylePassCount != enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_NONE) SetPassCount(bpReqInfo.bpPassCount); if (bpReqInfo.bpCondition.styleCondition != enum_BP_COND_STYLE.BP_COND_NONE) SetCondition(bpReqInfo.bpCondition); // Get the Line Position sent back from GDB TEXT_POSITION tpos = new TEXT_POSITION(); tpos.dwLine = m_GDB_linePos - 1; uint xAddress = UInt32.Parse(m_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber); AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, xAddress); AD7DocumentContext documentContext = new AD7DocumentContext(m_GDB_filename, tpos, tpos, codeContext); m_breakpointResolution = new AD7BreakpointResolution(m_engine, xAddress, documentContext); m_engine.Callback.OnBreakpointBound(this, 0); }
public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint) { m_pendingBreakpoint = pendingBreakpoint; m_boundBreakpoint = boundBreakpoint; }
/// <summary> /// AD7BoundBreakpoint constructor for file/line breaks. /// </summary> /// <param name="engine"> AD7 Engine. </param> /// <param name="bpReqInfo"> Contains the information required to implement a breakpoint. </param> /// <param name="pendingBreakpoint"> Associated pending breakpoint. </param> public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7PendingBreakpoint pendingBreakpoint) { if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE) { string documentName; // Get Decument Position and File Name IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2)); docPosition.GetFileName(out documentName); // Need to shorten the path we send to GDB. StringBuilder shortPath = new StringBuilder(1024); GetShortPathName(documentName, shortPath, shortPath.Capacity); // Get the location in the document that the breakpoint is in. TEXT_POSITION[] startPosition = new TEXT_POSITION[1]; TEXT_POSITION[] endPosition = new TEXT_POSITION[1]; docPosition.GetRange(startPosition, endPosition); m_engine = engine; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE; m_filename = shortPath.ToString(); m_line = startPosition[0].dwLine + 1; m_pendingBreakpoint = pendingBreakpoint; m_enabled = true; m_deleted = false; m_hitCount = 0; m_remoteID = m_engine.BPMgr.RemoteAdd(this); } else if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET) { string func; IDebugFunctionPosition2 funcPosition = (IDebugFunctionPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2)); funcPosition.GetFunctionName(out func); m_engine = engine; m_func = func; m_enabled = true; m_deleted = false; m_hitCount = 0; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET; m_pendingBreakpoint = pendingBreakpoint; m_remoteID = m_engine.BPMgr.RemoteAdd(this); } // if ((m_remoteID == 0) && (VSNDK.AddIn.VSNDKAddIn.isDebugEngineRunning == false)) if (m_remoteID == 0) { return; } // Set the hit count and condition if (bpReqInfo.bpPassCount.stylePassCount != enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_NONE) { SetPassCount(bpReqInfo.bpPassCount); } if (bpReqInfo.bpCondition.styleCondition != enum_BP_COND_STYLE.BP_COND_NONE) { SetCondition(bpReqInfo.bpCondition); } // Get the Line Position sent back from GDB TEXT_POSITION tpos = new TEXT_POSITION(); tpos.dwLine = m_GDB_linePos - 1; uint xAddress = UInt32.Parse(m_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber); AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, xAddress); AD7DocumentContext documentContext = new AD7DocumentContext(m_GDB_filename, tpos, tpos, codeContext); m_breakpointResolution = new AD7BreakpointResolution(m_engine, xAddress, documentContext); m_engine.Callback.OnBreakpointBound(this, 0); }