Skip to main content

Notice: This Wiki is now read only and edits are no longer 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 12:26, 18 March 2011 by Marc.khouzam.gmail.com (Talk | contribs) (Requested improvements)

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, or create your entirely new version.
  2. sub-class org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate and override GdbLaunchDelegate#newServiceFactory().
  3. sub-class org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory 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.

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)
  • Allow to override the use of -exec-run vs -exec-continue at startup (completed in bug 319257)

Back to the top