home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / programm / 2400 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  2.0 KB

  1. Path: sparky!uunet!wupost!usc!sdd.hp.com!uakari.primate.wisc.edu!ames!pacbell.com!pbhya!dbsuthe
  2. From: dbsuthe@pbhya.PacBell.COM (Daniel B. Suthers)
  3. Newsgroups: comp.programming
  4. Subject: Re: When should a debugger be used?
  5. Summary: When you have no obvious problems...
  6. Message-ID: <1992Aug20.162922.29937@pbhya.PacBell.COM>
  7. Date: 20 Aug 92 16:29:22 GMT
  8. References: <j1ymvg=.pdh@netcom.com> <164c9vINNijk@agate.berkeley.edu> <6453@fury.BOEING.COM>
  9. Reply-To: dbsuthe@PacBell.COM (Daniel B. Suthers)
  10. Organization: Pacific * Bell, San Ramon, CA
  11. Lines: 31
  12.  
  13. In article <6453@fury.BOEING.COM> cek@sdc.boeing.com (Conrad Kimball) writes:
  14. >|> >4.  Divide-and-conquer when things go wrong by adding some output somewhere
  15. >|> >    (usually an fprintf() added at a strategic spot).
  16. >
  17. >And what do you do when the problem goes away when you add the fprintf()?
  18. >I've had that happen.  A bad pointer leading to trashed memory, and
  19. >inserting more code moves things around so the trashed memory no longer
  20. >causes the program to fail...
  21. >
  22. >--
  23. >Conrad Kimball        | Unix Server Tech Services, Boeing Computer Services
  24.  
  25.  
  26. And you would be suprised how many programmers just leave the fprintf there
  27. and assume the bug is fixed!!!
  28.  
  29. This seems to be one of the classic C bug symptoms, and (for me) it always 
  30. turns out to be a pointer problem.  A real good debugger can help here, but so
  31. can a deskcheck of your code.
  32.  
  33. To answer the question posed by the subject line:  IMHO a debugger is best used
  34. after the logic has been checked.  The very first step is to make sure that
  35. the bug can be reproduced consistantly.  Then and only then can you research
  36. the cause of the bug with 100% assurance that your cure will be the cure.
  37.  
  38. Daniel B. Suthers,  CCP
  39. Technology Consultant, PCS & IN Development Lab,        Pac*Bell
  40. Voice: (510) 671-1325               UUCP:  pacbell!pbeos!dbsuthe
  41. ================================================================================
  42. =  Commit unexpected kindnesses and senseless acts of beauty.                  =
  43. ================================================================================
  44.