/**
   * Initialize the members of the DebugNewProcessSequence class. This step is mandatory for the
   * rest of the sequence to complete.
   */
  @Execute
  public void stepInitializeBaseSequence(RequestMonitor rm) {
    fTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fContext.getSessionId());
    fBackend = fTracker.getService(IGDBBackend.class);
    fCommandControl = fTracker.getService(IGDBControl.class);
    fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
    fProcService = fTracker.getService(IGDBProcesses.class);

    if (fBackend == null
        || fCommandControl == null
        || fCommandFactory == null
        || fProcService == null) {
      rm.setStatus(
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              IDsfStatusConstants.INTERNAL_ERROR,
              "Cannot obtain service",
              null)); //$NON-NLS-1$
      rm.done();
      return;
    }

    // When we are starting to debug a new process, the container is the default process used by
    // GDB.
    // We don't have a pid yet, so we can simply create the container with the UNIQUE_GROUP_ID
    setContainerContext(
        fProcService.createContainerContextFromGroupId(
            fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID));

    rm.done();
  }
  /**
   * Initialize the members of the StartOrRestartProcessSequence_7_0 class. This step is mandatory
   * for the rest of the sequence to complete.
   */
  @Execute
  public void stepInitializeBaseSequence(RequestMonitor rm) {
    fTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), fContainerDmc.getSessionId());
    fCommandControl = fTracker.getService(IGDBControl.class);
    fCommandFactory = fTracker.getService(IMICommandControl.class).getCommandFactory();
    fProcService = fTracker.getService(IGDBProcesses.class);
    fBackend = fTracker.getService(IGDBBackend.class);

    if (fCommandControl == null || fCommandFactory == null || fProcService == null) {
      rm.setStatus(
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              IDsfStatusConstants.INTERNAL_ERROR,
              "Cannot obtain service",
              null)); //$NON-NLS-1$
      rm.done();
      return;
    }

    fReverseService = fTracker.getService(IReverseRunControl.class);
    if (fReverseService != null) {
      // Although the option to use reverse debugging could be on, we only check
      // it if we actually have a reverse debugging service.  There is no point
      // in trying to handle reverse debugging if it is not available.
      fReverseEnabled =
          CDebugUtils.getAttribute(
              fAttributes,
              IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
              IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
    }

    rm.done();
  }
예제 #3
0
  /** @since 1.1 */
  @ConfinedToDsfExecutor("fSession#getExecutor")
  public AbstractCLIProcess(ICommandControlService commandControl) throws IOException {
    fSession = commandControl.getSession();
    fCommandControl = commandControl;

    commandControl.addEventListener(this);
    commandControl.addCommandListener(this);

    PipedInputStream miInConsolePipe = null;
    PipedOutputStream miOutConsolePipe = null;
    PipedInputStream miInLogPipe = null;
    PipedOutputStream miOutLogPipe = null;

    try {
      // Using a LargePipedInputStream see https://bugs.eclipse.org/bugs/show_bug.cgi?id=223154
      miOutConsolePipe = new PipedOutputStream();
      miInConsolePipe = new LargePipedInputStream(miOutConsolePipe);
      miOutLogPipe = new PipedOutputStream();
      miInLogPipe = new LargePipedInputStream(miOutLogPipe);
    } catch (IOException e) {
      ILog log = GdbPlugin.getDefault().getLog();
      if (log != null) {
        log.log(
            new Status(
                IStatus.ERROR,
                GdbPlugin.PLUGIN_ID,
                -1,
                "Error when creating log pipes",
                e)); //$NON-NLS-1$
      }
    }
    // Must initialize these outside of the try block because they are final.
    fMIOutConsolePipe = miOutConsolePipe;
    fMIInConsolePipe = miInConsolePipe;
    fMIOutLogPipe = miOutLogPipe;
    fMIInLogPipe = miInLogPipe;
  }
예제 #4
0
 /* (non-Javadoc)
  * @see org.eclipse.cdt.dsf.service.AbstractDsfService#getBundleContext()
  */
 @Override
 protected BundleContext getBundleContext() {
   return GdbPlugin.getBundleContext();
 }