Visualizing Call Graphs - Embedded.com

Visualizing Call Graphs

Control flow is one of the simplest and most expressive representations of a program. Control flow is often represented as a control flow graph which contains an edge from statement A to B when there exists an execution in which B executes immediately after A .

In imperative programs, control flow expresses causality between a call site statement and a method.. Calling a method causes statements in it (and statements in methods it transitively calls ) to execute. Determining when something happens requires finding the control flow by which it may be reached. And control flow expresses the order in which statements execute.

Developers work to understand a program’s control flow throughout investigation and debugging activities as they mentally model, reason, and navigate. For example, when investigating an unfamiliar codebase, developers first mentally construct a control flow representation of connections between its parts.

And their knowledge of a method’s part of the call graph increases as they interact with its code. Information foraging theory predicts that developers traverse control flow and search for “prey” – locations in code – by using “scent” – the similarity of the information which labels the control flow edges to their knowledge of their prey – to rank the potential of edges to traverse.

Ensuring control flow is easily understandable has been an important goal of language design. Following Dijkstra’s observation that gotos obfuscate control flow and make reasoning difficult, language designers introduced structured programming languages that simplify control flow within methods. But in order to promote reuse and modularity, modern languages obfuscate inter-procedural control flow between methods with features such as dynamic dispatch and indirection.

To address these problems, we designed a new form of interactive call graph visualization – REACHER. Instead of leaving developers to manually traverse the call graph, REACHER lets developers search along control flow.

The interactive call graph visualization encodes a number of properties that help developers answer questions about causality, ordering, type membership, repetition, choice, and other relationships. And developers remain oriented while navigating.

To evaluate REACHER’S benefits, we conducted a lab study in which 12 participants answered control flow questions. Compared to an existing IDE, participants with REACHER were over 5 times more successful in significantly less time. All enthusiastically preferred REACHER, with many positive comments.

To read this external content in full, download the complete paper from the author archives on line. 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.