Plugins 自定义Eclipse调试配置

Plugins 自定义Eclipse调试配置,plugins,gcc,gdb,debugging,eclipse-cdt,Plugins,Gcc,Gdb,Debugging,Eclipse Cdt,我有一个自定义的gcc/gdb构建,我正试图将其与eclipsecdt插件集成。我已经创建了一个定制的Eclipse工具链,并且可以成功地使用它进行构建 我现在试图做的是启用远程调试,但目前没有成功 我创建了一个启动配置子类,它扩展了AbstractCLaunchDelegate。在启动方法中,我有如下代码: public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressM

我有一个自定义的gcc/gdb构建,我正试图将其与eclipsecdt插件集成。我已经创建了一个定制的Eclipse工具链,并且可以成功地使用它进行构建

我现在试图做的是启用远程调试,但目前没有成功

我创建了一个启动配置子类,它扩展了AbstractCLaunchDelegate。在启动方法中,我有如下代码:

public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException
{
    // Get path to binary
    IPath exePath = CDebugUtils.verifyProgramPath(configuration);
    ICProject project = CDebugUtils.verifyCProject(configuration);
    IBinaryObject exeFile = verifyBinary(project, exePath);

    // If debugging
    if(mode.equals("debug"))
    {
        // Get debug configuration
        ICDebugConfiguration config = getDebugConfig(configuration);

        // Get debugger instance
        ICDIDebugger2 debugger = (ICDIDebugger2)config.createDebugger();

        // Create session
        ICDISession session = debugger2.createSession(launch, exePath.toFile(), monitor);

        // Note: Copied from LocalCDILaunchDelegate
        boolean stopInMain = configuration.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false );
        String stopSymbol = null;
        if ( stopInMain )
            stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
        ICDITarget[] targets = session.getTargets();
        for( int i = 0; i < targets.length; i++ ) {
            Process process = targets[i].getProcess();
            IProcess iprocess = null;
            if ( process != null ) {
                iprocess = DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ), getDefaultProcessMap() );
            }

            // Note: Failing here with SIGILL
            CDIDebugModel.newDebugTarget( launch, project.getProject(), targets[i], renderTargetLabel( config ), iprocess, exeFile, true, false, stopSymbol, true );
        }
    }
}
public void启动(ILaunchConfiguration配置、字符串模式、ILaunch启动、IProgressMonitor监视器)引发异常
{
//获取二进制文件的路径
IPath exePath=CDebugUtils.verifyProgramPath(配置);
ICProject=CDebugUtils.verifyCProject(配置);
IBinaryObject exeFile=verifyBinary(项目,exePath);
//如果调试
if(mode.equals(“调试”))
{
//获取调试配置
ICDebugConfiguration=getDebugConfig(配置);
//获取调试器实例
ICDIDebugger2调试器=(ICDIDebugger2)config.createDebugger();
//创建会话
ICDISession session=debugger2.createSession(启动,exePath.toFile(),监视器);
//注意:从LocalCDILaunchDelegate复制
boolean stopInMain=configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR\u调试器\u STOP\u位于\u MAIN,false);
字符串stopSymbol=null;
如果(停止分钟)
stopSymbol=launch.getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR\u DEBUGGER\u STOP\u位于\u MAIN\u符号,ICDTLaunchConfigurationConstants.DEBUGGER\u STOP\u位于\u MAIN\u符号\u默认值);
ICDITarget[]targets=session.getTargets();
for(int i=0;i
我的问题是,调用CDIDebugModel.newDebugTarget()时,我从GDB返回了一个SIGILL错误。如果我不使用这一行,则会创建调试器会话,但不会命中断点

当我尝试在命令提示符下使用在Eclipse中创建(失败)的相同二进制文件手动调试时,我没有任何问题。我注意到的唯一区别是在运行“continue”命令之前调用“load[BinaryName]”(不这样做会导致相同的SIGILL错误)

有什么想法吗

谢谢,
Alan

我想我已经找到了问题所在,这与我在命令提示符下调试时调用“load[BinaryName]”有关,而不是在Eclipse中

我发现我需要获得一个MISession,然后调用MITargetDownload命令(这似乎相当于我的手动“load[BinaryName]”命令)

这方面的基本代码是:

// Get MI session
MISession miSession = target.getMISession();

// Get target download command for loading program on target
MITargetDownload targetDownload = miSession.getCommandFactory().createMITargetDownload(exePath.toOSString());

// Load program on target
miSession.postCommand(targetDownload);
这需要在调用CDIDebugModel.newDebugTarget之前进行

希望这能在这个问题下划清界限,至少能帮助其他处于类似情况的人

谢谢,
Alan

我想我已经找到了问题所在,这与我在命令提示符下调试时调用“load[BinaryName]”有关,而不是在Eclipse中

我发现我需要获得一个MISession,然后调用MITargetDownload命令(这似乎相当于我的手动“load[BinaryName]”命令)

这方面的基本代码是:

// Get MI session
MISession miSession = target.getMISession();

// Get target download command for loading program on target
MITargetDownload targetDownload = miSession.getCommandFactory().createMITargetDownload(exePath.toOSString());

// Load program on target
miSession.postCommand(targetDownload);
这需要在调用CDIDebugModel.newDebugTarget之前进行

希望这能在这个问题下划清界限,至少能帮助其他处于类似情况的人

谢谢, 艾伦