Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/20/08 22:44
Modified:
  01/20/08 22:46

Read: times


 
#149787 - comments on clarifications
Responding to: ???'s previous message
Now, let me state one opinion: debugging by means of inserting printf statements is the crappiest method anyone ever has devised.
Can't agree with that. To be fair, since I do application code instead of embedded work these days

My opinions etc in this forum relate to 'embedded work' what relates to other types of work is a subject for another forum. In 'embedded work' in particular the potential for injecting a timing error is just too large. Also, see comments below.

In the worst case, where you know everything was kosher at point A but something was amiss at point B, and there were a gazillion instructions executed between A and B, do what I call a "binary search for the bug". Insert a carefully chosen printf half way between A and B. If everything is copacetic move the printf to half way between that point and point B. Otherwise go the other way.
SOP, but why use printf(). With an ICE you just move the breakpoint, with priontf you need to edit, recompile, relink and reload for every new 'binary point'

I can almost always find the bug more quickly using printf than using a debugger. On those occasions where that doesn't apply, I use the debugger. Whatever is likely to make the work faster and easier.
if printf works for you (doing applications), go ahead.

For embedded systems, you could use Jan's idea of the "embedded printf". I've done that or similar many times, with good results.
again edit, recompile, relink and reload for every step.

The most important point in debugging is to make sure the code is correct. Too many times I've seen someone identify the cause of a problem and "fix it" by changing a line or two of code because that makes the problem "go away". Only later, if at all, do they realize that their "fix" broke something else because they didn't really understand the code and didn't bother to analyze either the code or their fix to make sure it was correct.
Here, Jeff, we do agree.

Much like some of my students who get the right answer for the wrong reason. That's why I try to get them to understand the concepts and not just memorize formulas. Students in statistics are particularly bad in that regard, but even algebra students make truly astounding mistakes. I once had a young lady who worked out an interest rate problem about purchasing a $20,000 car at some interest rate for so many months. She computed the total of payments to be slightly over 2 million dollars, and for some reason this didn't bother her at all. Made me consider a third career as an auto salesman ;-)
I see the same again and again. We who grew up with pencil ans slapstick .. eh sliderule learned to check our results. The generation that grew up with a calculator have no idea whether the result is a keypress error or not. Once someone tried to give me more change than the bill I paid with.

Erik

List of 71 messages in thread
TopicAuthorDate
8052.com SBC and Book            01/01/70 00:00      
   I'd go silabs derivative devboard            01/01/70 00:00      
      ICE functionality            01/01/70 00:00      
         an incomplete list            01/01/70 00:00      
            amplification            01/01/70 00:00      
               No, only the flash based            01/01/70 00:00      
                  never knew            01/01/70 00:00      
            P89LPC952            01/01/70 00:00      
               952 vs SILabs            01/01/70 00:00      
         yes, but...            01/01/70 00:00      
            sure, but what then            01/01/70 00:00      
               Who said that?            01/01/70 00:00      
                  I did            01/01/70 00:00      
                     Idiot            01/01/70 00:00      
                        well, somebody had to teach them :(            01/01/70 00:00      
               Problem with that            01/01/70 00:00      
                  unnecessarily hard            01/01/70 00:00      
                     Explanation            01/01/70 00:00      
                        yes and no            01/01/70 00:00      
                           Maybe in a back chapter            01/01/70 00:00      
                              SoftICE            01/01/70 00:00      
                        The nature of learning            01/01/70 00:00      
                           of course, education is absorbing information AND            01/01/70 00:00      
                           comment or amplification            01/01/70 00:00      
                              the embedded printf            01/01/70 00:00      
                              Erik, we two might disagree in many points...            01/01/70 00:00      
                              The right tool for the Job            01/01/70 00:00      
                                 beginners should use the i805x            01/01/70 00:00      
                                 one more right tool for the job            01/01/70 00:00      
                              Clarification            01/01/70 00:00      
                                 comments on clarifications            01/01/70 00:00      
                                    Printfs            01/01/70 00:00      
                  maybe not so much ...            01/01/70 00:00      
                     comments/replies            01/01/70 00:00      
                  comments/replies            01/01/70 00:00      
   What about PLCC?            01/01/70 00:00      
      interesting, but ...            01/01/70 00:00      
         A PLCC Socket is solderable            01/01/70 00:00      
         OOPS            01/01/70 00:00      
            I was wondering...            01/01/70 00:00      
               PLC, not PLCC            01/01/70 00:00      
      better if socketed            01/01/70 00:00      
         Socketed - Yes            01/01/70 00:00      
            perhaps you have missed the point            01/01/70 00:00      
   multi-option implementation            01/01/70 00:00      
      Not much            01/01/70 00:00      
   It depends on the board quality ...            01/01/70 00:00      
   schmartboard            01/01/70 00:00      
   Supply PCB with only the smd micro placed            01/01/70 00:00      
   leave it            01/01/70 00:00      
      that makes sense to me ...            01/01/70 00:00      
   simple is still good....            01/01/70 00:00      
      why bother            01/01/70 00:00      
         last time I bought 32KB SRAM I paid $0.48US            01/01/70 00:00      
         use part of a bigger one            01/01/70 00:00      
            that's not really a problem...            01/01/70 00:00      
               it is a problem if you rely on DIL packaging            01/01/70 00:00      
                  what is your definition of "obsoleted"?            01/01/70 00:00      
                     Problem            01/01/70 00:00      
                        Have you seen this?            01/01/70 00:00      
                     Over the last year ...            01/01/70 00:00      
      Gee ... that thing really costs a lot ...            01/01/70 00:00      
         no, it does not            01/01/70 00:00      
            $50            01/01/70 00:00      
            I meant this one            01/01/70 00:00      
   Thanks for comments, keep them coming            01/01/70 00:00      
      nothing comes free...            01/01/70 00:00      
         or            01/01/70 00:00      
         No problem with other design            01/01/70 00:00      
      How about a mezzanine board ... and some tools?            01/01/70 00:00      
         with some really slick code ...            01/01/70 00:00      

Back to Subject List