2011-02-07 5 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 [BinaryName]"명령을 실행하기 전에 동일한 SIGILL 오류가 발생하지 않는다는 것입니다.

아이디어가 있으십니까?

덕분에, 앨런

답변

1

내가 문제를 발견했습니다 그리고 그것은 내가 전화했다는 사실과 관련되었다고 생각 "부하 [BinaryName]"명령 프롬프트에서가 아니라 이클립스에서 디버깅 할 때.

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