|
|
Function Calls Graph
Function call graphs, or call trees, are a standard tool often found in reverse engineering tools, code browsers, IDEs, and even file editors. They provide fundamental information about the control flow dependencies for the functions you're examining in your tool.
But while call trees are ubiquitous, there are many features of the function call graphs in Imagix 4D that are unique. These features enable Imagix 4D's function call graphs to provide more information and more useful information, more quickly. And of course, more accurately, due to Imagix 4D's precise source code analysis and support of such contructs as calls through function pointers.
Graphical Querying
Central to Imagix 4D's Function Calls graph, and to all of its Graph window views, is the concept of graphical querying. The symbol and dependency data Imagix 4D captures about your code spans the full extent of your software. Through graphical querying, you're able to fully control which portions of that data to visualize at a given time in a given Graph window. As you explore your code in a Graph window, you decide which symbols or dependencies you want to follow further, or which portions of the call tree you no longer want to see.
Imagix 4D's controls for graphical querying are extensive. Some are context sensitive menu items that you invoke by clicking on symbols in the graph. Some are available through the Graph window's menu items, such as the ability to add or delete functions that meet specific criteria. Functions can also be added into the graph from completely different windows, such as a report window where you might be viewing functions that are involved in a recursive loop.
Transformation to Other Views
A second major concept in Imagix 4D's Graph windows is transformation between views. The Graph window provides views of your source code that range from function and variable level of detail up to higher and higher levels of abstraction. For example, you might display calls between the files that contain a given set of functions, or a UML Diagram of the classes containing the same functions. When switching between such views, the new view represents the same portion of your software that was displayed in the previous view. Viewing your software through the lenses of these different views enhances your understanding of the software you're studying.
In this graph, the view has been shifted from a function call tree to a more detailed Sequence Diagram of the same set of functions. The shift to the Sequence Diagram view provides insight into the sequence and conditionality of the software's control flow.
Detail About Specific Functions
As you examine the call tree, you can use the Symbol panel to drill down and learn more about the various functions. The Symbol panel focuses on one specific function at a time. Each tab provides insight into a different aspect of the function. For example, you can see the complete direct fan-in and fan-out of the function, and use that to expand the call tree according to your interest. The Metrics tab provides a comprehensive set of software metrics about that specific function. Here in the Usage tab, you can see the code snippets showing how the function is called.
Links to Other Tools
Imagix 4D provides an integrated set of tools for browsing and analyzing your software. File, class and symbol indices provide catalogs of the components making up your software. The Graph Context tab shows the location of the call tree functions within your directory structure. Tabs in the Query panel enable you to search for items in the database and in your source code. File editors enable you to examine and edit the source code for the functions. Here, a Flow Chart displays the program logic for a specific function.
All of these various tools are linked. So from the file editor, you could add symbols to the function calls graph you're viewing. Or from the graph, you might open a function's flow chart to drill down for further understanding.
Overlay of Software Metrics
Imagix 4D collects move than 100 software metrics, including over 20 at the function level. These include metrics related to function size (such as Lines of Source Code), testability and maintainability (McCabe Cyclomatic Complexity, for example), and design quality (including Global Variables Used).
These metrics are quite useful in their own right. With the Metrics Tool, you're able to analyze them, and to review functions that exceed thresholds you've established. But through the use of color to overlay the software metrics onto the function call graph, you're able to see where metric values of concern occur within the overall control flow of the program. And if multiple problematic functions are within close proximity of each other (ie, are not practicing good social distancing), that suggests an area of the code deserving extra testing, and perhaps refactoring or even reengineering.
Automated Documentation
Often, as you examine a call tree to analyze the control flow of software, the understanding that you gain is for your immediate use. You might then proceed to modify the code, or to follow the trail to examine something else.
But at other times, you may need to share what you're seeing to another team member, to pass it on to a different team such as a QA group or the original developers, or to simply note it for your records. In these cases, you need to document what you're seeing. Imagix 4D's automated documentation of a function call graph generates a detailed ASCII, RTF or HTML document. The document includes the call tree that you are looking at, comprehensive information about each of the functions in the call tree along with specifics about which portions of those functions are involved in the current call tree, and any description you want to add. All created at the click of a button.
|
Analyzing Function
Call Dependencies