[llvm-dev] Using source-based code coverage on baremetal
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Mon Sep 11 12:55:37 PDT 2017
On 9/11/2017 2:37 AM, Martin J. O'Riordan wrote:
> We also have to ensure that the basic instrumentation initialisation process normally handled by 'RegistrationRuntime Registration' is performed before the program is allowed execute, and that the data is subsequently dumped (taken off-chip) after execution. This is done with a bit of smoke and mirrors as many programs in the embedded environment to not have support for running the '.ctors' functions before and the 'atexit' functions after execution (especially C programs).
I don't think RegisterRuntime provides any relevant functionality unless
you're writing to a file (I didn't even realize that existed before now).
We've been modifying the source code to write out profile data because
our images never actually "exit". Maybe there's something more clever
we can do in some cases.
> But the Compiler-RT profile library also integrates the automatic merging and collation of data from multiple runs within the library implementation itself, and this is a really significant problem for base-metal system with no OS and no file-system. It does this using "patterns" in the file name (derived from the environment), and the data collation performed by the system being profiled.
>
> I think that to better facilitate bare-metal systems, this process of collating the results of multiple runs would be best provided by a separate stand-alone utility on the host system that would perform this logic offline rather than having it integrated online as it is currently defined.
The logic for merging raw profiles already exists in llvm-profdata (see
https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-merge ).
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-dev
mailing list