Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Navigating between a C/C++ editor and some external editors (cross-indexing)

Hi all,

A compiler can produce some files (assembly file, intermediate 
representations, ...) that one may want to correlate with an original 
C/C++ source file. Once you have some Eclipse editors for those files, you 
would like to smoothly navigate between any external editor and the C/C++ 
editor (eg: from a basic block in a control-flow graph dumped by a 
compiler to the corresponding C/C++ statements). If the external file 
contains references to the original C/C++ file name/line number, one can 
ask the C/C++ editor to open the target file and reveal the corresponding 
line (it is a low level coupling, but that works). Navigating from the 
C/C++ editor to a non CDT editor is however more complicated because CDT 
does not have any knowledge of those external editors.

Anton Leherbauer kindly fixed bug 157050, so that the current CElement is 
now correctly visible to clients of the "Show In" protocol (
org.eclipse.ui.perspectiveExtensions/showInPart). However this extension 
point only allows to connect an editor to an external view and only 
provides the entity around the selection (which may not be accurate enough 
if for example you want to reveal the basic block corresponding to the 
selected C statement).

I can imagine the following scenario:
1) A project having multiple natures (eg: C/C++ and another one, let's 
call it TS, with an associated editor for .ts files)
2) Each nature has an indexer which contains references to files it can 
handle and of course also to all entities those files contain (eg: the CDT 
indexer knows all .c/.cpp files, the TS indexer all .ts files).
3) A protocol allowing those indexers to define the cross-relations 
between the editors they are associated to (eg: if foo.c and foo.ts have 
some "elements" in common, CDT and TS editors could collaborate to allow 
bi-directional navigation between those "elements" in both files).
4) Something similar to the "Show In" contextual menu in order to request 
the editor switch.

Does anyone have any interest for such a feature ? My initial purpose is 
to navigate between C/C++ source files and some intermediate files 
generated by a compiler, but one can probably imagine other contexts ... 

Any suggestions on how to tackle this problem on the CDT side ?

Regards, 
Philippe


Back to the top