From Static Code to Dynamic Values: Toward Live Programming Through Object-Oriented Fuzzing
Examples can help illustrate the behavior of code, but they are not always easily available. We use fuzzing, a technique that typically aims to find bugs in security-critical software, to automatically derive example inputs for object-oriented code snippets. Starting with random object graphs as inputs, we mutate them so that they achieve high coverage in the code and conform to the shape that the code expects. Our prototype uses the Truffle compiler ecosystem to run code in a language-agnostic way, instrument code for coverage tracking, and intercept member accesses on the input objects. A VS Code extension shows a selection of examples that are deemed relevant as well as an abstracted summary of the function’s behavior. In our preliminary experiments, we found the selected examples concise and helpful to aid code comprehension. We believe that this can help programmers gain a more solid understanding of code and lower the barrier to using dynamic tools such as probes or debuggers.