Re: Debugging: Am I a dreamer. . . ?
- From: Chris H <chris@xxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 11:59:21 +0100
In message <48184695$0$23852$8404b019@xxxxxxxxxxxxxxx>, David Brown <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes
Chris H wrote:In message <m1d4o7remo.fsf@xxxxxxxxx>, Hao Wang <doitmy@xxxxxxxxx> writesTomás Ó hÉilidhe <toe@xxxxxxxxxxx> writes:I wasn't going to mention that as it usually causes a bun fight bit since you have...
I've been programming in C for the best part of a decade now but it's
only within the last year that I've really started doing embedded
systems programming.
When I did C programming for a personal computer, I commonly debugged
my code simply by putting in printf statements around the place to
check variable values, and also by using the instrument that lets you
check the values of variables at runtime when you're stepping through
the code.
If you really programming in C for years, you know that using printf
or debugger to remove bugs, only gives the design more bugs. Embedded
solutions stay away bugs by careful design (in both IC/HW/BSP/SW).
You should never debug using printf.
This is why there are simulators, debuggers and Emulators. Even for PC's I can recall Borland had a system where you could debug one PC from another. For embedded using printf should have dies out over a decade ago.
What's wrong with debugging using printf? I don't mean specifically "printf", which you should normally avoid in a small embedded system,
Well you have answered the question.
but the general idea of putting out extra information while the program
runs is a very useful debugging technique.
Yes but not the same as using printf.
Simulators, debuggers, and emulators are all important for development and debugging, but sometimes it is easier to send out signals to show what is happening.
I have not found that to be the case but then I usually have a simulator, debugger or ICE to hand.
Of course such things involve changes to your code, and changes to the run-time characteristics of your system
Which is why I don't like it. That said some debuggers instrument the code and some distort the time element.
- but that's often perfectly acceptable during development and debugging.
I agree. For testing some code it can be useful... This is often for things like Unit Test where you wrap the function(s) under test in a test harness that can have printf or equivalents.
It is not a good idea to rely on printf-style debugging as your *only* method of debugging - but equally it is a waste to arbitrarily exclude it from your toolbox.
I think we agree.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
.
- Follow-Ups:
- Re: Debugging: Am I a dreamer. . . ?
- From: Simon Clubley
- Re: Debugging: Am I a dreamer. . . ?
- References:
- Debugging: Am I a dreamer. . . ?
- From: Tomás Ó hÉilidhe
- Re: Debugging: Am I a dreamer. . . ?
- From: Hao Wang
- Re: Debugging: Am I a dreamer. . . ?
- From: Chris H
- Re: Debugging: Am I a dreamer. . . ?
- From: David Brown
- Debugging: Am I a dreamer. . . ?
- Prev by Date: Re: Debugging: Am I a dreamer. . . ?
- Next by Date: Re: Recomendations for document control software
- Previous by thread: Re: Debugging: Am I a dreamer. . . ?
- Next by thread: Re: Debugging: Am I a dreamer. . . ?
- Index(es):
Relevant Pages
|