I'd love something like this on program level. Given contents of a variable, I'd like to know where they came from - which pieces of code contributed to the result. I'd also love to be able to mark a piece of data, and see what code touched it or derived new data from it. A programming equivalent of injecting radioisotopes into the body.
I’d suggest looking into taint analysis tools, though those are usually aimed more at finding things like unsanitized input ending up in a call to system.
Any interesting links to papers?
There's the work by Myers and Liskov which is quite central to the whole field: https://dl.acm.org/citation.cfm?id=266669,
there's Flume: https://dl.acm.org/citation.cfm?id=1294293, DStar https://www.usenix.org/event/nsdi08/tech/full_papers/zeldovi.... More recently, on Android: https://www.usenix.org/system/files/conference/usenixsecurit.... And this (disclaimer: I'm the main author): https://link.springer.com/chapter/10.1007/978-3-319-66197-1_....
In my research team, we used a tainting tracing mechanism to understand the behavior of malware. Basically, we installed a malware on a clean phone and we then traced all information flow originating from the APK to processes, to files, to sockets, etc. It helped reverse-engineering the malware.