The download offered here is a Visual Studio 2008 C# project for a simple utility to list user function call trees in C# code.
This call tree lister seems to work OK for my style of coding, but will likely be unreliable for some other styles of coding. It is offered here with two thoughts: first, some programmers may find it useful as is; second, I would be appreciative if someone who is up-to-speed on C# parsing would upgrade it by incorporating an accurate C# parser and turn out an improved utility that is reliable regardless of coding style.
Years ago, I used the SCO C compiler to put together a simple utility to show the call tree for user written functions in a code I was developing in the Progress language. When I subsequently installed a new release of the SCO C compiler, I was annoyed to discover that SCO had removed, from the compiler and its run time support, the simple in memory database that the compiler had previously provided so that my call tree lister no longer worked.
I recently felt a renewed need to be able to see call trees for my code. Upon searching on the web for something that would be easy to use, I came up empty. There are a few Linux and GNU utilities that are undoubtedly excellent and would be convenient for someone working in that world, but the overhead for me to set up that environment seemed too much for one of those offerings to be cost effective for me. I found one or two C# language parsers, but I am not into parsing, and again, the learning curve to work with one of those seemed disproportionate for what I wanted. So, I took a little time, and used .NET's Regular Expression class to develop the C# user function call tree lister offered in the download.
Using the Code
The executable in the \bin\debug directory can be run directly assuming that .NET 3.5 support is available. If you have Visual Studio 2008, you can run the project in the debugger, and it can probably be retargeted to an earlier version of .NET.
Each time you enter a root function in the “2nd:..” text box and then click the upper right corner button “3rd:..” to generate its tree you are prompted for the location and name of a file of type .call_tree for output of a copy of the call tree shown in the window. If you specify an existing .call_tree file the new tree is appended to that file.
Here is an example of what the user interface looks like (with the left side of the window shown first and the right side shown below, because CodeProject limits images to a width of 600 pixels):