【发布时间】:2011-02-07 23:20:17
【问题描述】:
我有一个自定义构建的 gcc/gdb,我正在尝试与 Eclipse CDT 插件集成。我已经创建了一个自定义 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 );
}
}
}
我的问题是调用 CDIDebugModel.newDebugTarget() 时从 GDB 返回 SIGILL 错误。如果我不考虑这一行,则会创建调试器会话,但不会遇到断点。
当我尝试使用在 Eclipse 中创建(但失败)的相同二进制文件在命令提示符下手动调试时,我没有任何问题。我注意到的唯一区别是我在运行“继续”命令之前调用了“加载 [BinaryName]”(不这样做会导致相同的 SIGILL 错误)。
有什么想法吗?
谢谢, 艾伦
【问题讨论】:
标签: plugins gcc gdb debugging eclipse-cdt