dimanche 29 avril 2018

Getting the sequence of Gcov's executed lines information

I'm trying to get the sequence of line of code executed by a test case. By using Gcov, the output .gcov file shows which line of codes are executed and how many times they are executed but no information about the sequence.

The problem is that I can't get the sequence of the executed lines. Let's use this program as an example:

//...
for(i = 0; i < n; i++) {
    if(a > b) {
        // do something (line 10 - 15)
    } else {
        // do something (line 17 - 20)
    }
}
//...

For example with input x, the loop body will be iterated twice where the true branch of the if executed on the first iteration and then the false branch on the second iteration.

With Gcov, I can't get the information mentioned above because the .gcov file will only show that all the lines from both branch are executed. There is no way I can figure out the sequence whether line 10-15 or line 17-20 are executed first.

Is there a way of getting the sequence of executed lines with Gcov? Or is there any alternatives of doing this? Thank you

Aucun commentaire:

Enregistrer un commentaire