Community
Participate
Working Groups
Created attachment 190883 [details] Abeer bagul's patch from 326951 Submission from Abeer Bagul, copied from https://bugs.eclipse.org/bugs/show_bug.cgi?id=326951. When we (in the Xtensa Xplorer IDE) create a subclass of GDBLaunchDelegate and a subclass of GDBLaunch, my intention is just to return the object of the GDBLaunch subclass from the getLaunch() method. I would not like to override the entire getLaunch() method, as this forces me to override the launch object initialization sequence also. If the getLaunch() method can call a createLaunch() method to get the launch object, and the createLaunch() method is protected, then we can just override createLaunch(), return an object of GDBLaunch subclass, and have the getLaunch() method do the initialization of the launch object. If I want to override the initialization sequence of the launch object, override getLaunch() as well as createLaunch(). The same applies to GDBLaunchDelegate.getSourceLocator(). This should delegate object creation to a protected createSourceLocator(), which just returns a new DSFSourceLocator. Subclasses of GDBLaunchDelegate can just override createSourceLocator, or override getSourceLocator() too if they want to change the initialization sequence of the sourcelocator object. Am attaching the modified patch with addition of two methods: createLaunch() createSourceLocator() and calling these from getLaunch and getSourceLocator respectively.
(In reply to comment #0) > Created attachment 190883 [details] > Abeer bagul's patch from 326951 Abeer, can you re-attach the patch yourself? I need that to set the iplog flag on your name. Thanks.
Created attachment 201000 [details] Slightly updated fix to add parameters to new API This is Abeer's patch except that I have 1- renamed createLaunch() to createGdbLaunch() since it must return a GdbLaunch 2- renamed createSourceLocator() to createDsfSourceLocator() since it must return a DsfSourceLookupDirector 3- added an ISourceLocator parameter to createGdbLaunch(). GdbLaunch requires a ISourceLocator as a parameter and although we currently pass null, we may need to pass a real one in the future. 4- added an ILaunchConfiguration parameter to createDsfSourceLocator(). It seemed more future-proof. I'll commit to master.
Created attachment 201002 [details] Cleanup to remove global variables Here is a patch that cleans up GdbLaunchDelegate a little to make it even easier to override. The patch removes the need for the annoying global variables and relies on the ILaunchConfiguration instead. For backwards-compatibility, I had to keep newServiceFactory(String) but I deprecated it. There is a new newServiceFactory(ILaunchConfiguration,String) to use instead. To keep the deprecated one working as expected though, I had to keep the global fIsNonStopSession, but new users won't need it anymore. I'll commit this to master as well.
Mikhail, what do you think of this change? Abeer, can you confirm this achieves what you wanted? (and attach the patch yourself so I can add the iplog flag)
*** cdt git genie on behalf of Marc Khouzam *** Bug 339550: Allow to override GdbLaunch [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0d2872027c4075eb4e2c583ebabce6b983a72567
*** cdt git genie on behalf of Marc Khouzam *** Bug 339550: Cleanup GdbLaunchDelegate for easier overriding [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0f94c41a730ebaebc2f05fed27e509af796b6007
Created attachment 201139 [details] non functional patch for iplog purposes. I have reattached the patch from attachment 201000 [details], since it is required for iplog purposes. Please do not use this patch for patching purposes, use attachment 201000 [details] instead.
Looks good.