Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338769

Summary: [launch] Allow for different versions of the FinalLaunchSequence
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, nobody, pawel.1.piech, vladimir.prus
Version: 8.0Flags: marc.khouzam: review? (nobody)
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed fix
marc.khouzam: iplog-
Fix including JTag launch marc.khouzam: iplog-

Description Marc Khouzam CLA 2011-03-02 22:24:09 EST
The FinalLaunchSequence was used to complete the initialization of GDB before giving control to the user.  Recently, many of the steps of the FinalLaunchSequence have been moved to the IProcesses service to better support multi-process debugging.

However, the FinalLaunchSequence still does some steps to properly configure GDB.  The problem is that we cannot have different versions of the FinalLaunchSequence to handle differences in different GDB versions.

I suggest that instead of calling FinalLaunchSequence from the GdbLaunchDelegate, we first go through the IGDBControl service to then call the FinalLaunchSequence.  This would allow us to call a different FinalLaunchSequence based on the version of the IGDBControl service.

I have a patch that seems to work, but I have to clean it up a bit before posting it.
Comment 1 Marc Khouzam CLA 2011-03-03 12:32:38 EST
Created attachment 190292 [details]
Proposed fix

Here is what I suggest.  The patch creates a new method IGDBControl.completeInitialization() which will in turn call the FinalLaunchSequence.  This allows us to change the class to be called (say FinalLaunchSequence_7_2) from within a new version of the IGDBControl service.

The solution also provides with an getCompleteInitializationSequence() method that can be overridden by subclasses. 

The tricky part of this solution was to keep the ability to cancel the launch during the launch sequence.  That is why I used a RequestMonitorWithProgress.

I still have to fix the JTag launch for these changes.
Comment 2 Marc Khouzam CLA 2011-03-03 12:34:49 EST
Mikhail, could you confirm this solution is ok for your extending of DSF-GDB.

BTW, I still can't set the review flag for you.
Comment 3 Marc Khouzam CLA 2011-03-03 12:39:00 EST
(In reply to comment #2)
> Mikhail, could you confirm this solution is ok for your extending of DSF-GDB.

I thought I would give more details.  With this solution

1- instead of overriding GdbLaunchDelegate.getFinalLaunchSequence() you now need to override GDBControl.getCompleteInitializationSequence() and GDBControl_7_0.getCompleteInitializationSequence()

2- The constructor of FinalLaunchSequence has changed (and is simpler), so you will have to modify any subclass.

That should be it.
Comment 4 Marc Khouzam CLA 2011-03-03 13:54:06 EST
Created attachment 190300 [details]
Fix including JTag launch

Here is the full patch.  It is the same as before, but also contains the JTag changes that were required.

Having to extend base DSF-GDB for JTag made me realize that this change makes things a little more complicated for an extender.  However, to achieve different versions of the FinalLaunchSequence, I don't think there is a better way than to go through a service.

I'm looking forward to comments on this.
Since API freeze is in a week, failing any comments, I will commit on Monday.
Comment 5 Marc Khouzam CLA 2011-03-04 08:44:47 EST
(In reply to comment #2)
> Mikhail, could you confirm this solution is ok for your extending of DSF-GDB.
> 
> BTW, I still can't set the review flag for you.

The review flag now works for Mikhail
Comment 6 Marc Khouzam CLA 2011-03-07 13:05:20 EST
Committed to HEAD.
Comment 7 CDT Genie CLA 2011-03-07 13:23:23 EST
*** cdt cvs genie on behalf of mkhouzam ***
Bug 338769: Allow for different versions of the FinalLaunchSequence

[+] MacOSGdbJtagDebugServicesFactory.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/macos/MacOSGdbJtagDebugServicesFactory.java?root=Tools_Project&revision=1.1&view=markup

[+] GDBJtagControl_7_2.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/GDBJtagControl_7_2.java?root=Tools_Project&revision=1.1&view=markup
[+] GdbJtagDebugServicesFactory.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/GdbJtagDebugServicesFactory.java?root=Tools_Project&revision=1.1&view=markup
[+] GDBJtagControl_7_0.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/GDBJtagControl_7_0.java?root=Tools_Project&revision=1.1&view=markup
[+] GDBJtagControl.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/GDBJtagControl.java?root=Tools_Project&revision=1.1&view=markup

[*] GDBJtagDSFFinalLaunchSequence.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java?root=Tools_Project&r1=1.13&r2=1.14
[*] GDBJtagDSFLaunchConfigurationDelegate.java 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFLaunchConfigurationDelegate.java?root=Tools_Project&r1=1.3&r2=1.4

[*] MANIFEST.MF 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF?root=Tools_Project&r1=1.11&r2=1.12

[*] GdbDebugServicesFactory.java 1.16 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java?root=Tools_Project&r1=1.15&r2=1.16

[*] GdbLaunchDelegate.java 1.22 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java?root=Tools_Project&r1=1.21&r2=1.22
[*] FinalLaunchSequence.java 1.21 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java?root=Tools_Project&r1=1.20&r2=1.21