Exemplo n.º 1
0
 @Override
 public void flushCache(IDMContext context) {
   // Although the CPUInfo does not change,
   // this allows us to have a way to forcibly clear the cache.
   // We would need to call this method from the UI somehow.
   fFetchCPUInfoCache.reset(context);
 }
Exemplo n.º 2
0
  @Override
  public void getCPUs(
      final IHardwareTargetDMContext dmc, final DataRequestMonitor<ICPUDMContext[]> rm) {
    if (!fSessionInitializationComplete) {
      // We are not ready to answer yet
      rm.done(
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              INVALID_STATE,
              "Debug session not initialized yet",
              null)); //$NON-NLS-1$
      return;
    }

    if (supportsProcPseudoFS()) {
      fFetchCPUInfoCache.execute(
          new MIMetaGetCPUInfo(fCommandControl.getContext()),
          new ImmediateDataRequestMonitor<MIMetaGetCPUInfoInfo>() {
            @Override
            protected void handleSuccess() {
              rm.done(parseCoresInfoForCPUs(dmc, getData().getInfo()));
            }
          });
    } else {
      // No way to know the CPUs for Windows session.
      rm.done(
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              NOT_SUPPORTED,
              "Operation not supported",
              null)); //$NON-NLS-1$
    }
  }
Exemplo n.º 3
0
  /**
   * This method initializes this service after our superclass's initialize() method succeeds.
   *
   * @param requestMonitor The call-back object to notify when this service's initialization is
   *     done.
   */
  private void doInitialize(RequestMonitor requestMonitor) {
    fSessionInitializationComplete = false;

    fCommandControl = getServicesTracker().getService(IGDBControl.class);
    fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();

    fBackend = getServicesTracker().getService(IGDBBackend.class);

    // The cache does not go directly to the commandControl service.
    // Instead is goes through a CPUInfoManager which will decide how to
    // handle getting the required cpu info
    fFetchCPUInfoCache = new CommandCache(getSession(), new CPUInfoManager());
    fFetchCPUInfoCache.setContextAvailable(fCommandControl.getContext(), true);
    fLoadInfoRequestCache = new HashMap<IDMContext, DataRequestMonitor<ILoadInfo>>();

    getSession().addServiceEventListener(this, null);

    // Register this service.
    register(
        new String[] {
          IGDBHardwareAndOS.class.getName(),
          IGDBHardwareAndOS2.class.getName(),
          GDBHardwareAndOS.class.getName()
        },
        new Hashtable<String, String>());

    requestMonitor.done();
  }
Exemplo n.º 4
0
 /**
  * This method shuts down this service. It unregisters the service, stops receiving service
  * events, and calls the superclass shutdown() method to finish the shutdown process.
  *
  * @return void
  */
 @Override
 public void shutdown(RequestMonitor requestMonitor) {
   getSession().removeServiceEventListener(this);
   fFetchCPUInfoCache.reset();
   fLoadInfoRequestCache.clear();
   unregister();
   super.shutdown(requestMonitor);
 }