Re:Show HN: Hook – a simple graphical C/C++ runtime editor
by fercircularbuf on Tuesday January 02, 2024 @05:11AM
(#38840070)
This is amazing work! Thank you for sharing! This is what I was envisioning when I embarked on this project.
In my case, I went to implement this for Windows, but bit more advanced with inline scripting support. Basically, you insert a snippet anywhere in the code that can call various functions and one of them is `view()` which will show all locals (or a chosen object out of scope) in a Visual Studio window (it's a VS extension [0], website [1]). Calling it again will update the view with the new state. The scripting language underneath is Angelscript and it understands symbols inside your entire project (e.g you could do `view(Namespace::g_variable)` or even call functions from the program etc. The snippet hook is then JIT'ed into the target function by relocating it using info from the PDB. This took me ~1y to implement, and it's still a research phase project.
[0] https://marketplace.visualstudio.com/items?itemName=donadigo...
[1] https://d-0.dev/