Community
Participate
Working Groups
Build Identifier: 201006141710 CDT debugger throws NullPointerExceptions when sources are in linked folder which is linked to a remote system. CDT should not be calling IFile.getLocation(). If I make the following changes to CDT code, linked resources are no longer a problem. CDebugUIUtils.getEditorFilePath(): Change: if ( input instanceof IFileEditorInput ) { return ((IFileEditorInput)input).getFile().getLocation().toOSString(); } To: if ( input instanceof IFileEditorInput ) { IFile file = ((IFileEditorInput)input).getFile(); IPath path = file.getProject().getLocation().append(file.getProjectRelativePath()); return path.toOSString(); } CBreakpointManager.isSameBreakPoint(): Change: Object sourceElement = getSourceElement( file ); if ( sourceElement instanceof IFile ) { sourceHandle = ((IFile)sourceElement).getLocation().toOSString(); } To: Object sourceElement = getSourceElement( file ); if ( sourceElement instanceof IFile ) { IFile ifile = ((IFile)sourceElement); IPath path = ifile.getProject().getLocation().append(ifile.getProjectRelativePath()); sourceHandle = path.toOSString(); } DisassemblyBlock.createSourceLines(): Change: if ( element instanceof IFile ) { file = ((IFile)element).getLocation().toFile(); } To: if ( element instanceof IFile ) { IFile ifile = ((IFile)element); IPath path = ifile.getProject().getLocation().append(ifile.getProjectRelativePath()); file = path.toFile(); } DisassemblyBackEndCdi.insertDisassembly(): Change: else if (srcElement instanceof IFile) { compilationPath = ((IFile)srcElement).getLocation().toString(); } To: else if (srcElement instanceof IFile) { IFile ifile = ((IFile)srcElement); IPath path = ifile.getProject().getLocation().append(ifile.getProjectRelativePath()); compilationPath = path.toString } Reproducible: Always Steps to Reproduce: I've implemented a remote file system using EFS. I'm not sure how to set up a simple example. I've seen that there's been an effort to support EFS in CDT (e.g., error parser handling of URIs). The fix is very straightforward, however, since it simply involves replacing calls to IFile.getLocation() to a link-friendly way of returning absolute paths. The underlying problem is that getLocation() calls: FileSystemResourceManager.locationFor(IResource) which in turn calls this method: FileStoreRoot.localLocation(IPath, IResource) FileStoreRoot will always return null for a linked resource as noted in a comment in its source file: /** * If this root represents a resource in the local file system, this path * represents the root location. This value is null if the root represents * a non-local file system */ private IPath localRoot = null; . . . IPath localLocation(IPath workspacePath, IResource resource) { if (localRoot == null) return null;
Hi Steve. Maybe this would get more attention if you attached a patch? http://wiki.eclipse.org/CDT/contributing
(In reply to comment #1) > Hi Steve. Maybe this would get more attention if you attached a patch? > http://wiki.eclipse.org/CDT/contributing Thanks for the tip. I'll look into it.
Hi Steve and Marc, How about the patch? I think it is greatly helpful, and should be included into the mainstream. I have verified in my local environment (ecilpse 3.7 + cdt 8.02), and I can add breakpoint onto EFS file correctly as what I have done in JDT. Regards, Zhiming