c - Static vs Non Static functions - Debugging embedded systems context -
i puzzled following question: how keep advantage of "static" label still able debug production code on site?
not once happens unintended behavior occurring @ customer site, , there . in many cases, having option perform debug can save lot of effort , provide quick response. such debug involves checking function behavior, brings "static" definition.
static functions cannot debugged debug shell, putting breakpoints or executing it. on other hand, defining functions public causes code structure , optimization grief.
i'm aware of options compiling @ least 2 different builds, 1 static , 1 without, fits automation tests, not final production build goes out eventually.
will appreciated insights side, on how resolved (if any) dilemma. or rephrasing question to: "what more important?"
a discussion on "static" in c here.
i think fundamental question not "do ship 'static' or not?", "do test ship ?" embedded code, if doing majority of testing on debug build, , shipping release version compiled different options, shipping untested code customer. when running close hardware, small changes in timing or memory access patterns (which optimizer can introduce) can cause big changes in behavior of system.
my current strategy ship debug version, configured optimization can stand when debugging. no static functions, make state visible debugger possible.
yes, give away possible compiler-generated efficiencies, long ensure debug version fast enough meet requirements, that's not problem. , payoff code ship same code i've been testing whole release cycle - no optimizer-generated surprises.
Comments
Post a Comment