2011-02-07 8 views
1

Eclipse CDTプラグインと統合しようとしているgcc/gdbのカスタムビルドがあります。カスタムの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); 
     } 
    } 
} 

私の問題は、()CDIDebugModel.newDebugTargetを呼び出すときに、私は戻ってGDBからSIGILLエラーを取得していますということです。私はこの行を残して、デバッガセッションが作成されますが、ブレークポイントがヒットしない場合。

Eclipseで作成(および失敗)した同じバイナリを使用してコマンドプロンプトで手動でデバッグしようとすると、問題はありません。私が気づいた唯一の違いは、 "continue"コマンドを実行する前に(同じSIGILLエラーでこの結果を出さない) "load [BinaryName]"と呼んでいることでした。

アイデア?

おかげで、 アラン

答えて

1

私は問題を発見した、それは私が呼んでいたという事実に関連していたと思います「負荷[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への呼び出しの前に行く必要があります。

これは問題の下に線を引いて、少なくとも同じような状況で他の誰かを助けることを望みます。

ありがとう、 アラン