2011-10-31 53 views
2

我最近完成了Ubuntu 11.10的全新安裝,安裝了最新版本的Eclipse CDT。我試圖用CMake生成的makefile和Eclipse項目文件來調試現有的C++項目。在試圖調試(與所有的調試配置給出正確的設置),發射失敗,錯誤:Eclipse CDT未能在Ubuntu 11.10中進行調試,拋出java.lang.NullPointerException

An internal error occurred during: "Launching mops-app". 
java.lang.NullPointerException 

嘗試調試最小的Hello World項目時,這不會發生。該項目可以在Ubuntu 11.04上使用最新版本的Eclipse CDT成功調試。我的機器上的Java版本是:

java version "1.6.0_23" 
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5) 
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) 

而且從試圖啓動調試配置的輸出Eclipse是:

!ENTRY org.eclipse.core.jobs 4 2 2011-10-31 11:50:24.211 
!MESSAGE An internal error occurred during: "Launching mops-app". 
!STACK 0 
java.lang.NullPointerException 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1837) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1848) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1848) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.setSourceLookupPath(CDebugTarget.java:1815) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initializeSourceLookupPath(CDebugTarget.java:383) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initialize(CDebugTarget.java:282) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.<init>(CDebugTarget.java:275) 
    at org.eclipse.cdt.debug.core.CDIDebugModel$1.run(CDIDebugModel.java:100) 
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344) 
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326) 
    at org.eclipse.cdt.debug.core.CDIDebugModel.newDebugTarget(CDIDebugModel.java:105) 
    at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launchLocalDebugSession(LocalCDILaunchDelegate.java:162) 
    at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launchDebugger(LocalCDILaunchDelegate.java:112) 
    at org.eclipse.cdt.launch.internal.LocalCDILaunchDelegate.launch(LocalCDILaunchDelegate.java:72) 
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854) 
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703) 
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928) 
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132) 
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) 

回答

2

該問題與升級CMake版本有關。 CMake 2.8.5在Eclipse .cproject.project文件中生成了「子項目」條目。出於某種原因,CMake默認告訴Eclipse忽略子項目路徑,因此在試圖調試代碼時會混淆Eclipse的索引器。

該問題很容易通過註釋.project文件的<linkedResources>條目來解決,例如,

<!--link> 
    <name>[Subprojects]/MOPS</name> 
    <type>2</type> 
    <location>/home/user/mops-c-Git/src/mopsc</location> 
</link--> 

和評論時的.cproject文件的子項目部分<pathentry>條目,例如

<!--pathentry kind="src" path="MOPS"/> 
<pathentry excluding="MOPS/|**/CMakeFiles/" kind="out" path=""/--> 
+0

啊哈!這也解決了我的問題,但我手動創建了一個鏈接的資源,這使得調試器變得混亂,被刪除,工作,現在真棒! – iondiode

+0

@iondiode是的,這確實是由於鏈接的資源。如果你仍然需要鏈接資源,我發現了另一個修復,請參閱我的答案 – Carl

1

確保所選擇的可執行文件在運行/運行或運行運行/調試菜單。

+0

檢查了這一點,而不是問題。 –

1

我有一個類似的問題(Ubuntu的14.04,SBT 13.1.0) - 啓動調試器引起了java.lang.NullPointerException。通過eclipse-nios2 -consoleLog啓動Eclipse檢查日誌,我有類似的條目:

java.lang.NullPointerException 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1843) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1864) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.getSourceLookupPath(CDebugTarget.java:1864) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.setSourceLookupPath(CDebugTarget.java:1817) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initializeSourceLookupPath(CDebugTarget.java:385) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.initialize(CDebugTarget.java:286) 
    at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.<init>(CDebugTarget.java:279) 

我相信原因是相同的;我發現了另一個修復程序,並希望分享它的完整性。

我在我的項目中鏈接了資源,日誌讓我懷疑他們是原因。我已將資源鏈接到Import->General->File system->[... Create links in workspace...]

我刪除了這些鏈接,而是鏈接到了Project Properties->C/C++ General->Paths and Symbols->[tab] Source Location->Link folder...

這使調試器運行良好,沒有抱怨。

相關問題