Next: Data Type Links Up: Appearance Previous: Appearance

Function Links

Function CallCallee links connect function call sites to corresponding definition sites. As shown in Figure 1, a user examining the code for the function pedwarn who wants to understand the operation of function error, invoked within pedwarn, can click on the call to error to display the code containing its definition. If error, in turn, were to invoke further functions, the user could click on their invocations to display the corresponding definitions. Using this feature of HyperCode, a user (or even an automated process) can determine the entire set of dependencies of a given function. Alternatively, by starting from the main function, a user can explore the functional structure of an entire program. This functionality is very similar to that provided by the Meta-. command on Lisp Machines, and under GNU emacs using ETAGS.

The overall effect of HyperCode's CallCallee links is to explicitly represent the entire function dependency graph of a program by integrating it with the program text. Previously, function dependencies were only implied; a user would have to search manually through all the source files associated with a program to ascertain the whereabouts of a function definition. In particularly complex systems of source files, such as the source files for the set of programs composing the GNU C Compiler, gcc, the user might have some difficulty in determining the set of source files which make up a particular program. The explicit structure revealed by HyperCode solves these problems.

CallCallee links from function calls to the corresponding definitions do not represent a one-way path: HyperCode provides a link from each function definition to a backtrace list consisting of the sites from which the function is called. These links enable a user considering modifying the behavior of a function to easily discover all locations at which it is invoked so that modifications can be designed to avoid breaking other portions of the program code. For instance, in Figure 2, by clicking on the function name append_include_chain in the definition, the user can view the backtrace list, each element of which includes the file and function names and the line number from which append_include_chain is called.

In a few cases, a function call may have no corresponding definition in source code; I/O functions such as printf, math functions such as cos, and other types of functions may be included from C libraries which have no HyperCode information associated with them. In these cases, function calls may be linked to documentation - e.g. UNIX manual pages, for C programs running under UNIX - such that when a user clicks on fprintf in the example in Figure 3, his browser displays the manual page for fprintf. Backtrace lists for such functions are made accessible from the top-level display for the program.

Although backtrace lists are not themselves program code, each item listed in a backtrace list is linked to the call site in the program code which it represents. As a result, when a user selects one of these items, his browser displays the program source code at the exact point at which the call actually occurs (Figure 4). The user is thus able to see the full context of every call of a function, and can accurately evaluate the effects of potential modifications to the function its callers.

By providing links from function definitions to backtrace lists, and from backtrace lists' elements to calling sites, HyperCode explicitly represents the inverse functional dependency graph of a program; whereas the forward functional dependency graph represented by CallCallee links can be used to answer the question ``What functions does this function depend on?'', the inverse functional dependency graph can be used to answer the equally important question: ``What functions depend on this function?'' By making it easy to accurately answer these questions, HyperCode empowers users to make safe modifications to function behaviors and interfaces.



Next: Data Type Links Up: Appearance Previous: Appearance


jhbrown@ai.mit.edu
Mon Sep 19 08:19:50 EDT 1994