使用 cdt eclipse 时向 gdb 添加新命令

发布于 2024-12-03 03:45:20 字数 2830 浏览 0 评论 0原文

再会, 我写信给您是因为我尝试遵循您的指示[此处:http: //wiki.eclipse.org/CDT/cdt-debug-dsf-gdb-extensibility ] 用于在使用 cdt eclipse 时向 gdb 添加新命令。 我好像根本没工作。我将打印语句放在所有扩展类的所有方法中。没有打印任何内容,这表明没有调用这些方法。以下是我的代码。我缺少什么? (我没有真正实现新的服务工厂,因为我有

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);
    }
}

谢谢, 沙伊

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. 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久随 2024-12-10 03:45:20

我遇到了同样的问题,并从另一个论坛得到了答案。您必须添加更多信息和更多扩展:

<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>

并且您需要一个新类 = 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);
    }
}

您还可以创建自己的选项卡,请参阅:http://www.eclipse.org/articles/Article-Launch-Framework/launch.html

我的命令工厂已加载,我现在正在学习如何使用现有服务发送命令......

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文