JC's C Debug Package

JC's C Debug Package

This is John Chambers' C debug package. See V.d for details. This is a collection of tools that are useful in finding out what's going wrong in C programs. It is especially useful in portability testing, since its tests won't compile or run correctly unless you have gotten the configuration stuff right.

The sh subdirectory has an Unshar script that may be useful if you received this in shar format and don't have unshar. It strips away email headers and feeds the rest of each file to sh for unpacking.


You will have to create a local.h file before things will compile. If you just unpacked this package on your machine, chances are that any local.h file here is not correct. If you are on one of the systems for which a foo_local.h file is included, you can probably use it as a prototype. Also, it is easier to get things to compile first if you use the hostype script to set up your environment. For csh users, the command is:
     eval `hostype -cshe`
Alternatively, run "hostype -cshe" and add its output to your .login file. If you are using a different shell, look at hostype to see what option you should use.

After you have a local.h file, type:

     make all
and it should all compile. This will also build a Vtest program that is for testing the package itself. Depending on debug level, Vtest generates all sorts of output, some of it pretty strange-looking at first. You will have to examine the program to see whether the output is correct. This is intentional; in examining Vtest, you will see how pieces of this debug package are used. You should read V.d before running Vtest.

The "make" command without args will build only libV.a, which is what you need (along with V.h and local.h) to use this package.


You might have noticed all those *.b files in this directory and wondered what they're all about. They are "prototype" *.c files with a lot of optional debug stuff included, in the form of lines with ':' in column 1.

This is a simple trick that allows us to strip out the debug stuff with a single-line change in the Makefile. We feed these files to the b-c script, which is actually just a call of sed that either enables a ':' line or blanks it out, depending on the character in column 2. It's simple to build everything with all the debugging enabled, and then recompile with the higher-level debug stuff deleted once you trust that it is reliable.


Testing

It's a good idea to run the test programs that are included here. If you do, they'll tell you a lot about things that will break other programs, and fixing them here probably means fixing them in any programs that use the V package

You must have perl (4 or 5) to run the automated tests. Type:

     make test
This will use the Test program, which will in turn run all the programs in the test/prog directory, and report on their success or failure. The Test script is a tool that you might want to examing; it is quite useful in building automated (regression) tests for other programs.

