Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342791

Summary: NPE in debug expression hover - null frame context
Product: [Tools] CDT Reporter: Kirk Beitz <kirk.beitz>
Component: cdt-debug-dsfAssignee: Anton Leherbauer <aleherb+eclipse>
Status: RESOLVED FIXED QA Contact: Pawel Piech <pawel.1.piech>
Severity: normal    
Priority: P3 CC: aleherb+eclipse, cdtdoug, ken.ryall
Version: 7.0.2   
Target Milestone: 8.0   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
guard against null frame returned from getFrame() at edge of debug session
none
guards against null IFrameDMContext in several functions aleherb+eclipse: iplog+, aleherb+eclipse: review+

Description Kirk Beitz CLA 2011-04-14 01:59:54 EDT
Created attachment 193219 [details]
guard against null frame returned from getFrame() at edge of debug session

at a point in the debug session where the frame was going away, i got a trace (not saved, unfortunately) in which an NPE was shown in the code referenced in the attached patch.
Comment 1 Anton Leherbauer CLA 2011-04-14 02:28:44 EDT
Makes sense.  The same could happen in evaluateExpression().
Comment 2 Kirk Beitz CLA 2011-04-14 02:49:38 EDT
Created attachment 193222 [details]
guards against null IFrameDMContext in several functions

(In reply to comment #1)
> Makes sense.  The same could happen in evaluateExpression().

ok, i've replaced the attachment with one including a null-guard for frame in evaluateExpression() as well, and also one in the execute() @override in private nested class GetExpressionValueQuery .

please commit on my behalf if you feel appropriate.  thanks.
Comment 3 CDT Genie CLA 2011-04-14 04:23:08 EDT
*** cdt cvs genie on behalf of aleherbau ***
Bug 342791 - NPE in debug expression hover - null frame context
Patch by Kirk Beitz

[*] AbstractDsfDebugTextHover.java 1.10 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/AbstractDsfDebugTextHover.java?root=Tools_Project&r1=1.9&r2=1.10
Comment 4 Anton Leherbauer CLA 2011-04-14 04:23:45 EDT
(In reply to comment #2)
> ok, i've replaced the attachment with one including a null-guard for frame in
> evaluateExpression() as well, and also one in the execute() @override in
> private nested class GetExpressionValueQuery .

The guard in execute() is not necessary with the one in evaluateExpression().  I removed that, but added a null check for dsfSession in getHoverInfo2().

> please commit on my behalf if you feel appropriate.  thanks.

Committed on HEAD, thanks.