Bug 443192 - "Lookup File..." in TCFCSourceNotFoundEditor for launch configurations associated with CDT project?
Summary: "Lookup File..." in TCFCSourceNotFoundEditor for launch configurations assoc...
Status: ASSIGNED
Alias: None
Product: TCF
Classification: Tools
Component: Debug (show other bugs)
Version: 1.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-03 06:58 EDT by Mattias Bertilsson CLA
Modified: 2014-09-05 04:19 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mattias Bertilsson CLA 2014-09-03 06:58:13 EDT
In TCF C/C++ debug sessions (using org.eclipse.tcf.debug.LaunchConfigurationType), if a source file can't be found in the location indicated in the binary, I get TCFCSourceNotFoundEditor in its place with a few options, one of which is "Locate File...". Selecting this and indicating the actual location of the file (not in the workspace), generates a path mapping in the launch configuration and the TCFCSourceNotFoundEditor is replaced with a CEditor showing the file contents.

However, if the launch configuration also contains an association to a CDT project, using the CDT key "org.eclipse.cdt.launch.PROJECT_ATTR", the path mapping will be generated just fine, but the CEditor will not open.

I debugged this a bit and it seems the reason is that MapEntrySourceContainer.findSourceElements() (in org.eclipse.cdt.debug.core), which is used with or without the CDT project association, will then return the actual file to use as an ITranslationUnit, rather than a plain IFile or IStorage. This makes TCFModelPresentation.getEditorInput() (in org.eclipse.tcf.debug.ui) just fall through and return null.

Is this expected behaviour? Shouldn't all the forms in which the SourceContainers used may return the results be handled?

The reason I am asking is that I am working with product which combines TCF C/C++ debug sessions with the launch of other things, and those things are associated with a CDT project, which means that the CDT key will be found in the launch configurations. While I check if there is a way I can avoid that, it would be nice to know if this can be fixed in the TCF code.
Comment 1 Anton Leherbauer CLA 2014-09-05 04:19:45 EDT
We need to handle ITranslationUnit in TCFModelPresentation.getEditorInput().
The problem is: this code must not have a dependency on CDT.
A TU based on an Eclipse resource is adaptable to IFile, but in this case we get an ExternalTranslationUnit which does not adapt to something useful AFAIK.
We probably need an adapter factory in org.eclipse.tcf.cdt which converts an ExternalTranslationUnit to e.g. IStorage or ILocationProvider.