3 ms·
I too did embedded code (firmware) work, in the 199x's with only an ICE (basically, hardware debugger). I only dreamed of having printf-capable logging facilit
by cagey 4y ago
I too did embedded code (firmware) work, in the 199x's with only an ICE (basically, hardware debugger). I only dreamed of having printf-capable logging facilities on the HW target; almost all of the firmware "game" comes down to finagling the egress of debug (and application characterization) information off the (in my case, eternally extremely cost-/resource-constrained) target. These days things are much better in this regard (32-bit CPU's and associated memory and other-infra (data-path) resources are MUCH more capable than those of the 8- and 16-bitters of a few decades ago...). Briefly returning to the thread topic: this experience doing FW dev and usually only having a debugger (and how terribly inefficient that was) strongly guided me to a logging-based debug approach: the ability to collect a log and filter it using ad-hoc (e.g. Perl-based) tools, provides IMO an order of magnitude more powerful way to truly understand program (and HW target) behavior compared to a debugger.
I didn't mention earlier that a key component of my "leave DBG printfs in the source code and let the compiler both (a) type-check the trailing param types vs the format string, and (b) elide codegen (executable file footprint) for those same DBG printfs due to the compiler optimizing those calls out" approach is that I build with -O3 which (at least historically; I haven't checked recently) provides a poor gdb debugging experience because the optimizer frequently de-correlates source code lines from generated machine code; if I encounter a segfault, I must suss out a repeatable test case, clean rebuild with -O0 (no optimization), keep fingers crossed that the test case still fails (it usually does), and repro under gdb. The hassle associated with this gyration inhibits my debugger use in non-segfault cases (though these days a clean rebuild is a lot faster than it used to be).