NEW DATE! Bugzilla will undergo maintenance 2024-03-28 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 441277 - Provide an example plugin to show how to extend DSF-GDB
Summary: Provide an example plugin to show how to extend DSF-GDB
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.4.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.6.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-06 13:13 EDT by Marc Khouzam CLA
Modified: 2014-12-19 01:00 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2014-08-06 13:13:13 EDT
DSF-GDB was originally meant to be and example of how to use DSF. It has grown to be extended itself but does not provide a detailed example of how to extend it.

Furthermore, DSF-GDB allows to easily extends its services, but not so much is view model.  The example should address all this and help define ways to improve extendibility.
Comment 1 Marc Khouzam CLA 2014-08-07 13:36:51 EDT
I pushed a patch to gerrit that provides the beginnings of an example.  It can help get some discussion going. 

Basically, it adds a new launch delegate to "C/C++ Applicaiton", which is called "Example GDB Extended Launch Delegate".  Then it overrides different aspects of DSF-GDB.

https://git.eclipse.org/r/#/c/30660/

I'd like to commit it and then have it updated by different people as DSF-GDB evolves. I'll leave it on Gerrit until I come back from vacation, but if someone wants to make changes to it, feel free.
Comment 2 Marc Khouzam CLA 2014-12-18 12:33:07 EST
I have committed to master the current version of this patch which shows how to extend quite a few things (see list below).

So there is now a new plugin dsf-gdb/org.eclipse.cdt.examples.dsf.gdb which can evolve with new and better examples as DSF-GDB evolves.  It can also be used to test how easy or hard it is to extend particular aspects.  For example, doing this plugin showed me a limitation that led to opening and fixing Bug 455537.

Current examples shown:

1- Define a new service: GDBExtendedService
2- Extend the FinalLaunchSequence with GdbExtendedFinalLaunchSequence_7_7 to:
    a) popup a dialog showing the GDB version
    b) always set 'pagination off' in GDB
3- Define a new launch delegate for CDT's "C/C++ Application" launch: GdbExtendedLaunchDelegate
4- Define a new launch to allow to override the view model: GdbExtendedLaunch
5- Extend the ServicesLaunchSequence to start the new service: GdbExtendedServicesLaunchSequence
6- Create a new MICommand: CLIGDBVersion
7- Extend the CommandFactory_6_8 with GdbExtendedCommandFactory_6_8 to:
    a) create the new CLIGDBVersion command
    b) prefix every dynamic-printf with [EX]
8- Extend GDBControl_7_7 with GDBExtendedControl_7_7 to use GdbExtendedFinalLaunchSequence_7_7
9- Extend GdbDebugServicesFactory with GdbExtendedDebugServicesFactory and GdbExtendedDebugServicesFactoryNS to:
    a) instantiate the new version of the Control service: GDBExtendedControl_7_7
    b) instantiate the new service: IGDBExtendedFunctions
10- Extend the view model, GdbExtendedLaunchVMProvider, GdbExtendedThreadVMNode, GdbExtendedAdapterFactory, and GdbExtendedViewModelAdapter, to modify the label of each thread shown in the Debug view to use the word "DSP" instead of "Thread"
Comment 3 Marc Khouzam CLA 2014-12-18 15:58:46 EST
I've put a little blurb a the bottom of the Debug part of the N&N in case this can help people extending CDT.
Comment 4 Marc Khouzam CLA 2014-12-18 16:17:24 EST
I pushed an update to this because there was a collision between the launch tabs of the example plugin with the actual DSF-GDB plugin.  I had forgotten to change the tab ids.  Fix here committed here:

http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a38c6c6d86de1ab4f7f026c3f5437ea8ddfffa6f
Comment 5 CDT Genie CLA 2014-12-19 01:00:04 EST
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 441277 - Fix colliding tab ids in example plugin that extends
    DSF-GDB
    Change-Id: Iac8e2802e78db88d6fcf6e4ee048df1efacd6303
    Signed-off-by: Marc Khouzam <marc.khouzam@xxxxxxxxxxxx>

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a38c6c6d86de1ab4f7f026c3f5437ea8ddfffa6f