home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17936 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  1.3 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!male.EBay.Sun.COM!exodus.Eng.Sun.COM!pepper.Eng.Sun.COM!cmcmanis
  2. From: cmcmanis@pepper.Eng.Sun.COM (Chuck McManis)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: InputHandler debugging (long)
  5. Date: 30 Dec 1992 00:56:16 GMT
  6. Organization: Sun
  7. Lines: 29
  8. Message-ID: <lk1stgINNsej@exodus.Eng.Sun.COM>
  9. References: <tomme.724365078@Minsk>
  10. NNTP-Posting-Host: pepper
  11.  
  12. The best way to debug any sort of task (input handlers included) is
  13. to "create" a debug port. This can be done with a simple program
  14. that opens a message port and waits for messages on it. Since
  15. tasks _can_ send messages and you _can_ use sprintf, you can just
  16. say :
  17.     char    buf[STRSIZE];
  18.     struct
  19.         Message    msg;
  20.         char    *buf;
  21.     }
  22.  
  23.     sprintf(buf, "Some debugging message at %s, or %d",foo, bar);
  24.     port = FindPort("DEBUG-PORT");
  25.     if (port)
  26.         mymsg.buf = buf;
  27.         PutMsg(port, &mymsg);
  28.         WaitPort(mymsg.mn_ReplyPort);
  29.     }
  30.     return();
  31.  
  32. Note you'll have to fill in the reply port for the return message but
  33. all in all its pretty easy to do. At one point I thought I'd recreate
  34. the Berkeley syslog(1) interface for the C library.
  35.  
  36.  
  37. --
  38. --Chuck McManis                Mr. NIS+                Sunsoft
  39. uucp: {anywhere}!sun!cmcmanis   BIX: <none>   Internet: cmcmanis@Eng.Sun.COM
  40. These opinions are my own and no one elses, but you knew that didn't you.
  41.