8.3.1. How the hierarchy is built

The hierarchy of functions, as presented in the call graph, is built based on the call chain captured during execution. The originating function is placed in the far left column and functions it calls are placed in the column to its right. Functions that these functions call are placed in a column to the right of that and so on down the line, until all of the functions have been placed. There is a caveat to this placing behavior. If a function is called at multiple levels of the hierarchy, it is placed as far left as possible in the call graph.

To illustrate, if the function main calls function a which in turn calls function b, it appears as shown in Figure 8.2.

Figure 8.2. A Simple Call Hierarchy

A Simple Call Hierarchy

If, in addition to function a, main also calls function b, function b is put in a higher place in the hierarchy, nearer to main. This is shown in Figure 8.3.

Figure 8.3. A Call Hierarchy with Multiple Call

A Call Hierarchy with Multiple Call

The call graph presents a simple call hierarchy, but real-world algorithms describe hierarchies far more complex than those shown in Figure 8.2 and Figure 8.3. Rather than present the call graph with all of these connections visually represented as a spider web of call arrows, the call graph uses a simple method to determine whether or not to draw a call line.

Copyright © 2007- 2009 ARM Limited. All rights reserved.ARM DUI 0414D
Non-Confidential