If you really want to do any sort of heavy debugging in C you should really do yourself a favor and learn to use gdb. You'll be able to debug your code while still keeping the source intact and also get more tools.
This in no way prevents you from using GDB, and could indeed complement it. You can't always depend on having GDB available (i.e. production hosts where the sysadmins have (rightfully) restricted the use of compilation and debugging tools).
Personally, because not all issues occur on a machine I can set up and run GDB in. Having this kind of data in logs is incredibly useful for those kinds of situations.
OK, this is logging on debug level, but when level is decided during compilation. Why don't using logging on debug then? You can also diagnose production code, while log level check is not very expensive.
15 comments
[ 3.2 ms ] story [ 38.7 ms ] threadCan it do multi-dimensional arrays?
(Also, the really cool people turn down their knighthoods.)
http://en.wikipedia.org/wiki/Orders,_decorations,_and_medals...