Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337133 - NPE in CEditor when debugging CMake project
Summary: NPE in CEditor when debugging CMake project
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Debug Core (show other bugs)
Version: 4.0.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Greg Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-14 10:04 EST by Greg Watson CLA
Modified: 2011-02-14 14:46 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Watson CLA 2011-02-14 10:04:51 EST
A) Ubuntu, Eclipse and PTP installation

Prerequisites: Ubuntu 10.10, 64-bit
1. Install the packages mpich2, libmpich2-dev, libmpich-1.2, cmake, cmake-data
2. Download Eclipse IDE for C/C++ Linux Developers (includes Incubating components) (Linux 64-Bit version)
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliossr1
3. Unpack the .tar.gz file in a folder (e.g. /home/andrea/software/eclipse)
4. Run Eclipse, select as default workspace /home/andrea/code/workspace
5. Help->Install New Software
   Work with: Helios - http://download.eclipse.org/releases/helios
   Select: General Purpose Tools -> Parallel Tools Platform (PTP) End-User Runtime
PTP Remote Development Tools (RDT)
Remote System Explorer End-User Runtime
PTP Graphical Explorer of MPI Programs (GEM)
and install them
6. Restart Eclipse

B) SDM compilation

Follow the same instructions on the PTP release notes to compile the sdm
   1. Download the (ptp-proxy) server zip file from here: [1]
   2. Copy the server zip file to the target machine
   3. Unzip the server zip file into a temporary location
   4. Change to the proxy directory
   5. Locate the following directory, org.eclipse.ptp.linux.x86_64_4.0.5.201011100956/
   6. Change to this directory and run the command: 
     sh ./BUILD
    7. Copy the executable (./bin/sdm) in /home/andrea/software/eclipse/

C) Create and import a cmake project

1. Create a folder (outside the workspace) (e.g. /home/andrea/code/test)
2. Create two subfolders in test, build/ and src/
Create test.c and CMakeLists.txt in src

test.c contains:

#include <stdio.h>

int main(int argc, char*argv[]) {
   printf("Hello world\n");
}

The CMakeLists.txt contains:

cmake_minimum_required (VERSION 2.6)
project (Test)
add_executable(test test.c)

3. cd build, then run 
cmake -DCMAKE_BUILD_TYPE=Debug -G"Eclipse CDT4 - Unix Makefiles" ../src
4. From Eclipse:
File -> Import -> General -> Existing Projects into Workspace
Select root directory : /home/andrea/code/test/build 
and import the project
6. Parallel Runtime -> Resource Managers -> Add Resource Manager
MPICH2, Local, Local, Tunnelling: node, localhost, click Next
Use default commands, Use default location, next
Use default name and description, DESELECT Automatically start resource manager..., Finish
7. From a console type mpd &
8. From Eclipse Start the resource manager
9. Run -> Debug Configurations -> New Parallel Appliication
Resource Manager: MPICH2
Application:
  - Parallel Project: Test-Debug@build
  - Application Program: /home/andrea/code/test/build/test
  - Debugger: SDM, Path /home/andrea/software/eclipse/sdm
Click on Debug


The debugger starts, but when you try to give a look at the code,
the editor says:
Could not open the editor: Editor could not be initialized.
Exception:
java.lang.NullPointerException
    at org.eclipse.cdt.internal.ui.editor.CEditor.updateScalabilityMode(CEditor.java:1412)
    at org.eclipse.cdt.internal.ui.editor.CEditor.doSetInput(CEditor.java:1359)
    at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3043)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2600)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3061)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3088)
    at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
    at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
    at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
    at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
    at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
    at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254)
    at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207)
    at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:497)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
    at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
    at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
    at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
    at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
    at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
    at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
    at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$1.run(SourceLookupFacility.java:352)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(SourceLookupFacility.java:362)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(SourceLookupFacility.java:276)
    at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.display(SourceLookupFacility.java:219)
    at org.eclipse.debug.ui.DebugUITools.displaySource(DebugUITools.java:792)
    at org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter$SourceDisplayJob.runInUIThread(StackFrameSourceDisplayAdapter.java:155)
    at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3164)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Greg Watson CLA 2011-02-14 10:05:17 EST
Reported by andrea.maesani@epfl.ch
Comment 2 Greg Watson CLA 2011-02-14 10:06:48 EST
The key to reproducing this appears to be importing the project using File>Import>General>Existing Projects into Workspace rather than as a C/C++ project
Comment 3 Greg Watson CLA 2011-02-14 14:46:38 EST
Re-enabled use of AbsolutePathSourceContainerType. Fixed in ptp_4_0 and HEAD.