I wonder why there's no protocol that simply tells the debugger that to pretty-print type X, it should call function Y
in the debugged executable itself (using normal C ABI and some agreed-on calling convention). Then, for example, rustc could just generate simple glue functions that delegate to `Debug::fmt` in order to get formatting that the programmer is already familiar with or indeed has implemented themselves.
(Some precautionary measures would of course be required to avoid infinite recursion and similar. But the same issues already exist in debuggers that allow pretty-printers to eg. run arbitrary python code. To avoid a pathological or buggy formatter breaking either the debugged program or the debugger itself, it might be best to execute the formatter in a separate child process.)