For a long time, since debuggers never worked for me, I've been "print debugging". It requires recompilation every time I want to inspect something, and when the code I want to inspect is in one of the dependencies, I need to clone it, which takes a lot of time. So, it's getting increasingly clear that I need a working debugger.
When I first tried to use gdb, I hit an issue documented here:
It mentions a workaround where you debug the executable in deps. I tried and it did not work.
When I tried lldb, I hit another issue. Similarly enough, it spits out a bunch of errors:
error: <executable> debug map object file '/path/to/my-project/target/debug/deps/<executable>.<randomstring>.rcgu.o' has changed (actual time is yyyy-mm-dd hh:mm:ss.000000000, debug map time is 1970-01-01 09:00:00.000000000) since this executable was linked, file will be ignored
<same error, for each .rcgu.o file>
This error also occurs in gdb:
warning: `/path/to/my-project/target/debug/deps/<executable>.<randomstring>.rcgu.o': file time stamp mismatch.
Admittedly, I've never used native debugger before, so something is likely wrong with my setup. I'll also need to learn how to use the debuggers. But for now, I'm just trying to get them to load.
This might be overkill, but you could try to debug your code from a Linux machine. Both gdb and lldb work perfectly fine there.
Alternatively, if you use VS Code and the rust-analyzer extension you might be able to debug your code inside your editor. rust-analyzer gives you a nice "debug this test" button which looks after the debugger setup.
I hit a similar problem on command line. Once I tried rustc -g --emit="obj,link" <source file>.rs which produced a <binary name>, <binary name>.o and <binary name>.dSYM folder. Then trying to debug using rust-gdb <binary name> file worked flawlessly on Mac
If you prefer using Vim or Neovim, you should definitely try setting up Vimspector or Nvim-dap. I was able to setup both of them on my Mac as well as Linux