public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* gcov support for glibc
@ 2018-07-20  3:32 Palleti, Avinash Reddy
  2018-07-20 13:47 ` Carlos O'Donell
  2018-07-20 14:06 ` Adhemerval Zanella
  0 siblings, 2 replies; 4+ messages in thread
From: Palleti, Avinash Reddy @ 2018-07-20  3:32 UTC (permalink / raw)
  To: libc-help; +Cc: Jasuja, Ritul

Hi,

We are trying to get coverage analysis for glibc test cases, we tried below command to enable gcov support while building glibc.

CFLAGS="-ftest-coverage -fprofile-arcs -O2 -U_FORTIFY_SOURCE" CXXFLAGS="-ftest-coverage -fprofile-arcs" LD_FLAGS="-fprofile-arcs" ../configure --prefix=/opt/ --disable-werror  libc_cv_ctors_header=yes libc_cv_c_cleanup=yes

With this configure line, "make tests" was giving segmentation fault with not much information in coredump. Then we realized that there is no support for gcov in glibc (https://sourceware.org/ml/libc-help/2017-09/msg00031.html)
There are suggestions to use oprofile  but that just gives functional coverage, we are looking for line coverage.
Does anyone tried supporting gcov for glibc, if yes, please share the patches or give us pointers to work on the same.

Thanks,
Avinash



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcov support for glibc
  2018-07-20  3:32 gcov support for glibc Palleti, Avinash Reddy
@ 2018-07-20 13:47 ` Carlos O'Donell
  2018-07-20 16:54   ` Palleti, Avinash Reddy
  2018-07-20 14:06 ` Adhemerval Zanella
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos O'Donell @ 2018-07-20 13:47 UTC (permalink / raw)
  To: Palleti, Avinash Reddy, libc-help; +Cc: Jasuja, Ritul

On 07/19/2018 11:32 PM, Palleti, Avinash Reddy wrote:
> We are trying to get coverage analysis for glibc test cases, we tried
> below command to enable gcov support while building glibc.

There is no gcove support for glibc.

The core library implements the pieces that gcov needs to implement
coverage and so you have a circular dependency between the two which
limits gcov coverage of glibc.

Nobody that I know is working on this in the community.

It would be great to see a design from you to solve the problems.

A first pass solution is to enable coverage for just *part* of the
library like all things compiled under nptl/, and so you'll have to
* Add a configure option for --enable-coverage.
* Detect the configure option in nptl/Makefile and enable coverage.
* Add tests that show libpthread.so coverage is working.

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcov support for glibc
  2018-07-20  3:32 gcov support for glibc Palleti, Avinash Reddy
  2018-07-20 13:47 ` Carlos O'Donell
@ 2018-07-20 14:06 ` Adhemerval Zanella
  1 sibling, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2018-07-20 14:06 UTC (permalink / raw)
  To: libc-help



On 20/07/2018 00:32, Palleti, Avinash Reddy wrote:
> Hi,
> 
> We are trying to get coverage analysis for glibc test cases, we tried below command to enable gcov support while building glibc.
> 
> CFLAGS="-ftest-coverage -fprofile-arcs -O2 -U_FORTIFY_SOURCE" CXXFLAGS="-ftest-coverage -fprofile-arcs" LD_FLAGS="-fprofile-arcs" ../configure --prefix=/opt/ --disable-werror  libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
> 
> With this configure line, "make tests" was giving segmentation fault with not much information in coredump. Then we realized that there is no support for gcov in glibc (https://sourceware.org/ml/libc-help/2017-09/msg00031.html)
> There are suggestions to use oprofile  but that just gives functional coverage, we are looking for line coverage.
> Does anyone tried supporting gcov for glibc, if yes, please share the patches or give us pointers to work on the same.
> 
> Thanks,
> Avinash

I think you will need to do an assessment similar when we added -fstack-protector
support, where will need to identify which objects you will need to suppress the
gcov flags and any additional linking steps to get a functional build (maybe
by disabling on loader or adding any runtime required on a static build).

You can try to identify the problematic object which is causing the segfault by
using some points at [1]. Usually the most common issue is GDB can't find the
debug information (by issuing the linking manually) and one option is to use
--enable-hardcoded-path-in-tests.

[1] https://sourceware.org/glibc/wiki/Debugging/Development_Debugging 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: gcov support for glibc
  2018-07-20 13:47 ` Carlos O'Donell
@ 2018-07-20 16:54   ` Palleti, Avinash Reddy
  0 siblings, 0 replies; 4+ messages in thread
From: Palleti, Avinash Reddy @ 2018-07-20 16:54 UTC (permalink / raw)
  To: Carlos O'Donell, libc-help; +Cc: Jasuja, Ritul



> -----Original Message-----
> From: Carlos O'Donell [mailto:carlos@redhat.com]
> Sent: Friday, July 20, 2018 7:18 PM
> To: Palleti, Avinash Reddy <avinash.reddy.palleti@intel.com>; libc-
> help@sourceware.org
> Cc: Jasuja, Ritul <ritul.jasuja@intel.com>
> Subject: Re: gcov support for glibc
> 
> On 07/19/2018 11:32 PM, Palleti, Avinash Reddy wrote:
> > We are trying to get coverage analysis for glibc test cases, we tried
> > below command to enable gcov support while building glibc.
> 
> There is no gcove support for glibc.
> 
> The core library implements the pieces that gcov needs to implement coverage
> and so you have a circular dependency between the two which limits gcov
> coverage of glibc.
> 
> Nobody that I know is working on this in the community.
> 
> It would be great to see a design from you to solve the problems.

Thank you very much carlos. Will work on the same and update on this thread once we have design ready.

> 
> A first pass solution is to enable coverage for just *part* of the library like all
> things compiled under nptl/, and so you'll have to
> * Add a configure option for --enable-coverage.
> * Detect the configure option in nptl/Makefile and enable coverage.
> * Add tests that show libpthread.so coverage is working.
> 
> --
> Cheers,
> Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-20 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20  3:32 gcov support for glibc Palleti, Avinash Reddy
2018-07-20 13:47 ` Carlos O'Donell
2018-07-20 16:54   ` Palleti, Avinash Reddy
2018-07-20 14:06 ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).