我有一個自定義構建的gcc/gdb,我試圖與Eclipse CDT插件集成。我已經創建了一個自定義的Eclipse工具鏈,並且可以用它成功構建。自定義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);
}
}
}
我的問題是,我從GDB調用CDIDebugModel.newDebugTarget()的時候得到一個SIGILL錯誤回來。如果我離開這一行,則會創建調試器會話,但不會觸發斷點。
當我嘗試使用在Eclipse中創建(和失敗)的相同二進制文件在命令提示符下手動調試時,我沒有任何問題。我注意到的唯一區別是我在運行「continue」命令之前調用「load [BinaryName]」(不這樣做會導致相同的SIGILL錯誤)。
任何想法?
謝謝你,艾倫