* UML GCOV fails to produce *.gcda files
@ 2019-07-18 1:21 Brendan Higgins
2019-07-20 1:10 ` Brendan Higgins
0 siblings, 1 reply; 2+ messages in thread
From: Brendan Higgins @ 2019-07-18 1:21 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov
Cc: Darya Verzhbinsky, Daniel Latypov, Maria Ignacio, linux-um
Following the instructions here[1], we have been trying to get gcov
support working under UML. However, despite the fact that it seems to be
configured correctly (I see it producing *.gcno files), it does not
appear to be producing *.gcda files (or *.da) files when we run the UML
kernel.
Sor far we have mostly been working with v5.2.
Running make with KBUILD_VERBOSE=1 we see that gcc is being called with
the appropriate gcov flags: -fprofile-arcs -ftest-coverage
As I mentioned above, we see that *.gcno files are being produced.
We also see that libgcov is being linked into the linux binary:
readelf -s linux | grep __gcov_init
29312: 000000006041d070 200 FUNC GLOBAL HIDDEN 13 __gcov_init
To ensure that __gcov_flush() is actually being called, we manually
inserted it in the kernel's init (just to see if we get some coverage
information). I copied the patch at the end of this email.
And yet we still see no *.gcda files being generated.
It looks like it has been a very long time since anyone has touched the
UML gcov code, so I have started looking into building an older version
of the kernel where it might have worked, but have not gotten any useful
results back from that yet.
We are aware that gcov has also been implemented for other architectures
under separate Kconfigs (CONFIG_GCOV_KERNEL and friends); however, we
are very keen to get gcov working with UML (where we don't have to
scrape sysfs for the *.gcda files) as we are running tests in UML and it
would be much easier to get coverage for these tests on UML as well.
Hope someone can help!
Thanks!
[1]http://user-mode-linux.sourceforge.net/old/gprof.html
Our .config can be generated by running `make ARCH=um olddefconfig` on
the following defconfig:
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_KERNEL=y
CONFIG_GCOV=y
The __gcov_flush() patch mentioned above is here:
From e021b659b51670bc0a063b6817c31d30ab809be6 Mon Sep 17 00:00:00 2001
From: Brendan Higgins <brendanhiggins@google.com>
Date: Wed, 17 Jul 2019 18:11:29 -0700
Subject: [PATCH v1] DO NOT MERGE: added __gcov_flush() to init to ensure it is
called
---
init/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/init/main.c b/init/main.c
index 66a196c5e4c3c..70d7a6cb9ea0f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1080,10 +1080,14 @@ void __weak free_initmem(void)
free_initmem_default(POISON_FREE_INITMEM);
}
+extern void __gcov_flush(void);
+
static int __ref kernel_init(void *unused)
{
int ret;
+ __gcov_flush();
+ printk("__gcov_flush\n");
kernel_init_freeable();
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
--
2.22.0.510.g264f2c817a-goog
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: UML GCOV fails to produce *.gcda files
2019-07-18 1:21 UML GCOV fails to produce *.gcda files Brendan Higgins
@ 2019-07-20 1:10 ` Brendan Higgins
0 siblings, 0 replies; 2+ messages in thread
From: Brendan Higgins @ 2019-07-20 1:10 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger, Anton Ivanov
Cc: Darya Verzhbinsky, Daniel Latypov, Maria Ignacio, linux-um
On Wed, Jul 17, 2019 at 6:21 PM Brendan Higgins
<brendanhiggins@google.com> wrote:
>
> Following the instructions here[1], we have been trying to get gcov
> support working under UML. However, despite the fact that it seems to be
> configured correctly (I see it producing *.gcno files), it does not
> appear to be producing *.gcda files (or *.da) files when we run the UML
> kernel.
>
> Sor far we have mostly been working with v5.2.
>
> Running make with KBUILD_VERBOSE=1 we see that gcc is being called with
> the appropriate gcov flags: -fprofile-arcs -ftest-coverage
>
> As I mentioned above, we see that *.gcno files are being produced.
>
> We also see that libgcov is being linked into the linux binary:
>
> readelf -s linux | grep __gcov_init
> 29312: 000000006041d070 200 FUNC GLOBAL HIDDEN 13 __gcov_init
>
> To ensure that __gcov_flush() is actually being called, we manually
> inserted it in the kernel's init (just to see if we get some coverage
> information). I copied the patch at the end of this email.
>
> And yet we still see no *.gcda files being generated.
>
> It looks like it has been a very long time since anyone has touched the
> UML gcov code, so I have started looking into building an older version
> of the kernel where it might have worked, but have not gotten any useful
> results back from that yet.
I have an update on this!
I tried building the kernel with gcc-4.9.4 when I discovered that gcov
*does* work with v5.2 of the kernel, just not gcc-7.3.0. So it seems
this may actually be an issue with gcc and not UML.
I will update when I learn more.
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-20 1:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-18 1:21 UML GCOV fails to produce *.gcda files Brendan Higgins
2019-07-20 1:10 ` Brendan Higgins
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.