▲ | spc476 4 days ago | |
The hardest bug I had to track down took over a month, and a debugger wouldn't have helped one bit. On the development system, the program would only crash, under a heavy load, on the order of hours (like over 12 hours, sometimes over 24 hours). On the production system, on the order of minutes (usually less than a hour). But never immediately. The program itself was a single process, no threads what-so-ever. Core dumps were useless as they were inconsistent (the crash was never in the same place twice). I do think that valgrind (had I known about it at the time) would have found it ... maybe. It might have caught the memory corruption, but not the actual root cause of the memory corruption. The root cause was a signal handler (so my "non-threaded code" was technically, "threaded code") calling non-async-safe functions, such as malloc() (not directly, but in code called by the signal handler). Tough lesson I haven't forgotten. | ||
▲ | forrestthewoods 4 days ago | parent | next [-] | |
Ok? A debugger also wouldn’t help the hardest bug I ever fixed! It is not the only tool in the bag. But literally the first question anyone should ask when dealing with any bug is “would attaching a debugger be helpful?”. Literally everyone who doesn’t use a debugger is less effective at their jobs than if they frequently used a debugger. | ||
▲ | Veserv 4 days ago | parent | prev [-] | |
A modern debugger would have made that trivial. Just turn on time travel debugging mode and you would have been done after the first time it occurred. Wait until the memory is corrupted and causes a crash. Set a hardware breakpoint on the corrupted memory location and run backward until the memory location was written in the signal handler. Problem solved. Memory corruption bugs in single-threaded code are a solved problem. |