4 ms·
Not linking debug info must be some kind of sick joke. What is the point of a debug build without symbols?
by nuudlman 2y ago
Not linking debug info must be some kind of sick joke. What is the point of a debug build without symbols?
- 0x457 2y agoEnable them when you need to debug. This is for speeding up "edit-build-run" workflows.
- nuudlman 2y agoIt's a lot faster to add a log point in a debugger than to add a print statement and recompile. Especially with cargo check, I really don't see the point of non-debuggable builds (outside of embedded, but the size of debuginfo already makes that a non-starter).
- 0x457 2y agoYes, but we're talking about time spent with "add a print statement and recompile" vs time saved by not including debuginfo on every other build. You have to do that comparison yourself.
- RichardLake 2y agoDoesn't rust have overflow checks in debug and skips them in release?
- 0x457 2y agoRust has compiled time overflow checks enabled by default in any profile. Runtime overflow checks are disabled by default in release profile.
- vbezhenar 2y ago1. Skipping some optimizations to build faster. 2. Conditionally compiling some code like logging (not sure if matters for typical Rust projects, but for embedded C projects it's typical). 3. Conditionally compiling assertions to catch more bugs. I'm using logs, because debugger breaks hardware. Very rarely do I need to reach debugger. Even when hard exception occurs, usually enough info is logged to find out the root cause of the bug.
- vlovich123 2y ago> because debugger breaks hardware What? Seems like you’re talking about embedded but I’ve done a lot of embedded projects in my time and I’ve never had a debugger that breaks the HW.
- viraptor 2y agoDepends what you're working on. Stopped in an unfortunate place? That one element didn't get turned off and burned out. Or the motor didn't stop. Or the crucial interrupts got missed and your state is now reset. Or...
- bippihippi1 2y agoare there debugging tools specifically for situations like that? do you just write code to test manually? How do you ensure dev builds don't break stuff like that even without considering debugging?
- rcxdude 2y agoThe most useful tool is a full tracing system (basically a stream of run instructions you can use to trace the execution of the code without interrupting it), but unfortunately they're quite expensive and proprietery, and require extra connections to the systems that do support them, so they're not particularly commonly used. Most people just use some kind of home-grown logging/tracing system that tracks the particular state they're interested in, possibly logged into a ringbuffer which can be dumped when triggered by some event.
- bippihippi1 2y agolike a perf trace?
- AlotOfReading 2y agoYou ensure dev builds don't break stuff like that with realtime programming techniques. Dev tools exist and they're usually some combination of platform specific, expensive, buggy, and fragile. printf and friends are fantastic when applicable. Sometimes the cost to even do an async print or even building in any mode except stripped release is impossible though, which usually leads to !fun!.