Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way of getting a diagram of what calls what?

Tags:

diagram

delphi

For Delphi 2010, is there a way to get a diagram, starting with function X (or even the whole program), of what other functions/procedures are called...

Something along the lines of:

Function X
  - Function A
    - Procedure B
    - Procedure C
  - Function D

(Of course graphical would be nicer...)

like image 691
user1009073 Avatar asked Oct 23 '11 19:10

user1009073


3 Answers

Peganza Pascal Analyzer offers both call tree and reverse call tree reports. There are a number of other static code analyzers available, but this is the one I am familiar with.

So far as I know, there is nothing of this nature built in to Delphi.

like image 122
David Heffernan Avatar answered Nov 15 '22 19:11

David Heffernan


Here is an example of an AQTime call chart. AQTime's call sequences can be gathered either dynamically (gathered from a running program) that means you have to activate the code path you want to chart (make sure some menu or button you can click in the UI calls this code) and then you can chart it, or they can be gathered statically. The dynamic one might seem like more work, and you might think that static analysis is better, and in some ways static analysis is better, but dynamic call sequence charts are actually "what really happened in one particular run" whereas static analysis provides "what the parser could figure out to be always true, whether or not this code path even gets run by you, or your customer at all". In fact, I recommend using both paths, and comparing them to see what you learn.

enter image description here

AQTime pro is quite expensive, but I am unaware of any free alternatives. (No I don't work for SmartBear, or Embarcadero.). I am a professional developer, and I find that such tools are worth the price. Your call.

I usually use the call sequence feature while running from the performance profiler, so that I get some Time values (the digram below shows Time: #.## msec because the data was gathered by the performance profiler, dynamically, rather than by the static analysis profiler, which doesn't know how long a function takes to execute).

like image 26
Warren P Avatar answered Nov 15 '22 20:11

Warren P


IDA Pro can do that for you. . (for any program, not only delphi progs)

like image 29
whosrdaddy Avatar answered Nov 15 '22 19:11

whosrdaddy