[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] gcov



Hi,

On lauantai 05 helmikuu 2011, Vincent Rivière wrote:
> Eero Tamminen wrote:
> > What about the "gcov" and the GCC "-fprofile-arcs -ftest-coverage"
> > compilation options needed for it?  Do those work better?
> 
> I see that gcov is provided by gcc, while gprof is provided by the
> binutils.
> 
> Normally, a program compiled with "-fprofile-arcs -ftest-coverage" should
> produce a .gcda file when it is run.
> This does not occur on MiNT.
> I believe some support is missing from the MiNTLib.
> 
> Also, the libgcov.a shipped with my binaries is almost empty, this is
> because I didn't use --with-sysroot or --with-headers while configuring
> gcc to indicate where is the MiNTlib.

On Linux with GCC v4.4:

$ ar t /usr/lib/gcc/i486-linux-gnu/4.4/libgcov.a
_gcov.o
_gcov_merge_add.o
_gcov_merge_single.o
_gcov_merge_delta.o
_gcov_fork.o
_gcov_execl.o
_gcov_execlp.o
_gcov_execle.o
_gcov_execv.o
_gcov_execvp.o
_gcov_execve.o
_gcov_interval_profiler.o
_gcov_pow2_profiler.o
_gcov_one_value_profiler.o
_gcov_indirect_call_profiler.o
_gcov_average_profiler.o
_gcov_ior_profiler.o
_gcov_merge_ior.o

When I disassembled "-fprofile-arcs -ftest-coverage" compiled test program,
it included or referred to following gcov functions:
__gcov_close
gcov_exit
__gcov_flush
__gcov_init
__gcov_merge_add
__gcov_open
__gcov_read_counter
__gcov_read_summary
__gcov_read_unsigned
gcov_read_words
__gcov_seek
gcov_write_block
__gcov_write_counter
__gcov_write_summary
__gcov_write_tag_length
__gcov_write_unsigned
gcov_write_words

"_init" called:
 804869d:       e8 8e 00 00 00          call   8048730 <__gmon_start__@plt>
 80486a2:       e8 49 02 00 00          call   80488f0 <frame_dummy>
 80486a7:       e8 74 18 00 00          call   8049f20 
<__do_global_ctors_aux>

"main" didn't do anything interesting, but "_GLOBAL__I_65535_0_main" (?)
called "__gcov_init" which called "__i686.get_pc_thunk.bx" and "atexit",
latter called C-library atexit.  Former was just:
08049e18 <__i686.get_pc_thunk.bx>:
 8049e18:       8b 1c 24                mov    (%esp),%ebx
 8049e1b:       c3                      ret


> So additional work needs to be done in order to have a working gcov for
> MiNT.


	- Eero