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

Bug 350291

Summary: [unifyprofiling] GCov annotated editor seems out of place
Product: [Tools] Linux Tools Reporter: Andrew Overholt <overholt>
Component: GCovAssignee: Roland Grunberg <rgrunber>
Status: CLOSED FIXED QA Contact: Xavier Raynaud <xavier.raynaud>
Severity: normal    
Priority: P3 CC: lilia.ghachem
Version: unspecified   
Target Milestone: 3.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Before/After of GCov Editor Annotations none

Description Andrew Overholt CLA 2011-06-24 12:44:10 EDT
The GCov annotated editor, while very useful, seems out of place.  EclEmma editors open in the same .java editor but with the colourization.  Could we do this sort of thing for annotated .c/.cpp files?
Comment 1 Andrew Overholt CLA 2011-09-30 15:17:52 EDT
Updating Xavier's email address for existing bugs.
Comment 2 Roland Grunberg CLA 2014-04-07 17:10:38 EDT
I've started taking a look at this, and it's quite possible to do. I have a basic proof of concept where the SourceFile data (containing line information) is fed to an annotation model.
Comment 3 Roland Grunberg CLA 2014-04-08 16:13:34 EDT
Created attachment 241747 [details]
Before/After of GCov Editor Annotations

Going forward, annotations would appear in whichever editor opens the content by default (likely some instance of ICEditor).
Comment 4 Andrew Overholt CLA 2014-04-08 19:02:08 EDT
(In reply to Roland Grunberg from comment #3)
> Created attachment 241747 [details]
> Before/After of GCov Editor Annotations
> 
> Going forward, annotations would appear in whichever editor opens the
> content by default (likely some instance of ICEditor).

Awesome!  Should we maintain the hit counts and display the data in a hover (when the cursor is in the "gutter")?
Comment 5 Roland Grunberg CLA 2014-04-08 21:32:45 EDT
(In reply to Andrew Overholt from comment #4) 
> Awesome!  Should we maintain the hit counts and display the data in a hover
> (when the cursor is in the "gutter")?

Currently hovering over the the annotation (being sure to avoid the other tokens on a line) will display the number of times a line was executed. For some reason I thought the screenshot utility in Fedora ignored tooltips but looks like it's fine.

The main things to resolve currently :

- Better matching of the source file in the EditorPart (ICElement) to Gcov's SourceFile structure.
- Determine when to enable/disable the annotations.
Comment 6 Andrew Overholt CLA 2014-04-09 09:38:58 EDT
(In reply to Roland Grunberg from comment #5)
> (In reply to Andrew Overholt from comment #4) 
> > Awesome!  Should we maintain the hit counts and display the data in a hover
> > (when the cursor is in the "gutter")?
> 
> Currently hovering over the the annotation (being sure to avoid the other
> tokens on a line) will display the number of times a line was executed.

Very cool.

Great work here, Roland.
Comment 7 Roland Grunberg CLA 2014-04-11 15:06:22 EDT
Posted for review at https://git.eclipse.org/r/24876 .
Comment 8 Roland Grunberg CLA 2014-04-11 16:53:53 EDT
Committed to master as http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.git/commit/?id=9b57afda050b403d58b619b6b3d0b68abfc6cbd5 . Non-instrumented lines don't get annotated now (instead of showing up same as non-covered lines).

In the future we can consider colourizing based on relative hit counts within a project as before (will need to generate annotation preferences programmatically instead of defining them through extension point registry).