Example #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 breakpointRequest, out IDebugPendingBreakpoint2 pendingBreakpoint)
        {
            //
            // Construct and register new pending breakpoint.
            //

            LoggingUtils.PrintFunction();

            try
            {
                DebuggeeBreakpointPending breakpoint = null;

                BP_REQUEST_INFO [] requestInfo = new BP_REQUEST_INFO [1];

                LoggingUtils.RequireOk(breakpointRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));

                long locationType = requestInfo [0].bpLocation.bpLocationType & (long)enum_BP_LOCATION_TYPE.BPLT_LOCATION_TYPE_MASK;

                if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_FILE_LINE) != 0)
                {
                    //
                    // Query the associated document extension, and create a respective pending breakpoint type.
                    //

                    IDebugDocumentPosition2 documentPostion = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(requestInfo[0].bpLocation.unionmember2);

                    LoggingUtils.RequireOk(documentPostion.GetFileName(out string fileName));

                    string fileExtension = Path.GetExtension(fileName).ToLower();

                    switch (fileExtension)
                    {
                    case ".c":
                    case ".cpp":
                    case ".h":
                    case ".hpp":
                    case ".asm":
                    case ".inl":
                    {
                        breakpoint = new CLangDebuggeeBreakpointPending(Engine.NativeDebugger, this, breakpointRequest);

                        break;
                    }

                    case ".java":
                    {
                        throw new NotImplementedException();
                    }

                    default:
                    {
                        breakpoint = new DebuggeeBreakpointPending(this, breakpointRequest);

                        break;
                    }
                    }
                }
                else if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_FUNC_OFFSET) != 0)
                {
                    throw new NotImplementedException();
                }
                else if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_CONTEXT) != 0)
                {
                    throw new NotImplementedException();
                }
                else if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_STRING) != 0)
                {
                    throw new NotImplementedException();
                }
                else if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_ADDRESS) != 0)
                {
                    throw new NotImplementedException();
                }
                else if ((locationType & (long)enum_BP_LOCATION_TYPE.BPLT_RESOLUTION) != 0)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    throw new NotImplementedException();
                }

                lock (m_pendingBreakpoints)
                {
                    m_pendingBreakpoints.Add(breakpoint);
                }

                pendingBreakpoint = (IDebugPendingBreakpoint2)breakpoint;

                SetDirty(true);

                return(Constants.S_OK);
            }
            catch (NotImplementedException e)
            {
                LoggingUtils.HandleException(e);

                pendingBreakpoint = null;

                return(Constants.E_NOTIMPL);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                pendingBreakpoint = null;

                return(Constants.E_FAIL);
            }
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int CreatePendingBreakpoint (IDebugBreakpointRequest2 breakpointRequest, out IDebugPendingBreakpoint2 pendingBreakpoint)
    {
      // 
      // Construct and register new pending breakpoint.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        DebuggeeBreakpointPending breakpoint = null;

        BP_REQUEST_INFO [] requestInfo = new BP_REQUEST_INFO [1];

        LoggingUtils.RequireOk (breakpointRequest.GetRequestInfo (enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));

        long locationType = requestInfo [0].bpLocation.bpLocationType & (long) enum_BP_LOCATION_TYPE.BPLT_LOCATION_TYPE_MASK;

        if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_FILE_LINE) != 0)
        {
          // 
          // Query the associated document extension, and create a respective pending breakpoint type.
          // 

          string fileName;

          IDebugDocumentPosition2 documentPostion = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown (requestInfo [0].bpLocation.unionmember2);

          LoggingUtils.RequireOk (documentPostion.GetFileName (out fileName));

          string fileExtension = Path.GetExtension (fileName).ToLower ();

          switch (fileExtension)
          {
            case ".c":
            case ".cpp":
            case ".h":
            case ".hpp":
            case ".asm":
            case ".inl":
            {
              breakpoint = new CLangDebuggeeBreakpointPending (Engine.NativeDebugger, this, breakpointRequest);

              break;
            }

            case ".java":
            {
              throw new NotImplementedException ();
            }

            default:
            {
              breakpoint = new DebuggeeBreakpointPending (this, breakpointRequest);

              break;
            }
          }
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_FUNC_OFFSET) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_CONTEXT) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_STRING) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_ADDRESS) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_RESOLUTION) != 0)
        {
          throw new NotImplementedException ();
        }
        else
        {
          throw new NotImplementedException ();
        }

        lock (m_pendingBreakpoints)
        {
          m_pendingBreakpoints.Add (breakpoint);
        }

        pendingBreakpoint = (IDebugPendingBreakpoint2)breakpoint;

        SetDirty (true);

        return Constants.S_OK;
      }
      catch (NotImplementedException e)
      {
        LoggingUtils.HandleException (e);

        pendingBreakpoint = null;

        return Constants.E_NOTIMPL;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        pendingBreakpoint = null;

        return Constants.E_FAIL;
      }
    }