Skip to content

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

License

Notifications You must be signed in to change notification settings

hpi-swa-lab/squeak-tracedebugger

Repository files navigation

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:

  • Interactive call tree instead of a stack list
  • Step back button
  • New navigation shortcuts (jump to sender, jump to callee, ...)
  • Context search dialog
  • Context filters (by package, selector, receiver, ...)
  • Snapshot inspectors/explorers for objects during debugging
  • History explorer for navigating through the side effects of objects

Fun fact: All screenshots are CI-generated. Find all other screenshots here.

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 Trace it 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:

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

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

  • High performance. While (sufficiently) fast enough for most small to medium workloads, tracing very compute- or mem-intensive operations may require more time (ex.: Compiler/decompiler invocation: <1s, HTTPS request: <10s, tool building: <5m, complex rendering: minutes up to hours).
  • Not a dataflow analyzer: The TraceDebugger does not track dataflow events (e.g., argument passing) but only state changes.
  • No tracing of external states/events for FFI/OSProcess or custom VM modules.
  • No support for advanced language concepts such as identity forwarding/write barriers.

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:

  • Christoph Thiede, Marcel Taeumel, and Robert Hirschfeld. 2023. Object-Centric Time-Travel Debugging: Exploring Traces of Objects. In Companion Proceedings of the 7th International Conference on the Art, Science, and Engineering of Programming (<Programming>’23 Companion), March 13–17, 2023, Tokyo, Japan. ACM, New York, NY, USA, 7 pages. DOI: 10.1145/3594671.3594678

    BibTeX
    @inproceedings{thiede2023object,
    	author = {Thiede, Christoph and Taeumel, Marcel and Hirschfeld, Robert},
    	title = {Object-Centric Time-Travel Debugging: Exploring Traces of Objects},
    	booktitle = {Companion Proceedings of the 7th International Conference on the Art, Science, and Engineering of Programming},
    	year = {2023},
    	month = {3},
    	days = {13--17},
    	isbn = {9798400707551},
    	publisher = {Association for Computing Machinery},
    	address = {New York, NY, USA},
    	doi = {10.1145/3594671.3594678},
    	pages = {54–60},
    	location = {Tokyo, Japan},
    	series = {Programming '23 Companion}
    }
  • Christoph Thiede, Marcel Taeumel, and Robert Hirschfeld. 2023. Time-Awareness in Object Exploration Tools: Toward In Situ Omniscient Debugging. In Proceedings of the 2023 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! ’23), October 25–27, 2023, Cascais, Portugal. ACM, New York, NY, USA, 14 pages. DOI: 10.1145/3622758.3622892

    BibTeX
    @inproceedings{thiede2023time,
    	author = {Thiede, Christoph and Taeumel, Marcel and Hirschfeld, Robert},
    	title = {Time-Awareness in Object Exploration Tools: Toward In Situ Omniscient Debugging},
    	booktitle = {Proceedings of the 2023 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software},
    	year = {2023},
    	month = {10},
    	days = {25--27},
    	publisher = {ACM},
    	address = {New York, NY, USA},
    	doi = {10.1145/3622758.3622892},
    	pages	= {89--102},
    	location = {Cascais, Portugal},
    	series = {Onward! '23}
    }