コード例 #1
0
  /** Start executing the program. */
  @Execute
  public void stepStartExecution(final RequestMonitor rm) {
    if (fBackend.getSessionType() != SessionType.CORE) {
      // Overwrite the program name to use the binary name that was specified.
      // This is important for multi-process
      // Bug 342351
      fAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fBinaryName);

      fProcService.start(
          getContainerContext(),
          fAttributes,
          new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm) {
            @Override
            protected void handleSuccess() {
              assert getData() instanceof IMIContainerDMContext;

              // Set the container that we created
              setContainerContext(
                  DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
              fDataRequestMonitor.setData(getContainerContext());

              // Don't call fDataRequestMonitor.done(), the sequence will
              // automatically do that when it completes;
              rm.done();
            }
          });
    } else {
      fDataRequestMonitor.setData(getContainerContext());
      rm.done();
    }
  }
コード例 #2
0
  /**
   * 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();
  }