home *** CD-ROM | disk | FTP | other *** search
- 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
- From: cmcmanis@pepper.Eng.Sun.COM (Chuck McManis)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: InputHandler debugging (long)
- Date: 30 Dec 1992 00:56:16 GMT
- Organization: Sun
- Lines: 29
- Message-ID: <lk1stgINNsej@exodus.Eng.Sun.COM>
- References: <tomme.724365078@Minsk>
- NNTP-Posting-Host: pepper
-
- The best way to debug any sort of task (input handlers included) is
- to "create" a debug port. This can be done with a simple program
- that opens a message port and waits for messages on it. Since
- tasks _can_ send messages and you _can_ use sprintf, you can just
- say :
- char buf[STRSIZE];
- struct
- Message msg;
- char *buf;
- }
-
- sprintf(buf, "Some debugging message at %s, or %d",foo, bar);
- port = FindPort("DEBUG-PORT");
- if (port)
- mymsg.buf = buf;
- PutMsg(port, &mymsg);
- WaitPort(mymsg.mn_ReplyPort);
- }
- return();
-
- Note you'll have to fill in the reply port for the return message but
- all in all its pretty easy to do. At one point I thought I'd recreate
- the Berkeley syslog(1) interface for the C library.
-
-
- --
- --Chuck McManis Mr. NIS+ Sunsoft
- uucp: {anywhere}!sun!cmcmanis BIX: <none> Internet: cmcmanis@Eng.Sun.COM
- These opinions are my own and no one elses, but you knew that didn't you.
-