bug-gnulib
[Top][All Lists]
Advanced

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

Re: Generating code coverage reports


From: Ludovic Courtès
Subject: Re: Generating code coverage reports
Date: Mon, 03 Nov 2008 14:06:28 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Hi Simon,

Simon Josefsson <address@hidden> writes:

> Hi Ludovic.  Thanks, I pushed this patch.  Adding anything to LDFLAGS
> doesn't seem to be required though?

According to the doc (info "(gcc)Debugging Options") it is required.
See also this example (with GCC 4.2.4):

  $ cat > t.c <<EOF
  int main (int argc, char *argv[]) { return 0; }
  EOF   
  $ gcc --coverage -c t.c
  $ gcc t.o 
  t.o: In function `global constructors keyed to 0_main':
  t.c:(.text+0x43): undefined reference to `__gcov_init'
  t.o:(.data+0x24): undefined reference to `__gcov_merge_add'
  collect2: ld returned 1 exit status
  $ gcc --coverage t.o
  [ success ]

> Btw, it is better/worse to compile with -O2?  It may be better for
> profiling optimizations, but the use-case here is to generate code
> coverage reports for the self tests.  So I would assume -O2 is harmful
> here.  Whether -g is useful or not is another question.

I don't think `-O' matters.  I don't think `-g' is required to get
useful source location information.

Thanks,
Ludo'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]