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.
Key elements are the major window panes running from the top to the bottom of the window:
Displays the current project and data directory from which the call relationships are derived.
Displays a graphical view of the call relationships among routines, source files, or directories associated with the target.
Shows calling relationships for the node selected or highlighted arc in the main graph view.
Buttons lets you focus on a portion of the graph and to change the amount of information shown.
Displays detailed information about a node selected in the main view.
Displays information messages and Quick Help on menu items when you press and hold MB1 on the item.
The Call Graph Browser lets you do the following:
Graph the calling structure of an application
View and analyze the call relationships within a program
Expand and collapse elements of the graph
Operate on the graph to isolate areas of interest and remove uninteresting components
Magnify selected areas of the graph; pan the graph
Graph the hierarchical structure of an application, including the files that make up the application and the functions within the respective files
View detailed information on calls, functions, and source files in an active transcript window
Provide integration with the Cross-Referencer and editors
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:
All the files are available.
All disks containing source and intermediate files are mounted and available.
You have configured the browser tools using the Project Manager (Browser Tools Settings Category). Note that, because of the existence of default settings, this is not an absolute requirement. However, you will likely want to edit the defaults to customize the static analysis database generation and to make sure the compiler macros are consistent with your environment.
See Chapters Chapter 9 and Chapter 11 for more information on configuring a project and the browser tools.
You used the Builder (or some other build mechanism) to generate static analysis data during a build of your target application.
You can start the Call Graph Browser in several ways:
Use the command line.
If you have CDE installed, use the Call Graph Browser icon.
Use the FUSE Control Panel once FUSE is running.
Use the Tools menu from most FUSE tools.
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.
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:
Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.
Double click on the FUSE application group icon to display the icons in the FUSE application group.
Double click on the Call Graph Browser icon to start the tool.
To start the Call Graph Browser from the Control Panel, select Call Graph Browser from the Tools menu.
Most FUSE tools have a Tools menu. To start a tool, select the tool from the Tools menu.
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.
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.
The call graph in Figure Figure 6-3 is for the example count 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. |
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).
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.
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.
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.
Left view: When you hold and drag MB1 over an arc, the left view shows the node that calls it.
Center view: The center view shows the currently selected node.
Right view: When you hold and drag MB1 over an arc, the right view shows the node that it is called by.
When a call graph is large and complex, it can be difficult to browse through and navigate. To improve readability and navigation:
Use the Graph menu to change graph presentation and include or remove a specified information from the graph.
Use the Selection menu to manipulate which nodes you want to display, or to show all peer nodes contained within a parent node.
Use the Zoom, Show Calls, Call Options, and Select buttons below the main call graph to focus on a subset of nodes.
Use the MB1 dragging functionality (dragging MB1 over an arc) to view the calling relations of nodes.
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.
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).
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.
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.