I'm trying to get better about sharing details on ...
# share-your-work
a
I'm trying to get better about sharing details on WhiteBox, the live debugger for C/C++ I've been working on for the last few years. Here's the first of what should hopefully be a long series of daily posts on it 😀 I've talked a bit about it around FoC before, but I'm trying to make sure I cover it comprehensively. Do let me know if there's anything in particular you'd like to hear about it/its internals/the philosophy behind it. https://twitter.com/whitebox_sys/status/1519114889905819651
👍 1
🤘 3
🤘🏽 1
c
This looks really good. (for lazy people, this short demo video from the website explains how to read the timeline diagram https://vimeo.com/483795097)
a
thanks @Chris Knott
that reminds me - I need to update the website as well 😄. There's a more up-to-date demo video here: https://vimeo.com/645179584
👍🏻 1
i
This project is absolutely fascinating to me. There are so many ideas here I’ve been trying to wrap my ahead around to simply think about solving, and seeing it in such a complete state is amazing. I’d love to chat about this, to maybe understand your thinking, and how you solved some of the interesting technical bits of deep code introspection.
a
hey @Ivan Lugo, sorry I haven't really been on the slack since I last posted. I'm more active on the WhiteBox discord (https://chat.whitebox.systems). Thank you for the kind words, I'm always happy to chat 😀
Looks like twitter vids aren't previewing, so here are some originals:
j
I'm seriously considering 1) install linux on my old intel mac 2) writing some c code just to try out whitebox. I love what you all are doing and so sad I have no personal use for it. I'd love to learn more about the implementation. Anywhere I can learn that?
a
Thanks for the vote of confidence 😁 There are a few dev videos scattered around, but it's closed source. Is there anything in particular you'd like to know about?
j
I'm curious about the general strategy for getting all the runtime data there. From the videos I've seen it doesn't seem to have a huge amount of overhead. Are you doing some custom compilation? A Vm? I can imagine a few different implementations, just curious what approach you found to work best.
a
we're using clang as a library with some modifications to do lazy JIT compiling
so only functions that actually get called get compiled
this is particularly significant if you use the function caller (top text box in WhiteBox) to call a (near-)leaf function, rather than starting at
main()
j
Nice. Lazy compilation is such a fun technique. It was one was the keys things we did in YJIT to not compile too much code for ruby. And then you just compile some sort of instrumentation code for every variable? Having not used it I can imagine that working with simple values, but not sure how you deal with references and capturing the changes of those values over time. Probably need to watch some more videos on it.
a
currently we run the user code in a separate process and auto-debug it. I've looked into instrumentation a bit but haven't got round to adding any yet
with debug symbols generated by clang
debugging is definitely slower than ideal because of the frequent context switches
j
Yeah, I was wondering if you were able to do it all with debugging because it looked fairly fluid. Pretty great that you were able to get all of that functionality without anything too fancy. One of my new years resolutions is to start making my own debugger frontend. Whitebox is definitely an inspiration, so I'll have to see if I can get a half backed version going 🙂
a
A user got WhiteBox working with raylib, and I realised I hadn't tried it yet myself. This was something that needed correcting immediately! (raylib is a code-focused game development engine/library) It became possible with the concurrency features we added for v0.116.0 There are still things to hammer out from the previous interaction model (when to rerun the code, LOD, recording selection...) But take a look: live, graphed data & an instant edit-run loop for games! raylib made this very easy: - download raylib-4.5.0_win64_msvc16.zip from <https://github.com/raysan5/raylib/releases/latest> - add
-I[...]/raylib/include
to the compiler flags - add
[...]/raylib/lib/raylib.dll
to the DLLs list - connect to WhiteBox from an example raylib file - start playing