Home

Awesome

TraceDebugger

Tests Coverage Status Benchmarks Build

A lightweight and interactive back-in-time debugger for Squeak to trace and retrace past method invocations and state changes. Powered by SimulationStudio.

Key features:

<p align="center"> <img src="https://github.com/hpi-swa-lab/squeak-tracedebugger/blob/gh-pages/screenshots/TraceDebugger.png?raw=true" width="49.9%"></img> <img src="https://github.com/hpi-swa-lab/squeak-tracedebugger/blob/gh-pages/screenshots/HistoryExplorer.png?raw=true" width="48.3%"></img> </p>

<small><b>Fun fact:</b> All screenshots are <a href="./.github/workflows/build.yml">CI-generated</a>. Find all other screenshots <a href="https://github.com/hpi-swa-lab/squeak-tracedebugger/tree/gh-pages/screenshots">here</a>.</small>

For more details, you can read the announcement on the squeak-dev mailing list or our academic publications. There are also some exposés and other artifacts that document the original aims and USPs of this project. In the studies folders, we documented some experiments we have conducted so far. There are many interesting open issues for future work.

Installation

We offer a pre-configured all-in-one image for the latest Squeak Trunk. Please go to the releases section, download and extract the latest TraceDebugger-*.zip archive, and execute it.

To install the TraceDebugger manually for the latest Squeak Trunk, evaluate the following in a workspace:

Metacello new
	baseline: 'TraceDebugger';
	repository: 'github://hpi-swa-lab/squeak-tracedebugger';
	get;
	load.

For the LTS (long-term support) version for Squeak 6.0, you can use the following:

Metacello new
	baseline: 'TraceDebugger';
	repository: 'github://hpi-swa-lab/squeak-tracedebugger:squeak60';
	get;
	load.

You can also check out the repository via Squot and install all dependencies manually.

To install updates, evaluate the following:

TraceDebugger selfUpdate.

(You can also do this via the window menu window menu of every trace debugger.)

Usage

For a quick start, open a normal expression in a debugger and press the new <kbd>Trace it</kbd> button on the right. For a detailed manual on the TraceDebugger, please read the in-image help here:

TraceDebuggerHelp openHelpBrowser.

A static version of the manual is also available online; however, it is recommended to use the interactive in-image version instead.

(Again, you can also open this help via the window menu window menu of every trace debugger.)

Architecture

This solution is organized as follows:

<table> <thead> <tr> <td><strong>Package</strong></td> <td><strong>Description</strong></td> </tr> </thead> <tbody> <tr> <td><a href="packages/BaselineOfTraceDebugger.package/">BaselineOfTraceDebugger</a></td> <td>Package metadata. Contains scripts to set up the deploy image and fill it with an initial welcome text.</td> </tr> <tr> <td><a href="packages/TraceDebugger.package/">TraceDebugger</a></td> <td>Tracing/retracing machinery and UI for the TraceDebugger and the history explorer. Integration into the base system. Help contents.</td> </tr> <tr> <td><a href="packages/TraceDebuggerTests.package/">TraceDebuggerTests</a></td> <td>Unit tests, integration tests, and acceptance tests for the solution.</td> </tr> <tr> <td><a href="packages/TraceDebuggerBenchmarks.package/">TraceDebuggerBenchmarks</a></td> <td>Benchmarks for the speed of the tracing/retracing engine and the UI.</td> </tr> <tr> <td><a href="packages/TraceDebuggerJobs.package/">TraceDebuggerJobs</a></td> <td>Auxiliary CI/CD jobs to create screenshots. See also the folders <a href=".github/workflows/"><code>./github/workflows</code></a> and <a href="scripts/"><code>./scripts</code></a>.</td> </tr> </tbody> </table>

Additionally, some parts of the work on this project have been contributed to different upstream dependencies, see Upstream Contributions.

Implementation

For program tracing, the program is executed in a specialized code simulator that overrides instructions for sending messages (e.g., send, superSend) and for performing side-effects (e.g., popIntoRcvr, primitiveAtPut, push). All message sends are recorded in a tree and all changed object slots are stored in a sparse time-dependent memory structure before they are overwritten. For time-traveling, the tree is traversed using a cursor. For accessing historic objects, a proxy evaluates all messages sent to an object in another specialized simulator (retracing simulator) that emulates historic states for the requested point in time by forwarding read primitives (e.g., pushRcvr, primitiveAt) to the recorded memory. For gathering state changes in the History Explorer efficiently, the query is evaluated in a range retracing simulator with vectorization and fork semantics.

To learn more about the implementation, you can explore the code base by yourself (recommended starting points: TraceDebugger and TDBCursor) or read our publications about the TraceDebugger (see citation). There is also a slide deck covering design decisions, usage examples, and evaluation results (German, translation will be provided upon request): Zurück in die Zukunft: Back-in-time-Debugging in Squeak (Back to the Future: Back-in-Time Debugging in Squeak). On Squeak Meeting 2022, November 19, 2022. Squeak e.V., Potsdam, Germany.

Current Limitations

Related Projects

Acknowledgments

This project was initially developed in the context of the Programming Experience Seminar 2021/22 @ hpi-swa-teaching and developed further in the context of the Reverse Engineering Seminar 2022 @ hpi-swa-teaching. Many thanks to my careful advisor @marceltaeumel! Furthermore, I'd like to thank @tom95, @stlutz, and @MariusDoe for their valuable feedback on the prototype.

Citation

If you would like to cite this project or would like to learn more about the theory behind it, please refer to the following publications: