Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CDT breakpoints and debug adapters throw NullPointerException with linked resources

Hi,

I posted this message to the CDT forum yesterday, but I realized this may be a
more appropriate list as this is a query about what I believe to be a CDT bug.

I've created an EFS implementation so my projects can work with remote resources.
This is going quite nicely, but I ran into a problem with remote debugging with
ResumeAtLineAdapter and other debug-related objects.

When a debug session starts, my source look-up object returns an IFile whose
path contains a linked resource. CDT then nicely loads the remote source file
into an editor. Problems occur (NullPointerException), though, when the
ResumeAtLineAdpater is getting set up (and similar issues happen when I try
to set breakpoints).

ResumeAtLineAdapter calls CDebugUIUtils.getEditorFilePath() to get the path
associated with an IEditorInput object like this:

   public static String getEditorFilePath( IEditorInput input ) throws CoreException {
     if ( input instanceof IFileEditorInput ) {
 -->   return ((IFileEditorInput)input).getFile().getLocation().toOSString();
     }

That call results in a call to getLocation() (see above), which in turn calls:

 FileSystemResourceManager.locationFor(IResource)

which in turn calls this method:

 FileStoreRoot.localLocation(IPath, IResource)

The problem is, FileStoreRoot will always return null for a linked resource, which will result
in an unhandled NullPointerException:


 /**
  * 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;

It seems to me that this is a bug in getEditorFilePath(). It should not be
calling getLocation(), as that assumes that the resource is local, which,
in this case, it isn't.

If anyone has a suggestion for a workaround, I would greatly appreciate it.

I could open a bug on this if it seems warranted. I think I did see a related
bug about not being able to relocate a workspace due to breakpoints using
absolute paths (or something similar).

Thanks!

--Steve


Back to the top