Menu

#145 geninfo doesn't handle interior inlined functions nicely

open
nobody
Tools (21)
5
2009-03-10
2009-03-10
No

Compiling the following source for coverage:

main()
{
inline void func() {
printf("howdy\n");
}
func();
foo();
}

foo(void)
{
inline void func() {
printf("in in\n");
}

func();
}

The compiler creates func.<number> and func.<another-number> to name the inlined functions. Those interior functions have their names changed to
func_<number> and func_<another-number> in read_gcno_file, and then they show up in the generated lcov file like:

FN:3,func_1278
FN:2,main
FN:13,func_1298
FN:12,foo

There's no way of telling from this what lines between 3 and 12 belong to main and which belong to func_1278.

For determining function coverage, I'd be happy to throw away the FN: lines that correspond to interior inlined functions, but it's difficult to
distinguish between a real function named func_1278 and an interior function that has been mangled from func.1278 (can I use the non-monotonicity
of the line numbers? is geninfo guaranteed to emit FN lines for interior functions prior to the FN lines for the enclosing function?). Is there a
reason for the name mangling? Would it be possible to leave the function name as func.1278 in the lcov file?

Discussion

  • Enji Cooper

    Enji Cooper - 2009-03-12

    Have you tried asking this question on the lcov / gcc list? I don't think this is specific _just_ to LTP.
    Thanks,
    -Garrett

     
  • Brian Scearce

    Brian Scearce - 2009-03-12

    I got lcov through this project, and thought it came from here. I'll take it up with lcov specifically, thanks.

     

Log in to post a comment.