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

Bug 341607

Summary: Empty editor content for unavailable file resources when debugger steps into those source files
Product: [Tools] CDT Reporter: Teodor Madan <teodor.madan>
Component: cdt-debugAssignee: cdt-debug-inbox <cdt-debug-inbox>
Status: RESOLVED FIXED QA Contact: Ken Ryall <ken.ryall>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 7.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix teodor.madan: iplog-

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