Bug 229491 - [disassembly] NPE when opening the DisassemblyView while there is an existing breakpoint
Summary: [disassembly] NPE when opening the DisassemblyView while there is an existing...
Status: CLOSED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf (show other bugs)
Version: 0 DD 1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: DD 1.0   Edit
Assignee: DD General Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-04-29 17:41 EDT by Francois Chouinard CLA
Modified: 2009-01-07 17:01 EST (History)
2 users (show)

See Also:


Attachments
Fix for NPE (+committed, +logged) (963 bytes, patch)
2008-04-30 04:34 EDT, Anton Leherbauer CLA
pawel.1.piech: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Chouinard CLA 2008-04-29 17:41:11 EDT
To reproduce:
(1) Set a breakpoint then open the DSF Disassembly View from the menu, or
(2) Refresh View from the DSF Disassembly View context menu

Observations (file DisassemblyDocument.java):
- In getSourcePosition(), the fSource field of the SourceFileInfo structure is
not yet initialized (value null), causing the NPE
- The SourceFileInfo structure is populated by a SourceReadingJob that is
guaranteed (in that case) to execute after getSourcePosition() tries to access
the fSource field (not good)


Here's a trace:

eclipse.buildId=I20080409-1425
java.version=1.5.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_CA
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/home/francois/Eclipse/workspaces/DSF/../runtime-DSF -dev
file:/home/francois/Eclipse/workspaces/DSF/.metadata/.plugins/org.eclipse.pde.core/DSF/dev.properties
-debug
/home/francois/Eclipse/workspaces/DSF/.metadata/.plugins/org.eclipse.pde.core/DSF/.options
-os linux -ws gtk -arch x86


Error
Fri Apr 25 17:05:21 EDT 2008
Unhandled event loop exception

java.lang.NullPointerException
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument.getSourcePosition(DisassemblyDocument.java:546)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument.getSourcePosition(DisassemblyDocument.java:515)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.createPositionFromSourceLine(BreakpointsAnnotationModel.java:177)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.createPositionFromBreakpoint(BreakpointsAnnotationModel.java:154)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.addBreakpointAnnotation(BreakpointsAnnotationModel.java:133)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.addBreakpoints(BreakpointsAnnotationModel.java:78)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.catchupWithBreakpoints(BreakpointsAnnotationModel.java:73)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel.access$1(BreakpointsAnnotationModel.java:70)
        at
org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.BreakpointsAnnotationModel$1.run(BreakpointsAnnotationModel.java:221)
        at org.eclipse.swt.widgets.Display.timerProc(Display.java:3824)
        at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native
Method)
        at
org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1504)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2980)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2375)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2205)
        at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
        at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
        at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:473)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
        at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
        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:362)
        at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Comment 1 Anton Leherbauer CLA 2008-04-30 04:34:26 EDT
Created attachment 98132 [details]
Fix for NPE (+committed, +logged)

This patch fixes the NPE by simply returning null when fSource is null. This happens when the source has not been loaded yet.
The breakpoint annotation will be added later in this case.
Comment 2 Francois Chouinard CLA 2008-04-30 15:40:42 EDT
Thanks Anton.

Your patch works fine. I will commit it.

BR,
/fc
Comment 3 Pawel Piech CLA 2008-05-07 14:30:31 EDT
Francois, 
Same here, you can verify it.
Comment 4 Pawel Piech CLA 2008-08-13 13:05:23 EDT
Closing out 1.0 bugs.