[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

6    Call Graph Browser

This chapter provides an overview of the Call Graph Browser's features and capabilities. For more detailed information on how to use this tool, choose Help: On Call Graph Browser. You can print Help topics using the HyperHelp Viewer.

The Call Graph Browser provides a graphical view of the call relationships and containment hierarchy within a directory, source file, object file, or executable file. The Call Graph Browser works with all languages supported by FUSE. Figure Figure 6-1 shows the Call Graph Browser main window.

Figure 6-1:  Call Graph Browser Main Window

Key elements are the major window panes running from the top to the bottom of the window:

Configuration area

Displays the current project and data directory from which the call relationships are derived.

Main graph display area

Displays a graphical view of the call relationships among routines, source files, or directories associated with the target.

Small view display area

Shows calling relationships for the node selected or highlighted arc in the main graph view.

Controls area

Buttons lets you focus on a portion of the graph and to change the amount of information shown.

Transcript area

Displays detailed information about a node selected in the main view.

Information area

Displays information messages and Quick Help on menu items when you press and hold MB1 on the item.


[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

6.1    Summary of Features

The Call Graph Browser lets you do the following:


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.2    Requirements for Using the Call Graph Browser

The Cross-Referencer generates the call graph based on information in a static analysis database. The Database Manager (see Chapter 11) creates and maintains the static analysis database using static analysis data files generated by the Builder. See Section Section 4.8 and the online Help topic Generating Static Analysis Data as Part of the Build for information on creating a static analysis database.

Before using the Call Graph Browser, make sure of the following:


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.3    Starting the Call Graph Browser

You can start the Call Graph Browser in several ways:


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.3.1    Use the Command Line

You can start the Call Graph Browser from the command line using the following command:

% fusecg [Xt-Options]

See Appendix Appendix D and the specific reference pages for the command syntax and options.

If the Control Panel is not running, it starts automatically as a minimized icon. If FUSE is already running, the Call Graph Browser is placed in the current project. Whenever you start a browser tool, you minimally need a working directory specified for the project. The Call Graph Browser inherits its working directory from the project.

Until you have a static analysis database, the Call Graph Browser cannot show any data. You can specify a data directory to contain the static analysis database and associated files. You also should check the default properties in the Project Manager dialog box (Browser Tools Settings Category) before you generate static analysis data from your source files. See the online Help topic Generating Static Analysis Data as Part of the Build for details on creating a static analysis database.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.3.2    Use the Call Graph Browser Icon from CDE

When you have CDE installed, FUSE provides a FUSE application group icon and icons for the individual tools that make up the FUSE environment.

To invoke the Call Graph Browser:

  1. Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.

  2. Double click on the FUSE application group icon to display the icons in the FUSE application group.

  3. Double click on the Call Graph Browser icon to start the tool.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.3.3    Use the FUSE Control Panel

To start the Call Graph Browser from the Control Panel, select Call Graph Browser from the Tools menu.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.3.4    Use the Tools Menu from Most FUSE Tools

Most FUSE tools have a Tools menu. To start a tool, select the tool from the Tools menu.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.4    Updating the Call Graph

If the underlying static analysis data files change, most likely as a result of a new build, you can update the data in the Call Graph Browser by choosing Database: Update.

When you modify the source code for the application currently displayed in the Call Graph Browser, you can update the graph only after regenerating new static analysis data files, typically using features in the Builder.

For example, suppose you changed a source file while viewing the call graph for your program. You can update the graph only by rebuilding the application, typically in the Builder with the Generate Static Analysis Data button toggled on (or using some other build mechanism that generates the static analysis data). You can then choose Update from the Database menu.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.5    Shapes and Colors Used in the Call Graph

The call graph provides a graphical view of the call relationships among files and functions. Use the call graph to become familiar with a program and analyze changes you make to the source files.

When you first configure the Call Graph Browser, the call graph displays the target directory's subdirectories and files.

The call graph uses shapes to identify the elements of the graph. These elements are referred to as nodes. Each node represents one or more routines and each line that connects nodes represents one or more calls.

The nodes in a call graph are identified using the shapes shown in Figure Figure 6-2.

Figure 6-2:  Meaning of Shapes in the Call Graph

The call graph in Figure Figure 6-3 is for the example count program.

Figure 6-3:  Call Graph for Count Example Program

The call graph uses color to represent the current status of a node. The following table lists the possible colors of a node and the status that color represents:

When the node is... Then the node...
Yellow Is selected for another graph operation.
White Is highlighted. This color can also indicate that a line is highlighted. To highlight a node or a line, press MB1 and drag the pointer over it.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.6    Using the Call Graph Browser with Other Tools

You can use the Call Graph Browser in combination with the FUSE Editor or Emacs. For example, you can double click on a node that represents a function in the call graph (or click on an entry in the transcript) to display the associated source code in the FUSE Editor or Emacs. You can also display the source code for a file or function by selecting the file or function in the graph and then choosing Edit from the Selection menu.

You can also invoke the Call Graph Browser from either editor to display the call graph for a function you select in the editor's buffer (see Chapter Chapter 13).


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.7    Using the Call Graph Browser Transcript Area

The transcript area displays the following information for a node that you have selected:

When the selected node represents a... The transcript area lists...
Function The file containing the function and the location of the routine in the file, all calls from within the function and the line number of the call, and functions that call it.
Source file The directory that contains the file and all the functions that the file contains.
Directory The files that the directory contains and its parent directory.

Figure Figure 6-4 is an example of the Call Graph Browser transcript area displaying information about functions in the example count program.

Figure 6-4:  Call Graph Browser Transcript Area

After information is displayed in the transcript area, you can click on an entry in the transcript area to display the associated source code in the FUSE Editor. If you want the node corresponding to the entry to be displayed in the call graph as well, make sure the Center Node Upon Select toggle button on the Graph Layout dialog box is set turned on. (Choose Layout from the Graph menu to display the Graph Layout dialog box.) Then, even when you click on an entry that corresponds to a node that is not being displayed, the Call Graph Browser will expand the node, select it, and display it.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.8    Using the Call Graph Browser Small Views

In addition to the call graph in the main display area, the Call Graph Browser also has three smaller call graphs. Use these small views to view the call relationships among files and functions.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.9    Working with Large Graphs

When a call graph is large and complex, it can be difficult to browse through and navigate. To improve readability and navigation:

You can tailor the focus of the call graph, or any of the small views, by using the View Filter option on the MB3 pop-up menu. For example, you can limit the display in a small view to only the selected node, calling nodes, and called nodes. Press MB3 while the pointer is over a node in the view you want to change to access the View Filter.

To view detailed information about a node, click on a node and review the information listed in the transcript area. The transcript area lists information about a node's name, location, and calls. Once information is displayed in the transcript, you can click on an entry in the transcript area and the source code associated with it is displayed in the FUSE Editor.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.10    Panning the Call Graph

When the pointer is inside the display area, you can press and hold MB2 to grab the graph and move it around. (The action is similar to moving the slider in the scroll bar.) Use Shift+MB2 to move the graph in increments (similar to clicking inside the scroll bar).


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

6.11    Selecting Nodes in the Call Graph

To select a node in the call graph, click on the node in the main display area or any of the small views.

However, if you are unsure of the name of the node or its location in the graph because it is not currently visible on the display, the Select button enables you to select the desired node by either entering a matching pattern or by selecting the node from a list.

To select a node from a list of nodes:

Step Action
1 Click on the Select... button to display the Select dialog box.
2 In the Select dialog box, choose the appropriate Filter Node type.
3 In the list of nodes, click on the node you want to select. You can use the scroll bar to scroll through the list to find the desired node, or you can begin to enter the name of the node in the Filter Pattern field. As you enter characters in the Filter Pattern field, the list of nodes dynamically updates and lists those nodes that match the characters you entered.
4 Click on OK or Apply.

The Call Graph Browser selects the node in the call graph and expands the call graph as needed.


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]

6.12    Commands Available on the Pop-Up Menu

While the pointer is over a node in the main view or any of the small views of the call graph, press MB3 to access the pop-up menu. The pop-up menu contains a subset of the most frequently used menu items from the main menus. The View Filter... item is available only from the MB3 pop-up menu.


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]