Exemple #1
0
  @Override
  public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type)
      throws TmfTraceException {
    try {
      String tracedExecutable = resource.getPersistentProperty(EXEC_KEY);
      if (tracedExecutable == null) {
        throw new TmfTraceException(Messages.GdbTrace_ExecutableNotSet);
      }

      String defaultGdbCommand =
          Platform.getPreferencesService()
              .getString(
                  GdbPlugin.PLUGIN_ID,
                  IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
                  IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT,
                  null);

      fGdbTpRef = new DsfGdbAdaptor(this, defaultGdbCommand, path, tracedExecutable);
      fNbFrames = getNbFrames();
    } catch (CoreException e) {
      throw new TmfTraceException(Messages.GdbTrace_FailedToInitializeTrace, e);
    }

    super.initTrace(resource, path, type);
  }
Exemple #2
0
 @Override
 public synchronized void dispose() {
   if (fGdbTpRef != null) {
     fGdbTpRef.dispose();
   }
   super.dispose();
 }
  /**
   * Setup the trace for the tests and return the InputOutputAnalysisModule, not executed.
   *
   * @param fileName The file name of the trace to open
   * @return The input output analysis module
   */
  protected @NonNull InputOutputAnalysisModule setUp(String fileName) {
    TmfXmlKernelTraceStub trace = new TmfXmlKernelTraceStub();
    trace.addEventAspect(KernelTidAspect.INSTANCE);
    trace.setKernelEventLayout(EVENT_LAYOUT);
    IPath filePath = Activator.getAbsoluteFilePath(IO_FILE_PATH + fileName);
    IStatus status = trace.validate(null, filePath.toOSString());
    if (!status.isOK()) {
      fail(status.getException().getMessage());
    }
    try {
      trace.initTrace(null, filePath.toOSString(), TmfEvent.class);
    } catch (TmfTraceException e) {
      fail(e.getMessage());
    }

    deleteSuppFiles(trace);
    ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    fTrace = trace;

    /* Start the kernel analysis module */
    KernelAnalysisModule kernelMod =
        TmfTraceUtils.getAnalysisModuleOfClass(
            trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
    assertNotNull(kernelMod);
    kernelMod.schedule();
    kernelMod.waitForCompletion();

    InputOutputAnalysisModule module =
        TmfTraceUtils.getAnalysisModuleOfClass(
            trace, InputOutputAnalysisModule.class, InputOutputAnalysisModule.ID);
    assertNotNull(module);
    return module;
  }