Main Content

Call Hierarchy in Polyspace Desktop User Interface

This topic focuses on the Polyspace® desktop user interface. To learn about the equivalent pane in the Polyspace Access™ web interface, see Call Hierarchy in Polyspace Access Web Interface (Polyspace Access).

The Call Hierarchy pane displays the call tree of functions in the source code.

For each function foo, the Call Hierarchy pane lists the functions and tasks that call foo (callers) and those called by foo (callees). The callers are indicated by (functions) or (tasks). The callees are indicated by (functions) or (tasks). The Call Hierarchy pane lists direct function calls and indirect calls through function pointers. The indirect calls are shown with the icon.

You open the Call Hierarchy pane by using the icon in your result details. To update the pane:

  • You can click a defect, either on the Results List or Source pane. You see the function containing the defect with its callers and callees.

  • You can right-click the name of a function and select Go To Definition. You see the callers and callees of the function.

In this example, the Call Hierarchy pane displays the function generic_validation, and with its callers and callees.

The line number in the Call Hierarchy pane refers to a different line in the source code:

  • For the function name, the line number refers to the beginning of the function definition. The definition of generic_validation begins on line 69.

  • For a callee name, the number refers to the line where the callee is called. The callee functional_ranges is called by generic_validation on line 86.

  • For a caller name, the number refers to the line where the caller calls the function. The caller main calls generic_validation on line 50.

Tip

To navigate to the call location in the source code, select a caller or callee name

Actions Supported on Call Hierarchy Pane

In the Call Hierarchy pane, you can perform these actions.

Show or Hide Callers and Callees

Customize the view to display callers only or callees only. Show or hide callers and callees by clicking this button

Navigate Call Hierarchy

You can navigate the call hierarchy in your source code. For a function, double-click a caller or callee name to navigate to the caller or callee definition in the source code.

Determine if Function is Stubbed

From the Stubbed column, you can determine if a function is stubbed. The entries in the column show why a function was stubbed.

  • Automatic: Polyspace cannot find the function definition. For instance, you did not provide the file containing the definition.

  • Std library: The function is a standard library function. You do not provide the function definition explicitly in your Polyspace project.

  • Mapped to std library: You map the function to a standard library function by using the option -code-behavior-specifications.

Limitations of Call Hierarchy Display in Bug Finder

In Polyspace Bug Finder™, you might not see all callers or callees of a function, especially for calls through function pointers and dead code.

For instance, the Call Hierarchy pane:

  • Does not display the functions registered with at_exit() and at_quick_exit(), and called by exit() and quick_exit() respectively.

  • Might not show all function calls if the calls are made through a large array of function pointers.

  • Might not show all calls to C++ virtual functions.