示例#1
0
  @Override
  public void eventReceived(Object output) {
    if (!fResetDPrintfStyle) {
      // Only do this if we haven't already reset the dprintf style
      for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
        if (oobr instanceof MIConsoleStreamOutput) {
          MIConsoleStreamOutput exec = (MIConsoleStreamOutput) oobr;

          // Look for a printout that indicates that we cannot call inferior methods.
          // This affects Ubuntu 32bit OS
          if (exec.getCString().indexOf("Cannot call inferior functions") != -1) { // $NON-NLS-1$
            // In this case, make sure we use the 'gdb' style of dprintf
            // and not the 'call' one.
            fResetDPrintfStyle = true;
            if (fControl instanceof IMICommandControl) {
              CommandFactory factory = ((IMICommandControl) fControl).getCommandFactory();
              fControl.queueCommand(
                  factory.createMIGDBSetDPrintfStyle(
                      fControl.getContext(), MIGDBSetDPrintfStyle.GDB_STYLE),
                  new ImmediateDataRequestMonitor<MIInfo>() {
                    @Override
                    protected void handleCompleted() {
                      // We accept errors
                    }
                  });
            }
          }
        }
      }
    }
    super.eventReceived(output);
  }
示例#2
0
  @ConfinedToDsfExecutor("fSession#getExecutor")
  public void dispose() {
    if (fDisposed) return;

    fCommandControl.removeEventListener(this);
    fCommandControl.removeCommandListener(this);

    closeIO();
    fDisposed = true;

    // We have memory leaks that prevent this class from being
    // GCed.  The problem becomes bad because we are holding
    // two LargePipedInputStream and eventually, the JUnit tests
    // run out of memory.  To address this particular problem,
    // before the actual causes of the leaks are fixed, lets
    // make sure we release all our four streams which all have
    // a reference to a LargePipedInputStream
    // Bug 323071
    fMIInConsolePipe = null;
    fMIInLogPipe = null;
    fMIOutConsolePipe = null;
    fMIOutLogPipe = null;
  }
示例#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;
  }