Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

CDT/cdt-debug-dsf-gdb-extensibility

< CDT
Revision as of 02:42, 21 July 2011 by Zulliger.indel.ch (Talk | contribs) (How to extend DSF-GDB: Extended by mentioning some example class names and mention the need of extending the extension point)

How to extend DSF-GDB

Thanks to DSF, DSF-GDB can easily be extended by replacing/adding/removing different services. To do this one can create a custom service factory by:

  1. sub-class the DSF-GDB service you want to modify (such as GDBProcesses_7_2, GDBRunControl_7_2_NS), or create your entirely new version (by subclassing AbstractDsfService).
  2. sub-class org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate and override GdbLaunchDelegate#newServiceFactory().
  3. sub-class the appropriate service factory such as org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory or org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactoryNS (for GDB non-stop debugging) and override any services' creation method to instantiate your own version of the service. Other versions of GDB can also be handled in those services' creation methods.
  4. Finally, make sure your customized "GDB launch delegate" class gets instantiated by extending the org.eclipse.debug.core.launchDelegates extension point.

In some cases where small changes are required to MI commands, overriding the entire service may be unnecessary. Instead, one can extend DSF-GDB's command factory. To do this, one still requires a new services factory, but only to be able to specify the new command factory:

  1. sub-class any MI command class and its output class to add your changes. These are found in org.eclipse.cdt.dsf.mi.service.command.commands and org.eclipse.cdt.dsf.mi.service.command.output
  2. sub-class org.eclipse.cdt.dsf.mi.service.command.CommandFactory and override/add your necessary changes.
  3. sub-class org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate and override GdbLaunchDelegate#newServiceFactory().
  4. sub-class org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory and override GdbDebugServicesFactory#createCommandControl() to pass in your own command factory.

Once you have the above framework in place, overriding other DSF-GDB services/commands becomes extremely quick.

Requested improvements

This section lists the different use cases that the community would like to see addressed to allow for easier extensibility of DSF-GDB.

  • Allow FinalLaunchSequence to be easily overridden (completed in bug 321084)
  • Allow to easily add a new service (completed in bug 326951 and bug 338769)
  • Allow to override the use of -exec-run vs -exec-continue at startup (completed in bug 319257)

Back to the top