开发者

adding a new command to gdb while using cdt eclipse

Good day, I am writing to you because I tried to follow your instructions [here: http://wiki.eclipse.org/CDT/cdt-debug-dsf-gdb-extensibility ] for adding a new command to gdb while using cdt eclipse. I does not seem to work at all. I put print statements in all of the methods of all the extended classes. Nothing gets printed, which indicates that none of these methods are called. Following is my code开发者_Go百科. What am I missing? (i didn't get to the point of actually implementing the new services factory since i there

plugin.xml:

<plugin>
  <extension
         point="org.eclipse.debug.core.launchDelegates">
      <launchDelegate
            delegate="tracerdubug.MyTracerLaunchDelegate"
            id="TracerDubug.MyTracerLaunchDelegate"
            modes="debug, run">
      </launchDelegate>
   </extension>
</plugin>
TracerRunControl:
public class TracerRunControl extends GDBRunControl_7_0 {

    public TracerRunControl(DsfSession session) {
        super(session);
        System.out.println("TracerRunControl");
    }

}

//################################################################

public class MyTracerLaunchDelegate extends GdbLaunchDelegate implements ILaunchConfigurationDelegate2{

    public MyTracerLaunchDelegate() {
        super();
        System.out.println("MyTracerLaunchDelegate::ctr()");
    }


    @Override
    public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
        System.out.println("MyTracerLaunchDelegate::launch()");      
super.launch(config, mode, launch, monitor);     
    }


    @Override
    protected IDsfDebugServicesFactory newServiceFactory(String version) {
        System.out.println("MyTracerLaunchDelegate");
        return new TracerDebugServicesFactory(version);
    }
}

//################################################################

public class TracerDebugServicesFactory extends GdbDebugServicesFactory {

    public TracerDebugServicesFactory(String version) {
        super(version);
        // TODO Auto-generated constructor stub
    }

    @Override
    protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
        GDBControl_7_0 g = new GDBControl_7_0(session,config);
        System.out.println("TracerDebugServicesFactory::createCommandControl");
        return g;
    }

    @Override
    protected IRunControl createRunControlService(DsfSession session) {
        System.out.println("TracerDebugServicesFactory::createProcessesService");
        return new TracerRunControl(session);  
    }

    @Override
    protected IProcesses createProcessesService(DsfSession session) {
        System.out.println("TracerDebugServicesFactory::createProcessesService");
       return new GDBProcesses_7_0(session);
    }
}

Thanks, Shai


I had the same problem and got the answer from another forum. You must add more info and more extensions:

<extension
point="org.eclipse.debug.core.launchDelegates">
      <launchDelegate

    delegate="tracerdubug.MyTracerLaunchDelegate"
             delegate="Tracerdubug.MyTracerLaunchDelegate"
            delegateDescription="Your description"
            id="org.eclipse.cdt.dsf.gdb.launch.localCLaunch"
            modes="debug"
            name="My GDB Launch Delegate"
            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
            type="org.eclipse.cdt.launch.applicationLaunchType">
      </launchDelegate>
   </extension>
   <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
            <launchConfigurationTypeImage
            icon="icons/img.gif"
            configTypeID="Tracerdubug.MyTracerLaunchDelegate"
            id="Tracerdubug.TabGroups.launcher.Image">
        </launchConfigurationTypeImage>
    </extension>
    <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
        <launchConfigurationTabGroup
            type="Tracerdubug.MyTracerLaunchDelegate"
            class="Tracerdubug.TabGroups.TabGroupTest"
            id="Tracerdubug.TabGroups.TabGroupTest">
        </launchConfigurationTabGroup>
     </extension>

and you need a new class = Tracerdubug.TabGroups.TabGroupTest:

package Tracerdubug.TabGroups;

import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CDebuggerTab;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainAttachTab;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.AttachCDebuggerTab;
import org.eclipse.cdt.launch.ui.CArgumentsTab;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class TabGroupTest extends AbstractLaunchConfigurationTabGroup {

    // Create an array of tabs to be displayed in the debug dialog
    public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
        ILaunchConfigurationTab[] tabs = 
            new ILaunchConfigurationTab[] {,
                new CMainAttachTab(),
                new CArgumentsTab(),
                new EnvironmentTab(),
                new SourceLookupTab(),
                new CommonTab(),
            };
        setTabs(tabs);
    }
}

You can also create your own tabs, see: http://www.eclipse.org/articles/Article-Launch-Framework/launch.html

My command factory is loaded, I'm now learning how to use an existing service to send the command...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