# Rust - Debugging
Links: [[Rust]]
## Resources
### (Docs) [Debugging support in the Rust compiler](https://rustc-dev-guide.rust-lang.org/debugging-support-in-rustc.html)
### (Blog post) [Debugging Rust apps with GDB](https://blog.logrocket.com/debugging-rust-apps-with-gdb/)
[[2021-02-09]]
- Good high-level 'how-to' guide for debugging in Rust
### (Blog post) [Debugging Rust With Lldb](https://www.marcelbelmont.com/post/debugging-rust-with-lldb/)
[[2016-03-26]]
### (Short blog post) [Debugging Rust with rust-lldb](https://dev.to/bmatcuk/debugging-rust-with-rust-lldb-j1f)
[[2020-01-19]]
### (Stack Overflow) [How do I debug a failing cargo test?](https://stackoverflow.com/questions/27269315/how-do-i-debug-a-failing-cargo-test-in-gdb)
## Common Issues
### `warning: can't find symbol`
Add the following to `Cargo.toml`:
```toml
[profile.dev]
split-debuginfo = "packed"
```
More info:
- [This issue comment](https://github.com/rust-lang/rust/issues/40787#issuecomment-1019465942)
- [split-debuginfo](https://doc.rust-lang.org/cargo/reference/profiles.html#split-debuginfo) in Cargo reference
### `Unable to find Mach task port for process-id`
Solution: Codesign the debugger
- [GNU guide for GDB](https://sourceware.org/gdb/wiki/BuildingOnDarwin)
- [PermissionsDarwin page](https://sourceware.org/gdb/wiki/PermissionsDarwin)
- [GNU 7.5.1 Codesigning the Debugger](https://gcc.gnu.org/onlinedocs/gnat_ugn/Codesigning-the-Debugger.html) under Mac OS Topics
More information (quality varies)
- StackOverflow: [gdb fails with "Unable to find Mach task port for process-id" error](https://stackoverflow.com/questions/11504377/gdb-fails-with-unable-to-find-mach-task-port-for-process-id-error)
- [macOS instructions in a .txt](https://opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt)
- (gdbgui issue) [Unable to find Mach task port](https://github.com/cs01/gdbgui/issues/55)