Readit News logoReadit News
alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
Veserv · 6 months ago
You can not just discard the oldest data of a long-running execution trace when doing replay-based time-travel debugging.

You can not replay execution without a known state followed by all non-determinism after that state which is most easily done by starting from the initial state. To discard data, you need to manifest a state snapshot corresponding to that time to enable forward reconstruction from that state.

alehander42 · 6 months ago
you're right: in the RR case: currently this is not merged yet, but a RR contributor works on persistent checkpoints; they can act as snapshots
alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
forrestthewoods · 6 months ago
Windows support? What languages? How does it work?

I don’t like that the headline is “designed to support multiple languages” but it only actually supports an obscure language I’ve never heard of. Feels like a bait and switch.

alehander42 · 6 months ago
We're working on Windows support for the scripting and blockchain languages.

I am sorry if the headline felt misleading or the current support disappointing: we do have experimental Ruby support, that you can try right now if you record a `<somepath>.rb` program.

We do design the frontend, trace format/lib and backends to support multiple languages. Ruby is already having experimental support, and we try to keep various other languages/usecases in mind. We hope to find a model that lets us work more on supporting many more scripting languages. We'd also love contributors/the community adding support for languages or codetracer itself!

We also do have a closed source backend based on RR[1] that has partial C/Rust/Nim support, but it is not yet ready. It might be released as a proprietary solution. (However if we find an alternative sustainable business model, it would be great to be able to open source it.)

The scripting/blockchain languages backend is more db-like: it collects a trace by hooking in tracing API-s or instrumenting/patching vm-s (the trace is later postprocessed before replay).

The system languages backend is based on RR[1] recordings currently.

We'd be happy to discuss more usecases or languages!

1: https://rr-project.org/

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
throw-the-towel · 6 months ago
Just out of curiosity, why did you use two languages to write CodeTracer and not just one of them?
alehander42 · 6 months ago
Nim is the original language we use. Zahary is a prolific contributor to Nim, and we have a good relationship with the Nim community, they've helped a lot!

Nim and some Python are used for our closed source rr backend currently, and the frontend is written in Nim (compiling to JavaScript).

The backend for blockchain and scripting language which is open sourced, is newer and we used Rust there for several reasons. One of them is related to the fact that many blockchain languages are implemented in Rust and this makes it easier to interoperate/contribute. There are other aspects as well: both languages have pros and cons.

Some pros of Nim are e.g. it's metaprogramming support; the ability to share easily code/types between backend and frontend(it's an alternative to both e.g. C++/Go and TypeScript for us).

We're thankful to both language communities!

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
cxie · 6 months ago
The planned RR recordings integration is what I'm most excited about though. Having this capability for systems languages like Rust and C++ would be transformative for complex debugging scenarios where you're often forced to restart debugging sessions from scratch after stepping past a crucial point.
alehander42 · 6 months ago
the support for system languages (the rr integration "backend") is currently closed source.

It's not ready yet, and it might be proprietary: it would be great if we can open source it, if we find a sustainable business model for that

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
slifin · 6 months ago
If you are using Clojure or ClojureScript check out FlowStorm:

https://www.flow-storm.org/

alehander42 · 6 months ago
Very impressive! Lisp people are always good at tooling.
alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
kreco · 6 months ago
Especially since the trace files are in .json. [0]

[0] https://github.com/metacraft-labs/runtime_tracing#format

alehander42 · 6 months ago
True! The next major version of the format should use a more optimized format, as mentioned.

However, some of the important optimizations, that we're preparing are not related so much to the format, but to record more specific things and reconstruct more in the postprocessing.

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
cxie · 6 months ago
I need a VSCode extension for this. But alas, it's just sitting in their roadmap... Typical. Guess I'll have to roll up my sleeves and build one myself. Not like I have enough on my plate already. At least their trace files are in an open format, so it shouldn't be impossible to hook into the VS Code debugging API.
alehander42 · 6 months ago
We'd love additional contributors! We also have some more detailed plans for such an extension. If you're interested in chatting about it, you can join our discord[1] (or we can expand here/in a github issue as well)

1: https://discord.com/invite/aH5WTMnKHT

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
dinnertime · 6 months ago
Congrats on your release!

One question I have is, how exactly does it record and what are the boundaries of the recording?

For example does it only record the userland execution of a single process, or does it have broader boundaries like including kernel code and/or execution of multiple processes? How does it handle shared memory regions that may be modified outside of the recording?

alehander42 · 6 months ago
We are currently working on two "backends" where recording works in different ways.

For the scripting languages and smart contract/ZK languages, we instrument the interpreters using high level hooking API-s or direct patches, and we produce a trace.

For system languages, we directly build on top of RR[1] recordings for now: RR can record multiple processes, and it works in userland. IIRC it doesn't support modifications of shared memory outside of the recording. It's very well documented in their paper: Engineering Record And Replay For Deployability: Extended Technical Report[2].

1: https://rr-project.org/

2: https://arxiv.org/abs/1705.05937

alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
Alifatisk · 6 months ago
Even support for D? Wow they thought of everything
alehander42 · 6 months ago
A contributor to the D language helped us for many aspects of the project. He would really like to see D support haha!
alehander42 commented on Show HN: CodeTracer – A time-traveling debugger implemented in Nim and Rust   github.com/metacraft-labs... · Posted by u/alehander42
muizelaar · 6 months ago
How does the implementation compare to RR?
alehander42 · 6 months ago
We are building our future support for the system languages for now directly on top of RR recordings: credit to Robert(roca) and Kyle and all other contributors for RR and Pernosco, they're amazing technologies.

We've researched possible alternative approaches/tools as well, especially keeping in mind Windows/Mac support.

The traces for Noir and the scripting languages work in a completely different way, capturing all the relevant data which is later indexed into a db-like structure. With some future optimizations this can be very useful for various shorter programs in scripting languages, and generally for blockchain languages(as the running time there is usually low) and we hope that eventually with flexible record filtering it can be practical even for capturing important segments/aspects of long-running real world projects.

u/alehander42

KarmaCake day580June 5, 2015
About
I like language development. Some of my stuff: https://github.com/alehander92
View Original