In general, for debugging you can either use a logging approach (either by inserting the logs themselves, or using the ltrace , ptrace , ... tool to create logs for you) or you can use the debugger.
Note that ltrace , ptrace or debugger approaches require you to reproduce the problem; I prefer manual logs because I work in an industry where error reports are generally too inaccurate to allow immediate reproduction (and therefore we use logs to create a regenerator script).
Rust supports both approaches, and the standard toolkit used for C or C ++ programs works well for it.
My personal approach is to have some protocols to quickly narrow down where the problem arose, and if logging is not enough to run the debugger for finer checking. In this case, I would advise you to immediately work out the debugger.
A panic , which means that breaking the call into a panicky hook, you will see both the call stack and the memory status at the moment when the situation goes awry.
Run the program using the debugger, set a breakpoint on the panic hook, run the program, make a profit.
source share