Пример #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
  @Override
  public void eventReceived(Object output) {
    if (fSuppressConsoleOutputCounter > 0) return;
    for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
      if (oobr instanceof MIConsoleStreamOutput) {
        MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr;
        String str = out.getString();

        if (str.trim().equals(SECONDARY_PROMPT)) {
          // Make sure to skip any secondary prompt that we
          // have already printed ourselves.  This would happen
          // when a new version of the backend starts sending
          // the secondary prompt for a command that it didn't
          // use to.  In this case, we still send it ourselves.
          if (inMissingSecondaryPrompt()) {
            return;
          }
          // Add a space for readability
          str = SECONDARY_PROMPT + ' ';
        }

        setPrompt(str);
        try {
          if (fMIOutConsolePipe != null) {
            fMIOutConsolePipe.write(str.getBytes());
            fMIOutConsolePipe.flush();
          }
        } catch (IOException e) {
        }
      } else if (oobr instanceof MILogStreamOutput) {
        MILogStreamOutput out = (MILogStreamOutput) oobr;
        String str = out.getString();
        if (str != null) {
          try {
            if (fMIOutLogPipe != null) {
              fMIOutLogPipe.write(str.getBytes());
              fMIOutLogPipe.flush();
            }
          } catch (IOException e) {
          }
        }
      }
    }
  }