<div dir="ltr">Hi,<div><br></div><div>I believe the easiest way to do this is using the new `trace_pc` functionality from SanitizerCoverage. See <a href="http://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs">http://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs</a> for some documentation about that.</div><div><br></div><div>In short:</div><div><br></div><div>- Compile your program with the `-fsanitize-coverage=trace-pc` flag.</div><div>- This adds a call to a function called `__sanitizer_cov_trace_pc` to every edge in the control-flow graph.</div><div>- You can define this function in any way you want (just write C code, and link it to the application)</div><div>- In particular, you can use `__builtin_return_address` to find where the function was called from. You're then free to dump that address to a file descriptor, store it in a memory buffer, ...</div><div><br></div><div>Cheers,</div><div>Jonas</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 28, 2016 at 5:20 PM Raul Garcia via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div class="gmail_msg">
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt" class="gmail_msg">Hello All,
<br class="gmail_msg">
<br class="gmail_msg">
How can I keep track of the different basic blocks of a program executed over time?<br class="gmail_msg">
Or in other words, how can I annotate the block name (block_a) and the time/cycle at which that blocs (block_a) was executed, and do this for all the blocks on a reasonable simple program?<br class="gmail_msg">
<br class="gmail_msg">
Regards, Raul.    <br class="gmail_msg">
</div>
</div>

_______________________________________________<br class="gmail_msg">
LLVM Developers mailing list<br class="gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
</blockquote></div></div>