Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341607 - Empty editor content for unavailable file resources when debugger steps into those source files
Summary: Empty editor content for unavailable file resources when debugger steps into ...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-01 08:06 EDT by Teodor Madan CLA
Modified: 2011-04-08 09:23 EDT (History)
2 users (show)

See Also:


Attachments
Fix (12.60 KB, patch)
2011-04-01 08:24 EDT, Teodor Madan CLA
teodor.madan: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Teodor Madan CLA 2011-04-01 08:06:50 EDT
"Resource does not exist" will be displayed in the editor when stack frame will reference a file that has the same prefix with a closed project. 

The scenarios can happen if your application is linked to a library code which project is closed in the workspace. As a user you might want to close library projects which you do not modify. 

Reproducibility steps:
1) Create a HelloWorld C/C++ executable project (called HelloWorld)
2) Create a C/C++ static library project (called HelloLib)
3) Add a testLib.c into library project with a "test" method in it, and build
4) Modify executable project to link with the static library that is output artifact of the library project. Also change "main" to call "test" method from the static library.
5) Build executable project
6) Close library project
7)Launch HelloWorld executable
8) Step into "test" method from the static library
9) Expecting to see contents of the test.c. 
10) set breakpoint in "test" method
11) Close "test.c" source file. Open breakpoints view and double click on the breakpoint from test.c 
12) expecting for eclipse to open editor for "test.c"


In fact at step 9) editor is displaying a message "Resource /HelloLib/src/test.c does not exist"
Comment 1 Teodor Madan CLA 2011-04-01 08:24:30 EDT
Created attachment 192349 [details]
Fix

1) Fix SourceUtils.updateUnavailableResources(IFile[], IProject) to check for IFile resources to be available, if not then replace IFile handlers with ITranslationUnit objects
2)CDebugModelPresentation.getEditorInput(Object) return ExternalEditorInput for resources that are not accessible
3) AbstractToggleBreakpointAdapter.getResource(IWorkbenchPart) check for marker resource being available.

Also, not directly related, but reveled during testing
4)  CompilationDirectorySourceContainer.findSourceElements(String) was throwing "UnsupportedOperationException" when having checked "Search for duplicates" and "Subdirectories are also used for compilation"
Comment 2 Teodor Madan CLA 2011-04-04 10:35:50 EDT
committed to HEAD
Comment 4 CDT Genie CLA 2011-04-08 09:23:06 EDT
*** cdt cvs genie on behalf of tmadan ***
Bug 341607 - Fixed potential NPE when director is null

[*] SourceUtils.java 1.19 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/SourceUtils.java?root=Tools_Project&r1=1.18&r2=1.19