From: Brendan Higgins <brendanhiggins@google.com>
To: Jeff Dike <jdike@addtoit.com>,
Richard Weinberger <richard@nod.at>,
Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Darya Verzhbinsky <daryaver@google.com>,
Daniel Latypov <dlatypov@google.com>,
Maria Ignacio <mariaignacio@google.com>,
linux-um@lists.infradead.org
Subject: UML GCOV fails to produce *.gcda files
Date: Wed, 17 Jul 2019 18:21:36 -0700 [thread overview]
Message-ID: <20190718012136.GA135592@google.com> (raw)
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
next reply other threads:[~2019-07-18 1:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 1:21 Brendan Higgins [this message]
2019-07-20 1:10 ` UML GCOV fails to produce *.gcda files Brendan Higgins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190718012136.GA135592@google.com \
--to=brendanhiggins@google.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=daryaver@google.com \
--cc=dlatypov@google.com \
--cc=jdike@addtoit.com \
--cc=linux-um@lists.infradead.org \
--cc=mariaignacio@google.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.