Debug

From Adam Colton
Revision as of 17:24, 23 September 2019 by Adamcolton (talk | contribs)
Jump to navigation Jump to search

Runtime

The standard library can swap out the debug package depending on the runtime. If debugging is disabled all the methods become static no-ops and the compiler will remove all debugging logic.

Break

Calling debug.Break() will cause the program to break. And this can be wrapped in an if. When the program is in break mode we can inspect variables, stack and should even be able to replace values and run arbitrary code.

Hotswapping

V allows this. Not sure how it works (it's trivial in some cases, impossible in others).

Socket

I'll have to dig into this, but the debugger will expose itself on a socket. Tools can connect on that socket. Out of the box there should be a command line version and web version.