I am looking for some tool th开发者_如何转开发at can show me what flows happened in the code when I
used some functionality ?
Like some visualization or imaging of what code was called, or from where in the code some variables were touched .
Thanks for help.
For just about every programming language there's an IDE with a debugger and a profiler, and some profilers generate call graphs, which sounds like what you're after.
For C, for example, there's the venerable gprof: http://sourceware.org/binutils/docs/gprof/index.html, for PHP there's xhprof: http://mirror.facebook.net/facebook/xhprof/doc.html, and there's one for Microsoft Visual Studio as well: http://msdn.microsoft.com/en-us/magazine/cc337887.aspx.
If you're only interested in particular function calls and changes to particular variables, then it might actually be better to add code yourself to dump lines with interesting events to a logfile while your program runs and then use a script to convert the log lines into a DOT file (http://en.wikipedia.org/wiki/DOT_language), and use graphviz (http://www.graphviz.org) or Omnigraffle (http://www.omnigroup.com/applications/OmniGraffle/) to generate pretty pictures for you.
Good luck.
you dont necessarily need visual tools to examine flows or to study runtime behavior. Logging mechansim is meant exactly for this. You could add log msgs in appropriate places in your code and study the log contents to gain insights on behavior.
精彩评论