If you don't have perl (and for some silly reason can't get it), you can run the test scripts yourself. Their output should be compared with the source code, to see if it is correct. Samples of correct output are in test/stdout/* and test/stderr/*. Since some of the details of the tests' output will vary from system to system, you should examine the output to see if the minor differences are relevant.

Note that several of the tests do things that intentionally produce failures; they will warn you of the errors, and you can check to see that the correct errors actually occur.

Recommended test commands if you don't have perl:

  	Vtest
  	Vtest %d4
  	setenv D_Vtest 4Vtest.out; Vtest
  	memtest %d2

errno handling

One of the real pains in Unix is the crappy support for errno. This debug packages builds a pair of files, err.h and err.b, that provide a more useful interface to errno than the usual sys_errlist[]. However, getting it built correctly is a portability hassle. The errnotbl perl script does the job by reading from the system's table of error codes, mnemonics and messages.

Unfortuntaely, this table is kept in several different places and formats by various vendors. On some, the "man 2 intro" command gets it; on others, you need "man 2 errno"; on yet others, neither of these works, but /usr/include/sys/errno.h contains the messages in comments. We can handle any of these three. But you may need to edit the errnotbl script and tell it which of the three $pat patterns to use. You may also need to edit the Makefile, and modify the call of errnotbl to do the right thing. Alternatively, you may have received a version that has some *_err.h and *_err.b files for a similar system to yours. You can use these, though the result may not be quite right for your system. Sorry that it can't be done any better than this. If you find a way to improve it, let me know.

      Name                    Last modified       Size  Description

[DIR] Parent Directory 20-Apr-2004 11:54 - [TXT] Configure 13-Apr-2004 15:11 9k [TXT] Darwin_local.h 13-Apr-2004 16:31 1k [TXT] FREEBSD_local.h 28-Sep-2006 10:04 1k [   ] Lc.sh 24-Mar-2004 14:32 1k [TXT] Linux_local.h 13-Apr-2004 12:43 1k [TXT] Make 09-Mar-2000 12:09 1k [TXT] Makefile 13-Apr-2004 10:04 53k [TXT] Rm 10-Nov-1994 21:35 1k [TXT] Sdiff 12-Jun-1998 08:54 1k [TXT] SunOS_local.h 17-Dec-2003 15:08 1k [TXT] V.README 11-Sep-2003 10:22 5k [TXT] V.d 11-Sep-2003 10:34 28k [TXT] V.h 23-Dec-2003 10:30 38k [TXT] V.html 06-Dec-1999 11:58 31k [TXT] V_A_UC.h 17-Dec-2003 15:08 1k [TXT] V_D_UC.h 17-Dec-2003 15:08 1k [TXT] V_M_UC.h 06-Dec-1999 12:32 1k [TXT] V_S_UC.h 06-Dec-1999 12:32 1k [TXT] V_X_UC.h 06-Dec-1999 12:32 1k [TXT] V___lc.h 06-Dec-1999 12:32 1k [TXT] V_s_lc.h 06-Dec-1999 12:32 1k [TXT] V_t_lc.h 06-Dec-1999 12:32 1k [TXT] V_x_lc.h 06-Dec-1999 12:32 1k [TXT] Vcaller.b 06-Dec-1999 12:11 1k [TXT] Vcaller.c 04-Dec-2000 17:29 1k [TXT] Vchklog.b 05-Jun-2000 00:00 1k [TXT] Vchklog.c 04-Dec-2000 17:29 1k [TXT] Vdmsg.b 17-Oct-2002 15:30 3k [TXT] Vdmsg.c 17-Oct-2002 15:30 3k [TXT] Vinit.b 11-Apr-2002 10:14 7k [TXT] Vinit.c 09-Oct-2002 15:03 6k [TXT] Vnewlog.b 06-Dec-1999 11:58 1k [TXT] Vnewlog.c 04-Dec-2000 17:29 1k [TXT] Vopt.b 24-Jan-2003 10:50 6k [TXT] Vopt.c 28-Sep-2006 10:07 5k [TXT] Vpmsg.b 29-Mar-2000 11:25 1k [TXT] Vpmsg.c 04-Dec-2000 17:29 1k [TXT] Vsmsg.b 06-Dec-1999 11:58 1k [TXT] Vsmsg.c 04-Dec-2000 17:29 1k [TXT] Vtest 28-Sep-2006 23:06 59k [TXT] Vtest.b 11-Sep-2003 18:48 7k [TXT] Vtest.c 23-Sep-2003 19:46 5k [TXT] Vvmsg.b 29-Mar-2000 11:25 2k [TXT] Vvmsg.c 04-Dec-2000 17:29 1k [TXT] abbr.h 17-Dec-2003 15:08 4k [TXT] aix_errno.h 17-Dec-2003 15:08 8k [TXT] aix_local.h 17-Dec-2003 15:08 7k [TXT] backup.b 05-Jun-2000 00:00 9k [TXT] backup.c 04-Dec-2000 17:28 8k [TXT] backup.d 06-Dec-1999 11:58 5k [TXT] binaddr.b 11-Sep-2003 18:48 3k [TXT] binaddr.c 11-Sep-2003 18:48 3k [TXT] bzero.b 11-Sep-2003 18:15 1k [TXT] csfd.pid 11-Apr-1997 17:12 1k [TXT] da.h 17-Dec-2003 15:08 1k [TXT] daMsg.b 11-Sep-2003 09:59 2k [TXT] daOpen.b 11-Sep-2003 09:59 2k [TXT] daPrsPath.b 11-Sep-2003 09:59 2k [TXT] daRead.b 11-Sep-2003 10:11 1k [TXT] daSrvrLink.b 11-Sep-2003 09:59 1k [TXT] daSrvrOpen.b 11-Sep-2003 09:59 1k [TXT] dbg.d 11-Sep-2003 10:34 28k [TXT] default.mk 18-Jan-1995 13:20 1k [TXT] dmp.h 17-Dec-2003 15:08 3k [TXT] dmp_ascd.b 11-Sep-2003 18:48 2k [TXT] dmp_ascd.c 11-Sep-2003 18:49 2k [TXT] dmp_data.b 06-Dec-1999 11:58 1k [TXT] dmp_data.c 04-Dec-2000 17:29 1k [TXT] dmp_he.b 05-Jun-2000 00:00 1k [TXT] dmp_he.c 04-Dec-2000 17:29 1k [TXT] dmp_hexd.b 11-Sep-2003 18:48 6k [TXT] dmp_hexd.c 11-Sep-2003 18:49 5k [TXT] dmp_hexout.b 05-Jun-2000 00:00 2k [TXT] dmp_hexout.c 04-Dec-2000 17:29 2k [TXT] dmpstat.b 11-Sep-2003 18:48 3k [TXT] dmpstat.c 11-Sep-2003 18:49 3k [DIR] doc/ 27-Jan-2007 03:43 - [TXT] err.b 13-Mar-2002 21:12 4k [TXT] err.c 13-Mar-2002 21:12 4k [TXT] err.h 17-Dec-2003 15:08 1k [TXT] err_ultrix.b 17-Apr-1998 14:08 1k [TXT] errnotbl 11-Apr-1997 17:11 5k [TXT] exit.h 17-Dec-2003 15:08 1k [TXT] extern.h 17-Dec-2003 15:08 3k [TXT] foo 06-Dec-1999 11:58 1k [TXT] foo.b 05-Jun-2000 00:00 1k [TXT] foo1.b 05-Jun-2000 00:00 1k [TXT] freetest1 28-Sep-2006 23:06 54k [TXT] freetest1.b 06-Dec-1999 11:58 1k [TXT] freetest1.c 29-Nov-2002 20:43 1k [TXT] freetest2 28-Sep-2006 23:06 54k [TXT] freetest2.b 06-Dec-1999 11:58 1k [TXT] freetest2.c 29-Nov-2002 20:43 1k [TXT] gsharkit 17-Dec-2003 15:08 0k [TXT] hi.c 15-May-2003 08:20 1k [TXT] kendy_Linux_local.h 22-Feb-2002 21:47 1k [TXT] libV_version.c 26-Mar-2004 09:38 1k [TXT] linux_local.h 06-Dec-1999 12:32 7k [TXT] local.mk 26-Nov-2002 22:41 1k [TXT] make_message.b 29-May-2003 10:05 2k [DIR] man/ 27-Jan-2007 03:43 - [TXT] mem.b 11-Sep-2003 18:48 29k [TXT] mem.c 11-Sep-2003 18:49 28k [TXT] mem.d 11-Apr-2003 11:33 6k [TXT] mem.h 11-Sep-2003 18:48 7k [TXT] memchunk.b 15-Mar-2002 15:25 25k [TXT] memchunk.d 06-Dec-1999 11:58 6k [TXT] memchunk.h 23-Dec-2003 11:02 6k [TXT] memtest 28-Sep-2006 23:06 58k [TXT] memtest.b 11-Sep-2003 18:48 4k [TXT] memtest.c 23-Sep-2003 19:46 3k [TXT] minrand.b 08-Dec-1999 17:39 3k [TXT] minrand.c 08-Dec-1999 17:39 3k [TXT] minrand.h 17-Dec-2003 15:08 1k [TXT] nbio.b 11-Sep-2003 10:11 1k [TXT] nbio.c 11-Sep-2003 10:12 1k [TXT] osf1_local.h 17-Dec-2003 15:08 7k [TXT] pi.c 15-May-2003 08:21 1k [DIR] pl/ 27-Jan-2007 03:44 - [DIR] sh.esix4/ 13-Apr-2004 11:49 - [DIR] sh.osf1/ 13-Apr-2004 11:49 - [DIR] sh.sun4/ 13-Apr-2004 11:49 - [DIR] sh/ 27-Jan-2007 04:23 - [TXT] srvr.h 17-Dec-2003 15:08 1k [TXT] str.d 08-Mar-2002 14:07 11k [TXT] str.h 03-Jun-2003 09:47 20k [TXT] str_appscm.b 11-Sep-2003 10:03 2k [TXT] str_appscm.c 11-Sep-2003 10:03 2k [TXT] str_bldstr.b 11-Sep-2003 10:03 1k [TXT] str_bldstr.c 11-Sep-2003 10:03 1k [TXT] str_chksm.b 11-Sep-2003 10:03 2k [TXT] str_chksm.c 11-Sep-2003 10:03 2k [TXT] str_cmpssm.b 11-Sep-2003 10:03 3k [TXT] str_cmpssm.c 11-Sep-2003 10:03 3k [TXT] str_data.b 11-Sep-2003 10:03 1k [TXT] str_data.c 11-Sep-2003 10:03 1k [TXT] str_dupscm.b 11-Sep-2003 10:03 3k [TXT] str_dupscm.c 11-Sep-2003 10:03 3k [TXT] str_dupssm.b 11-Sep-2003 10:03 2k [TXT] str_dupssm.c 11-Sep-2003 10:03 2k [TXT] str_minstr.b 11-Sep-2003 10:03 2k [TXT] str_minstr.c 11-Sep-2003 10:03 1k [TXT] str_misc.b 11-Sep-2003 10:03 4k [TXT] str_misc.c 11-Sep-2003 10:03 3k [TXT] str_npad.b 11-Sep-2003 10:03 1k [TXT] str_npad.c 11-Sep-2003 10:03 1k [TXT] str_ntrim.b 11-Sep-2003 10:03 1k [TXT] str_ntrim.c 11-Sep-2003 10:03 1k [TXT] str_trim.b 11-Sep-2003 10:03 2k [TXT] str_trim.c 11-Sep-2003 10:03 2k [TXT] str_zapsm.b 11-Sep-2003 10:03 1k [TXT] str_zapsm.c 11-Sep-2003 10:03 1k [TXT] strnlen.b 28-Mar-2000 12:04 1k [TXT] strnlen.c 28-Mar-2000 12:04 1k [TXT] strtest 28-Sep-2006 23:06 59k [TXT] strtest.b 06-Dec-1999 12:09 2k [TXT] strtest.c 29-Nov-2002 20:43 2k [TXT] strtok.b 11-Sep-2003 10:11 1k [TXT] strtok.c 11-Sep-2003 10:12 1k [TXT] symaddr.b 05-Jun-2000 00:00 4k [TXT] symaddr.c 04-Dec-2000 17:29 4k [TXT] sys.h 11-Sep-2003 18:48 6k [TXT] sys_ctype.h 07-Jan-2003 13:00 1k [TXT] sys_dir.h 17-Dec-2003 15:08 2k [TXT] sys_errno.h 24-Mar-2004 15:00 1k [TXT] sys_fcntl.h 17-Dec-2003 15:08 1k [TXT] sys_file.h 17-Dec-2003 15:08 1k [TXT] sys_if.h 13-Apr-2004 10:02 1k [TXT] sys_in.h 13-Apr-2004 15:41 1k [TXT] sys_in_systm.h 17-Dec-2003 15:08 1k [TXT] sys_ip.h 13-Apr-2004 10:02 1k [TXT] sys_malloc.h 28-Sep-2006 23:05 1k [TXT] sys_netdb.h 17-Dec-2003 15:08 1k [TXT] sys_param.h 17-Dec-2003 15:08 1k [TXT] sys_pcb.h 13-Apr-2004 12:16 1k [TXT] sys_pthreads.h 17-Dec-2003 15:08 1k [TXT] sys_resource.h 17-Dec-2003 15:08 1k [TXT] sys_select.h 28-Sep-2006 23:31 1k [TXT] sys_signal.h 17-Dec-2003 15:08 1k [TXT] sys_socket.h 17-Dec-2003 15:23 1k [TXT] sys_stat.h 17-Dec-2003 15:08 1k [TXT] sys_stdio.h 28-Sep-2006 10:12 2k [TXT] sys_stdlib.h 17-Dec-2003 15:08 1k [TXT] sys_string.h 17-Dec-2003 16:07 1k [TXT] sys_tcp.h 17-Dec-2003 15:08 1k [TXT] sys_time.h 07-Jan-2003 13:00 3k [TXT] sys_types.h 24-Mar-2004 14:41 2k [TXT] sys_udp.h 17-Dec-2003 15:08 1k [TXT] sys_utsname.h 17-Dec-2003 15:08 1k [TXT] sys_varargs.h 13-Apr-2004 12:38 1k [TXT] sys_wait.h 17-Dec-2003 15:08 1k [TXT] tarkit 11-Apr-1997 17:12 0k [DIR] test/ 13-Apr-2004 11:50 - [TXT] tests 23-Dec-2003 10:34 0k [TXT] tnd3_local.h 17-Dec-2003 15:08 4k [TXT] trimtest 28-Sep-2006 23:06 55k [TXT] trimtest.b 08-May-2002 15:48 1k [TXT] trimtest.c 08-May-2002 15:48 1k [TXT] trllian_local.h 13-Apr-2004 10:02 1k [TXT] v_accept.b 06-Dec-1999 12:09 1k [TXT] v_accept.c 04-Dec-2000 17:28 1k [TXT] v_alarm.b 06-Dec-1999 12:09 1k [TXT] v_alarm.c 04-Dec-2000 17:28 1k [TXT] v_bcmp.b 05-Jun-2000 00:00 1k [TXT] v_bcmp.c 04-Dec-2000 17:28 1k [TXT] v_bcopy.b 13-Apr-2004 15:08 2k [TXT] v_bcopy.c 13-Apr-2004 15:09 1k [TXT] v_bind.b 05-Jun-2000 00:00 1k [TXT] v_bind.c 04-Dec-2000 17:28 1k [TXT] v_bindap.b 11-Sep-2003 10:11 1k [TXT] v_bindap.c 11-Sep-2003 10:12 1k [TXT] v_bshift.b 06-Dec-1999 12:09 1k [TXT] v_bshift.c 04-Dec-2000 17:28 1k [TXT] v_buf.b 06-Dec-1999 12:09 2k [TXT] v_buf.c 04-Dec-2000 17:28 2k [TXT] v_bzero.b 15-Mar-2002 15:26 1k [TXT] v_bzero.c 15-Mar-2002 15:26 1k [TXT] v_close.b 11-Sep-2003 10:11 1k [TXT] v_close.c 11-Sep-2003 10:12 1k [TXT] v_connect.b 11-Sep-2003 10:05 1k [TXT] v_connect.c 11-Sep-2003 10:06 1k [TXT] v_data.b 29-Nov-2002 20:43 5k [TXT] v_data.c 29-Nov-2002 20:43 5k [TXT] v_dsp.b 13-Jan-2003 18:06 4k [TXT] v_dsp.c 13-Jan-2003 18:06 4k [TXT] v_dsyslog.b 11-Sep-2003 10:11 1k [TXT] v_dumpv.b 06-Dec-1999 12:09 1k [TXT] v_dumpv.c 04-Dec-2000 17:28 1k [TXT] v_dup.b 06-Dec-1999 12:09 1k [TXT] v_dup.c 09-Oct-2002 15:02 1k [TXT] v_dup2.b 11-Sep-2003 10:11 2k [TXT] v_dup2.c 11-Sep-2003 10:12 2k [TXT] v_encodei.b 06-Dec-1999 11:45 1k [TXT] v_encodei.c 04-Dec-2000 17:29 1k [TXT] v_execv.b 06-Dec-1999 12:09 1k [TXT] v_execv.c 04-Dec-2000 17:29 1k [TXT] v_execve.b 06-Dec-1999 12:09 1k [TXT] v_execve.c 04-Dec-2000 17:29 1k [TXT] v_execvp.b 06-Dec-1999 12:09 1k [TXT] v_execvp.c 04-Dec-2000 17:29 1k [TXT] v_exit.b 06-Dec-1999 12:09 1k [TXT] v_exit.c 04-Dec-2000 17:29 1k [TXT] v_fclose.b 11-Sep-2003 10:11 1k [TXT] v_fclose.c 11-Sep-2003 10:12 1k [TXT] v_fcntl.b 11-Sep-2003 10:11 3k [TXT] v_fcntl.c 11-Sep-2003 10:11 3k [TXT] v_fct.b 06-Dec-1999 12:09 1k [TXT] v_fct.c 11-Sep-2003 10:02 1k [TXT] v_fdopen.b 11-Sep-2003 10:11 1k [TXT] v_fdopen.c 11-Sep-2003 10:12 1k [TXT] v_fgets.b 11-Sep-2003 10:11 1k [TXT] v_fgets.c 11-Sep-2003 10:12 1k [TXT] v_filnam.b 06-Dec-1999 11:58 1k [TXT] v_filnam.c 04-Dec-2000 17:29 1k [TXT] v_findenv.b 05-Jun-2000 00:00 1k [TXT] v_findenv.c 04-Dec-2000 17:29 1k [TXT] v_fopen.b 11-Sep-2003 10:11 1k [TXT] v_fopen.c 11-Sep-2003 10:11 1k [TXT] v_fork.b 06-Dec-1999 12:09 1k [TXT] v_fork.c 04-Dec-2000 17:29 1k [TXT] v_fread.b 11-Sep-2003 10:11 1k [TXT] v_fread.c 11-Sep-2003 10:12 1k [TXT] v_free.b 11-Sep-2003 10:03 1k [TXT] v_free.c 11-Sep-2003 10:03 1k [TXT] v_fstat.b 11-Sep-2003 10:11 1k [TXT] v_fstat.c 11-Sep-2003 10:12 1k [TXT] v_fwrite.b 11-Sep-2003 10:11 1k [TXT] v_fwrite.c 11-Sep-2003 10:11 1k [TXT] v_getenv.b 05-Jun-2000 00:00 1k [TXT] v_getenv.c 04-Dec-2000 17:29 1k [TXT] v_getsockopt.b 11-Sep-2003 10:11 1k [TXT] v_getsockopt.c 11-Sep-2003 10:12 1k [TXT] v_gettod.b 11-Sep-2003 17:55 1k [TXT] v_gettod.c 11-Sep-2003 17:55 1k [TXT] v_ghba.b 05-Jun-2000 00:00 1k [TXT] v_ghba.c 04-Dec-2000 17:29 1k [TXT] v_ghbn.b 20-Sep-2005 16:48 4k [TXT] v_ghbn.c 05-Apr-2006 15:38 4k [TXT] v_index.b 05-Jun-2000 00:00 1k [TXT] v_index.c 04-Dec-2000 17:29 1k [TXT] v_inet_ntoa.b 05-Jun-2000 00:00 1k [TXT] v_inet_ntoa.c 04-Dec-2000 17:29 1k [TXT] v_ioctl.b 11-Sep-2003 18:48 1k [TXT] v_ioctl.c 11-Sep-2003 18:48 1k [TXT] v_ipdot.b 05-Jun-2000 00:00 2k [TXT] v_ipdot.c 04-Dec-2000 17:29 2k [TXT] v_kill.b 06-Dec-1999 12:09 1k [TXT] v_kill.c 09-Oct-2002 15:02 1k [TXT] v_lastfld.b 06-Dec-1999 12:09 1k [TXT] v_lastfld.c 04-Dec-2000 17:29 1k [TXT] v_link.b 06-Dec-1999 12:09 1k [TXT] v_link.c 09-Oct-2002 15:02 1k [TXT] v_listen.b 06-Dec-1999 12:09 1k [TXT] v_listen.c 04-Dec-2000 17:29 1k [TXT] v_lseek.b 06-Dec-1999 11:45 1k [TXT] v_lseek.c 11-Sep-2003 10:02 1k [TXT] v_lstat.b 11-Sep-2003 10:11 1k [TXT] v_malloc.b 11-Sep-2003 10:03 2k [TXT] v_malloc.c 11-Sep-2003 10:03 2k [TXT] v_misc.b 29-Nov-2002 20:52 6k [TXT] v_misc.c 29-Nov-2002 20:52 6k [TXT] v_mknod.b 06-Dec-1999 12:09 1k [TXT] v_mknod.c 04-Dec-2000 17:29 1k [TXT] v_newfile.b 11-Sep-2003 10:11 3k [TXT] v_newfile.c 11-Sep-2003 10:11 3k [TXT] v_open.b 11-Sep-2003 10:11 1k [TXT] v_open.c 11-Sep-2003 10:11 1k [TXT] v_pipe.b 06-Dec-1999 12:09 3k [TXT] v_pipe.c 04-Dec-2000 17:29 3k [TXT] v_poll.b 11-Sep-2003 17:43 1k [TXT] v_poll.c 11-Sep-2003 17:43 1k [TXT] v_pthreads.b 06-Dec-1999 11:58 1k [TXT] v_pthreads.c 04-Dec-2000 17:29 1k [TXT] v_putenv.b 05-Jun-2000 00:00 1k [TXT] v_putenv.c 04-Dec-2000 17:29 1k [TXT] v_read.b 11-Sep-2003 10:11 1k [TXT] v_read.c 11-Sep-2003 10:12 1k [TXT] v_realloc.b 11-Sep-2003 10:03 1k [TXT] v_realloc.c 11-Sep-2003 10:03 1k [TXT] v_recv.b 11-Sep-2003 10:11 1k [TXT] v_recv.c 11-Sep-2003 10:12 1k [TXT] v_recvfr.b 11-Sep-2003 10:11 1k [TXT] v_recvfr.c 11-Sep-2003 10:12 1k [TXT] v_rename.b 08-Oct-2002 16:23 5k [TXT] v_rename.c 09-Oct-2002 15:03 4k [TXT] v_seek.b 11-Sep-2003 10:11 1k [TXT] v_seek.c 11-Sep-2003 10:12 1k [TXT] v_select.b 11-Sep-2003 10:05 2k [TXT] v_select.c 11-Sep-2003 10:06 1k [TXT] v_send.b 11-Sep-2003 10:11 1k [TXT] v_send.c 11-Sep-2003 10:11 1k [TXT] v_sendto.b 11-Sep-2003 10:11 1k [TXT] v_sendto.c 11-Sep-2003 10:11 1k [TXT] v_setpgrp.b 06-Dec-1999 12:09 1k [TXT] v_setpgrp.c 09-Oct-2002 15:03 1k [TXT] v_setsockopt.b 11-Sep-2003 10:11 1k [TXT] v_setsockopt.c 11-Sep-2003 10:11 1k [TXT] v_sigaction.b 11-Sep-2003 18:48 1k [TXT] v_sigaction.c 24-Mar-2004 13:40 1k [TXT] v_signal.b 11-Sep-2003 10:11 1k [TXT] v_signal.c 11-Sep-2003 10:11 1k [TXT] v_sleep.b 11-Sep-2003 10:05 1k [TXT] v_sleep.c 11-Sep-2003 10:06 1k [TXT] v_socket.b 05-Jun-2000 00:00 1k [TXT] v_socket.c 04-Dec-2000 17:29 1k [TXT] v_stat.b 11-Sep-2003 10:11 1k [TXT] v_stat.c 11-Sep-2003 10:11 1k [TXT] v_strdup.b 11-Sep-2003 10:03 1k [TXT] v_strdup.c 11-Sep-2003 10:03 1k [TXT] v_strlen.b 11-Sep-2003 10:11 1k [TXT] v_strlen.c 11-Sep-2003 10:12 1k [TXT] v_system.b 06-Dec-1999 12:09 1k [TXT] v_system.c 04-Dec-2000 17:29 1k [TXT] v_tell.b 11-Sep-2003 10:11 1k [TXT] v_tell.c 11-Sep-2003 10:12 1k [TXT] v_time.b 06-Dec-1999 12:09 2k [TXT] v_time.c 04-Dec-2000 17:29 2k [TXT] v_uname.b 06-Dec-1999 12:09 1k [TXT] v_uname.c 04-Dec-2000 17:29 1k [TXT] v_unlink.b 06-Dec-1999 12:09 1k [TXT] v_unlink.c 09-Oct-2002 15:03 1k [TXT] v_utime.b 11-Sep-2003 10:11 1k [TXT] v_utime.c 11-Sep-2003 10:12 1k [TXT] v_wait.b 06-Dec-1999 12:09 1k [TXT] v_wait.c 04-Dec-2000 17:29 1k [TXT] v_wait3.b 11-Sep-2003 10:11 1k [TXT] v_wait3.c 11-Sep-2003 10:12 1k [TXT] v_write.b 11-Sep-2003 10:11 2k [TXT] v_write.c 11-Sep-2003 10:11 2k [TXT] v_wwrite.b 11-Sep-2003 10:11 2k [TXT] v_wwrite.c 11-Sep-2003 10:11 2k [TXT] verbose.h 23-Dec-2003 10:30 38k [TXT] xenix_local.h 17-Dec-2003 15:08 3k

This is John Chambers' C debug package.  See V.d for details.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

To build things here:

	make clean
	make
	make test

If this all works, the *.h and libV.a files  should  be  linked  into
your build directory.  Or you can set up the appropriate search paths
to point to this directory. There is also an "install" entry that you
can change to point to wherever you'd like things installed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The sh subdirectory has an Unshar script that may be  useful  if  you
don't have unshar; it strips away email headers and feeds the rest of
each file to sh for unpacking.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

You will have to create a local.h file before things will compile. If
you  are  on  one  of  the  systems  for  which a foo_local.h file is
included, you can probably get things to compile first if you use the
hostype script to set up your environment. For csh users, the command
is:
   eval `hostype -cshe`

Alternatively, pick one of the local.h files and make it into one for
your system.  Then just type:
   make all
and it should all compile.  This will also build a Vtest program that
is for testing the package itself.  Depending on debug  level,  Vtest
generates  all  sorts of output, some of it pretty strange-looking at
first. You will have to examine the program to see whether the output
is correct. This is intentional; in examining Vtest, you will see how
pieces of this debug package are used.  You should  read  V.d  before
running Vtest.

The "make" command without args will build  only  libV.a,  which  is
what you need (along with V.h and local.h) to use this package.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Testing

It's a good idea to run the test programs that are included here.   If
you  do,  they'll  tell  you  a lot about things that will break other
programs, and fixing them here  probably  means  fixing  them  in  any
programs that use the V package

You must have perl (4 or 5) to run the automated tests.  Type:
   make test

This will use the Test  program,  which  will  in  turn  run  all  the
programs  in  the  test/prog directory, and report on their success or
failure.  The Test script is a tool that you might want to examing; it
is  quite  useful  in  building automated (regression) tests for other
programs.

If you don't have perl (and for some silly reason can't get  it),  you
can  run  the  test scripts yourself.  Their output should be compared
with the source code, to see if it is  correct.   Samples  of  correct
output  are  in  test/stdout/*  and  test/stderr/*.  Since some of the
details of the tests' output will vary  from  system  to  system,  you
should  examine  the  output  to  see  if  the  minor  differences are
relevant.

Note that several of the tests do things  that  intentionally  produce
failures;  they  will warn you of the errors, and you can check to see
that the correct errors actually occur.

Recommended test commands:
	Vtest
	Vtest %d4
	setenv D_Vtest 4Vtest.out; Vtest
	memtest %d2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

errno handling

One of the real pains in Unix is the crappy support for  errno.   This
debug packages builds a pair of files, err.h and err.b, that provide a
more useful interface to errno than the usual sys_errlist[].  However,
getting it built correctly is a portability hassle.  The errnotbl perl
script does the job by reading from the system's table of error codes,
mnemonics  and messages.  Unfortuntaely, this table is kept in several
different places and formats by various vendors.  On some, the "man  2
intro"  command  gets  it;  on  others, you need "man 2 errno"; on yet
others, neither of these works, but /usr/include/sys/errno.h  contains
the  messages in comments.  We can handle any of these three.  But you
need to edit the errnotbl script and tell it which of the  three  $pat
patterns  to  use.  You also need to edit the Makefile, and modify the
call of errnotbl to do the right thing.  Alternatively, you  may  have
received  a  version  that  has  some  *_err.h and *_err.b files for a
similar system to yours.  You can use these, though the result may not
be quite right for your system. Sorry that it can't be done any better
than this.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Upper/lower case

There are now some unix-like systems that do caseless matching in the
file system. One such culprit is Apple's OSX. This led to a change in
the names of some files, mostly the V_*.h header  files  that  define
debug macros for single letters.  On such systems, we can't have both
V_a.h and V_A.h, because they will be mapped to the  same  file.   So
these  header  files  were  renamed  to have "_UC" and "_lc" in their
names. Similarly, you should try to avoid introducing new files whose
names are the same as existing files except for case.

This applies only to file names. So far we haven't had any C compiler
writers stupid enough to do something so user-hostile.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -