It only works if DWARF is generated. By default, the `release` profile of Cargo sets `debug = false` [0]. But, it's quite easy to override this setting, and have a build that is both optimized and includes debuginfo.
[0]: https://doc.rust-lang.org/cargo/reference/profiles.html#rele...
Even if not, this is still very useful for debugging