Figuring out variable relationships is often very difficult. A custom graph called assignments_and_assign_bys.upl in Custom Graphs and Reports alleviates the problem.


Installation

To install the plugin, simply drag the .upl file into the Understand GUI, or you can manually place it in one of the following locations:


Windows – e.g. C:\Program Files\SciTools\conf\plugin\User\Graph

Mac – e.g. /Users/username/Library/Application Support/SciTools/plugin/Graph

Linux – e.g. /home/username/.config/SciTools/plugin/Graph


Using the Graph

The Understand API provides assign and assignby references for objects, parameters, functions, and enumerators.


For example, here is a graph of a local object data. The graph accessed by right clicking the entity, then selecting "Graphical Views > Assignments and Assigned By".

Graph for Assigns and Assignbys using code from the Linux kernel

The first entity, src is an unresolved parameter. Double clicking on the rectangular nodes of the graph reveals the definition of each entity. The first data is defined in a struct kthread with the line void *data;


Then, a kthread named create is used to assign the target with the line void *data = create->data;

This object is then used in the same exact way, to assign another member called data. The pattern continues until eventually a worker is created.


Without this graph, even the simpler objects of complex code are very vague and make it difficult to trace the flow of information.