www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Possible to Animate Program

Is it possible to add a hook to every function 
call/delegate/lambda both start and end?

What about the ability to essentially log a programs execution 
path, then "play it back" and only view the source code one is 
interested in along with the state at any moment in time. Similar 
to debugging but after the fact.

Imagine watching the program as if it were recorded and also see 
the source code in another window and see it move through it. Or 
see a tree like structure with each node representing a function 
and the active node being the current function the program is in.

The ability to hook in to the functions is a big part of that to 
collect all the data needed. It can't be done by blinding logging 
all state information since this is generally huge.

I'm interested in advanced program analysis techniques that are 
far beyond your typical run of the mill debugging methods. Modern 
programs require modern debugging, logging, and analysis methods 
and tools. The easier it is to hook into the necessary program 
components the quicker these tools can be written. D provides 
quite a bit of *code level* abilities but I am not sure about 
function hooking.

I am not in to resorting to use hacks, object code modifications, 

I will give a simple method to see the trace of a program:

1. Add hook to start of every function call of program.
2. Log function name, line, and time stamp.
3. Animate source code by log.

We can extend this to include data collection at call site, 
profiling, etc if the appropriate features exist(function 
Jun 29 2016