I've implemented this in a private nim fork implementing this and something 
more general: tracing.

This is very useful in many cases, eg:

  * when a variant of a program introduces a bug, but you're not sure where the 
bug is introduced (eg because of delayed effect eg cgen produces bad code, and 
then at a later time you get a cgen error). By comparing the execution traces, 
you'll know for example what's the 1st place where execution diverges between 
those 2 program runs
  * likewise with running a single program but with 2 different inputs, and you 
want to know the 1st place where execution differs
  * when stacktraces are not good enough



This is a bit analog to dtrace, which is an incredibly useful tool for 
debugging: 
<https://8thlight.com/blog/colin-jones/2015/11/06/dtrace-even-better-than-strace-for-osx.html>

It works similarly to `--stacktrace:on`, by instrumenting code, but does so 
with user defined callabacks.

Instead of generating the full trace, you can collect the unique LOC generated 
using a HashSet, generating a code coverage instead of an execution trace.

Reply via email to