home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sources / misc / 3897 < prev    next >
Encoding:
Text File  |  1992-09-04  |  56.9 KB  |  1,625 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: cpcahil@vti.com (Conor P. Cahill)
  4. Subject:  v32i006:  dbmalloc - Debug Malloc Library PL14, Part01/10
  5. Message-ID: <1992Sep4.151707.12332@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: 6ec4f1b33956848e3e70e95f4a91437e
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Virtual Technologies, Inc., Dulles VA
  10. References: <csm-v32i005=dbmalloc.101423@sparky.IMD.Sterling.COM>
  11. Date: Fri, 4 Sep 1992 15:17:07 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 1610
  14.  
  15. Submitted-by: cpcahil@vti.com (Conor P. Cahill)
  16. Posting-number: Volume 32, Issue 6
  17. Archive-name: dbmalloc/part01
  18. Environment: C, UNIX
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 1 (of 10)."
  27. # Contents:  README CHANGES MANIFEST CHECKSUMS Makefile Config.flags
  28. #   abort.c patchlevel
  29. # Wrapped by cpcahil@virtech on Thu Sep  3 18:39:18 1992
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'README' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'README'\"
  33. else
  34. echo shar: Extracting \"'README'\" \(20884 characters\)
  35. sed "s/^X//" >'README' <<'END_OF_FILE'
  36. X/*
  37. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (uunet!virtech!cpcahil).  
  38. X *
  39. X * This software may be distributed freely as long as the following conditions
  40. X * are met:
  41. X *         * the distribution, or any derivative thereof, may not be
  42. X *          included as part of a commercial product
  43. X *        * full source code is provided including this copyright
  44. X *        * there is no charge for the software itself (there may be
  45. X *          a minimal charge for the copying or distribution effort)
  46. X *        * this copyright notice is not modified or removed from any
  47. X *          source file
  48. X */
  49. X
  50. XThis package is a collection of routines which are a drop-in replacement
  51. Xfor the malloc(3), memory(3), string(3), and bstring(3) library functions.
  52. XThese replacement modules are different from the original modules in that
  53. Xthey provide a full set of debugging features which detect malloc 
  54. Xmemory overruns and other types of misuse.
  55. X
  56. XThe software has been developed under ISC UNIX and ported to several other
  57. XUNIX architectures including HP-UX, SunOS, and AIX.  You should be able 
  58. Xto get it to run out of the box on most UNIX systems.  If not, see the PROBLEMS
  59. Xfile for some help.  
  60. X
  61. XVirtual Technologies, Inc also supports a commercial version of the library 
  62. Xwhich includes more features, better error reporting, better performance,
  63. Xno need to recompile the code to be verified, professional documentation,
  64. Xand support.  The commercial version is available on a growing range of
  65. Xarchitectures and is reasonably priced.
  66. X
  67. XIf you would like more info on the commercial version, you can send email
  68. Xto info@virtech.vti.com.
  69. X
  70. X--------------------------------------------------------------------------
  71. XPORTING NOTES:
  72. X
  73. X0. Short cut:  just run "make runtests".  This will configure and compile
  74. X   the library and compile and run all of the tests.  Otherwise, you can
  75. X   follow the following steps:
  76. X
  77. X1. Edit the makefile and set the appropriate flags for the compilations
  78. X   See note about configure and setting special flags in the next step.
  79. X
  80. X2. Type make malloc.h  - which will run the Configure script to generate
  81. X   the appropriate entries in malloc.h file for this compiler/OS.
  82. X   If the configure script has problems, then you will probably have to 
  83. X   configure the malloc.h file by hand.  Look in the PROBLEMS file
  84. X   for more info.
  85. X
  86. X   NOTE: Configure looks around for all of the compilers you have on the
  87. X   system and attempts to setup a single malloc.h that can be included by
  88. X   any of them.  Configure assumes that the compilers can be called without
  89. X   any special flags for a basic compile.  If this is not the case you
  90. X   will have to modify the Config.flags file and add a line with the
  91. X   compiler name and special flags. 
  92. X
  93. X   For example, if you wanted to use the -Aa flag on HP/UX cc (strict 
  94. X   ANSI mode - which also would require -D_POSIX_SOURCE to compile the
  95. X   malloc library), you would have to add the line: "cc -Aa -D_POSIX_SOURCE"
  96. X   to Config.flags (and add -Aa -D_POSIX_SOURCE to the CFLAGS definition
  97. X   in the Makefile).
  98. X
  99. X   REMEMBER, if you do this, you may get error message if the malloc.h
  100. X   file is included in compiles that do not include the specified flags.
  101. X   If you expect different compilation environments with the same compiler,
  102. X   you might want to have different versions of the debugging malloc.h file
  103. X   for each environment.
  104. X
  105. X   NOTE: Configure will automatically generate two configurations for
  106. X   gcc if it finds it (one for normal gcc and one for gcc -traditional)
  107. X   so that the library can be used in either mode.
  108. X
  109. X   NOTE: real programmers don't need any fancy Configure script, they can 
  110. X   configure the utility by hand (and so bypass this step). :-}
  111. X
  112. X   PROBLEMS: if you find a problem with the configure script, you can do
  113. X   one of the following:
  114. X
  115. X    1. give up
  116. X    2. report problem and give up
  117. X    3. fix problem, send fix to me and continue
  118. X    4. bypass the automatic configuration (see the PROBLEMS file for
  119. X       info on how to do this).
  120. X
  121. X   Since I have ensured that this works on all the environments that I 
  122. X   have access to, I will not be able to fix a problem that you have 
  123. X   on your OS/compiler combination unless you give me extremely good 
  124. X   details about the problem including:
  125. X    
  126. X    1. Hardware & OS
  127. X    2. compiler
  128. X    3. compilation environment (i.e. on suns you can run in a Sys V
  129. X       environment or a BSD environment - this is important)
  130. X    4. any flags used for compiling
  131. X    5. output from "make runtests"
  132. X    6. any pertinent files - which *should* include the following:
  133. X    
  134. X        /usr/include/memory.h (if it exists)
  135. X        /usr/include/malloc.h
  136. X        /usr/include/string.h
  137. X        malloc.h (if it got generated)
  138. X        .configure
  139. X        .configure.s
  140. X        
  141. X
  142. X   With this info I will probably be able to *guess* at the source of
  143. X   the problem and send you back a potential fix.  However, without access
  144. X   to such an architecture, I may not be able to fix the problem. 
  145. X
  146. X3. Type make (See the PROBLEMS file if you have a problem compiling)
  147. X
  148. X4. Type make runtests to build and runt the tests (some of which will take
  149. X   a long time and some which will abort).  See the notes below for 
  150. X   more info on the tests and the expected output
  151. X
  152. X5. Install libdbmalloc.a and malloc.h somewhere where users can get
  153. X   to them by using make install (make sure INSTDIR is set correctly
  154. X   in the makefile)
  155. X
  156. X6. If the system memory routines are not compatible with the ones expected
  157. X   by the malloclib (this is the case if the configure script doesn't create
  158. X   a datam[cs].O file) and if you are good with assembly, and if you have
  159. X   nothing better to do, you could put together an asm module for either, or
  160. X   both of the functions (as I have done for the DataMC routine on 386 
  161. X   systems).
  162. X
  163. X   These two functions are typically the bottle neck when running the debugging
  164. X   library and I have found that a few moments spent on carefully implementing
  165. X   these routines will vastly increase the performance of the library.
  166. X
  167. X   If you do start upon this mission, make sure that you maintain the 
  168. X   functionality present in the portable versions of the routines.  This is
  169. X   especially important with the DataMC routine, which must function like
  170. X   memcpy plus handle overlapping moves (like memmove).
  171. X
  172. X   Once you have it working (and it passes the tests) send it in and I will 
  173. X   include it in the baseline.
  174. X
  175. X--------------------------------------------------------------------------
  176. XUSAGE:
  177. X
  178. XTo use the library, include the malloc.h header included with this
  179. Xlibrary ( this is not entirely necessary, but the identification of where
  180. Xthe problems originated will be much better if it is), compile the 
  181. Xobject files, and link with the libdbmalloc.a (make sure it is before
  182. Xthe libc.a on the link command - this is the default if you don't specifically
  183. Xinclude libc.a on your link).
  184. X
  185. XFor more info on how to use the library, see the man page in
  186. Xmalloc.3 ([nt]roff source) or malloc.man (already nroffed).
  187. X
  188. X--------------------------------------------------------------------------
  189. XTEST PROGRAMS
  190. X
  191. XThe library comes with several test programs that should be run before
  192. Xit is installed on the system.  The tests are run automatically by the
  193. XRuntests shell (which is invoked by make runtests).  Runtests will attempt
  194. Xto automatically determine if the library passes all of the tests and
  195. Xwill save all of its output in the file Runtests.out.  If a failure is 
  196. Xreported, you should look at Runtests.out for more info on where the failure
  197. Xoccurred.
  198. X
  199. XThe following test are run by the script:
  200. X
  201. Xtestmalloc - this program runs through zillions of mallocs/reallocs and frees
  202. Xin order to exercise the malloc system.  The output from this program will
  203. Xlook something like the following (NOTE that if run from the Runtests script,
  204. Xit will only run for 50000 iterations):
  205. X
  206. X    MAXITER 1000000 MAXOBJS 1000 BIGOBJ 90000, TINYOBJ 80, nbig/ntiny 1/100
  207. X    Memory use at start: 20140 bytes
  208. X    Starting the test...
  209. X    0 iterations
  210. X    10000 iterations
  211. X    20000 iterations
  212. X    ....(lots of iterations skipped)....
  213. X    980000 iterations
  214. X    990000 iterations
  215. X
  216. X    Did 1000000 iterations, 999 objects, 515733 mallocs, 484267 reallocs
  217. X    Memory use at end: 1617580 bytes
  218. X    Memory use after free: 1617580 bytes
  219. X
  220. X    ************************************************************...
  221. X                     FREE     FREE                 ...
  222. X      PTR      NEXT     PREV     NEXT     PREV      FLAGS     ...
  223. X    -------- -------- -------- -------- -------- ---------- -...
  224. X    0x403C30 0x407510 0x000000 0x000000 0x000000 0x00000000  ...
  225. X    0x407510 0x407640 0x403C30 0x000000 0x000000 0x03156111  ...
  226. X    0x407640 0x000000 0x407510 0x000000 0x000000 0x03156100  ...
  227. X    Malloc start:      0x403C30
  228. X    Malloc end:        0x407640
  229. X    Malloc data start: 0x407510
  230. X    Malloc data end:   0x58F510
  231. X    Malloc free list:  0x407640
  232. X
  233. X    startsize 20140 != endsize 1617580
  234. X
  235. XThis is normal output.  If it doesn't get to the expected number of 
  236. Xiterations (50000 if run by runtest, or 1000000 if run from the command
  237. Xline with no other arguments) or if there are any allocations still in
  238. Xeffect that were initiated by testmalloc.c, something went wrong (the
  239. Xlibrary didn't pass the test).  Don't worry about having exact matches with
  240. Xthe numbers listed above and don't worry that startsize != endsize.
  241. X
  242. XNote that there may be several entries in the malloc chain if the C startup
  243. Xfunction has allocated data before the main gets called.  The key is that
  244. Xthere are no allocated entries (those with the 1 bit on in the flags field)
  245. Xleft that are identified as being allocated within the testmalloc.c file.
  246. XIn the example above, the middle entry does in fact have the 1 bit on, but
  247. Xin the info that was cut-off, there was no indication that it was allocated
  248. Xwithin testmalloc.c, therefore it must have been allocated somewhere else.
  249. XThe last line in the chain will usually say it was allocated within
  250. Xtestmalloc.c; however, as in this case, it will also indicate that it is
  251. Xnot in use (the 1 bit will be off in the flags field).
  252. X
  253. XMost likely, if the program ran to completion (processed 1000000 iterations),
  254. Xthe test was successful.
  255. X
  256. XAlso note that this program performs many small and large allocations and
  257. Xmay take a long time to run.  The run time for various architectures (all
  258. Xdone under fairly quiet system utilization):
  259. X
  260. X    486/33 with cc under ISC UNIX 3.0:        1:17 (1 minute, 17 secs)
  261. X    HP9000/857 with cc under HP/UX 8.0:        0:59
  262. X    RS6000/320 with cc under AIX ?3.1?:        3:47
  263. X    ATT 3B2/600 with cc under SVR4.1ES:           16:59
  264. X
  265. XIf this test takes too long for you, you can speed it up by setting 
  266. XMALLOC_FILLAREA equal to zero.  This has the following effects on the 
  267. Xtime it takes to run the tests:
  268. X
  269. X    486/33 with cc under ISC UNIX 3.0:        0:45.8 (45 seconds)
  270. X    HP9000/857 with cc under HP/UX 8.0:        0:33.4
  271. X    RS6000/320 with cc under AIX ?3.1?:        3:47
  272. X    ATT 3B2/600 with cc under SVR4.1ES:            7:04.2
  273. X
  274. XIf it is still too slow, you can add an argument to the program specifying
  275. Xthe number of iterations.  The default is 1,000,000. 
  276. X
  277. XOne thing to think about before making a change to increase the performance
  278. Xof this test is that maintaining dynamic memory (along wit the additional
  279. Xdebugging code that has been added) is a somewhat complex piece of software.
  280. XIt should be well tested before you place it into a user environment.
  281. X
  282. Xtestmem - this program tests many of the string and memory functions to verify
  283. Xthat they work as they are supposed to.  You should get no output from this
  284. Xtest.  If you do, something is wrong.
  285. X
  286. Xtesterr - this program tests several malloc related program errors (to make
  287. Xsure that the library is correctly identifying the problems).  The output
  288. Xfrom the test goes to stderr and should be similar to the following (although
  289. Xbecause of machine architectures the error messages may be slightly different):
  290. X
  291. X    -------------------------------------
  292. X    Error from strcpy() - out of bounds
  293. X    MALLOC Warning from strncpy() (called from testerr.c line 33):
  294. X    Pointer within malloc region, but outside of malloc data bounds
  295. X    This error is *probably* associated with the following allocation:
  296. X
  297. X        A call to malloc for 10 bytes in testerr.c on line 29.
  298. X        This was the 2nd call to malloc.
  299. X
  300. X    -------------------------------------
  301. X    Error from memset() - out of bounds
  302. X    MALLOC Warning from memset() (called from testerr.c line 37):
  303. X    Pointer within malloc region, but outside of malloc data bounds
  304. X    This error is *probably* associated with the following allocation:
  305. X
  306. X        A call to malloc for 20 bytes in testerr.c on line 27.
  307. X        This was the 1st call to malloc.
  308. X
  309. X    -------------------------------------
  310. X    Error from free() - overrun
  311. X    MALLOC Warning from free() (called from testerr.c line 41):
  312. X    Data has overrun beyond requested number of bytes
  313. X    This error is *probably* associated with the following allocation:
  314. X
  315. X        A call to malloc for 20 bytes in testerr.c on line 27.
  316. X        This was the 1st call to malloc.
  317. X
  318. X    MALLOC Warning from free() (called from testerr.c line 41):
  319. X    Data has overrun beyond requested number of bytes
  320. X    This error is *probably* associated with the following allocation:
  321. X
  322. X        A call to malloc for 20 bytes in testerr.c on line 27.
  323. X        This was the 1st call to malloc.
  324. X
  325. X    -------------------------------------
  326. X    Error from free() - double free
  327. X    MALLOC Warning from free() (called from testerr.c line 45):
  328. X    Data area is not in use (can't be freed or realloced)
  329. X    This error is *probably* associated with the following allocation:
  330. X
  331. X        A call to malloc for 20 bytes in testerr.c on line 27.
  332. X        This was the 1st call to malloc.
  333. X
  334. X        This block was freed on the 1st call to free()
  335. X        in testerr.c on line 41.
  336. X
  337. X    -------------------------------------
  338. X    NO error from bzero
  339. X    -------------------------------------
  340. X    Error from bzero() - out of bounds
  341. X    MALLOC Warning from bzero() (called from testerr.c line 53):
  342. X    Pointer within malloc region, but outside of malloc data bounds
  343. X    This error is *probably* associated with the following allocation:
  344. X
  345. X        A call to malloc for 10 bytes in testerr.c on line 29.
  346. X        This was the 2nd call to malloc.
  347. X
  348. X    -------------------------------------
  349. X    Error from free() - overrun
  350. X    MALLOC Warning from free() (called from testerr.c line 57):
  351. X    Data has overrun beyond requested number of bytes
  352. X    This error is *probably* associated with the following allocation:
  353. X
  354. X        A call to malloc for 10 bytes in testerr.c on line 29.
  355. X        This was the 2nd call to malloc.
  356. X
  357. X    MALLOC Warning from free() (called from testerr.c line 57):
  358. X    Data has overrun beyond requested number of bytes
  359. X    This error is *probably* associated with the following allocation:
  360. X
  361. X        A call to malloc for 10 bytes in testerr.c on line 29.
  362. X        This was the 2nd call to malloc.
  363. X
  364. X    -------------------------------------
  365. X    Error from free() - invalid magic
  366. X    MALLOC Warning from free() (called from testerr.c line 61):
  367. X    Malloc region does not have valid magic number in header
  368. X    -------------------------------------
  369. X    Error from memset() - out of bounds
  370. X    MALLOC Warning from memset() (called from testerr.c line 68):
  371. X    Pointer within malloc region, but outside of malloc data bounds
  372. X    This error is *probably* associated with the following allocation:
  373. X
  374. X        A call to malloc for 10 bytes in testerr.c on line 63.
  375. X        This was the 3rd call to malloc.
  376. X
  377. X    -------------------------------------
  378. X    Error from malloc() - chain broken
  379. X    MALLOC Warning from malloc() (called from testerr.c line 72):
  380. X    Pointers between this segment and adjoining segments are invalid
  381. X    This error is *probably* associated with the following allocation:
  382. X
  383. X        A call to malloc for 10 bytes in testerr.c on line 63.
  384. X        This was the 3rd call to malloc.
  385. X
  386. X    MALLOC Warning from malloc() (called from testerr.c line 72):
  387. X    Malloc region does not have valid magic number in header
  388. X    MALLOC Fatal error from malloc() (called from testerr.c line 72):
  389. X    Pointer is not within malloc area
  390. X
  391. Xabort-core dumped (or something about SIGIOT) can be expected at the end
  392. Xof the test because of a purposeful overwrite of memory.  Depending upon the
  393. Xarchitecture, the purposeful overwrite may actually cause some other form
  394. Xof core dump.  If it dumps somewhere in the last error, you can *probably*
  395. Xconsider it normal.
  396. X
  397. Xteststack - this test verifies that the stack tracking mechanism still works.
  398. XThe program just uses the malloc_enter and malloc_leave macros to record a
  399. Xstack while allocating variables and then dumping the list.  The output
  400. Xshould look something like the following:
  401. X
  402. X    MALLOC Warning from strcpy() (called from teststack.c line 84):
  403. X    Pointer within malloc region, but outside of malloc data bounds
  404. X    This error is *probably* associated with the following allocation:
  405. X
  406. X        A call to malloc for 1 bytes in teststack.c on line 82.
  407. X        This was the 5th call to malloc.
  408. X        Stack from where allocated:
  409. X         -> sub3() in teststack.c(80)
  410. X         -> sub2() in teststack.c(65)
  411. X         -> sub1() in teststack.c(46)
  412. X         -> main() in teststack.c(27)
  413. X
  414. X    MALLOC Warning from strcpy() (called from teststack.c line 84):
  415. X    Pointer within malloc region, but outside of malloc data bounds
  416. X    This error is *probably* associated with the following allocation:
  417. X
  418. X        A call to malloc for 1 bytes in teststack.c on line 82.
  419. X        This was the 7th call to malloc.
  420. X        Stack from where allocated:
  421. X         -> sub3() in teststack.c(80)
  422. X         -> sub1() in teststack.c(46)
  423. X         -> main() in teststack.c(27)
  424. X
  425. X    MALLOC Warning from strcpy() (called from teststack.c line 84):
  426. X    Pointer within malloc region, but outside of malloc data bounds
  427. X    This error is *probably* associated with the following allocation:
  428. X
  429. X        A call to malloc for 1 bytes in teststack.c on line 82.
  430. X        This was the 9th call to malloc.
  431. X        Stack from where allocated:
  432. X         -> sub3() in teststack.c(80)
  433. X         -> sub2() in teststack.c(65)
  434. X         -> sub1() in teststack.c(46)
  435. X         -> main() in teststack.c(27)
  436. X
  437. X    MALLOC Warning from strcpy() (called from teststack.c line 84):
  438. X    Pointer within malloc region, but outside of malloc data bounds
  439. X    This error is *probably* associated with the following allocation:
  440. X
  441. X        A call to malloc for 1 bytes in teststack.c on line 82.
  442. X        This was the 13th call to malloc.
  443. X        Stack from where allocated:
  444. X         -> sub3() in teststack.c(80)
  445. X         -> sub2() in teststack.c(65)
  446. X         -> main() in teststack.c(27)
  447. X
  448. X    MALLOC Warning from strcpy() (called from teststack.c line 84):
  449. X    Pointer within malloc region, but outside of malloc data bounds
  450. X    This error is *probably* associated with the following allocation:
  451. X
  452. X        A call to malloc for 1 bytes in teststack.c on line 82.
  453. X        This was the 15th call to malloc.
  454. X        Stack from where allocated:
  455. X         -> sub3() in teststack.c(80)
  456. X         -> main() in teststack.c(27)
  457. X
  458. X    ************************** Dump of Malloc Chain ******************...
  459. X    POINTER     FILE  WHERE         LINE      ALLOC        DATA     HE...
  460. X    TO DATA      ALLOCATED         NUMBER     FUNCT       LENGTH  OF B...
  461. X    -------- -------------------- ------- -------------- ------- -----...
  462. X    0x404D94 teststack.c               29 malloc(2)           10 01010...
  463. X         -> main() in teststack.c(27)
  464. X    0x404DE8 teststack.c               48 malloc(3)            0        
  465. X         -> sub1() in teststack.c(46)
  466. X         -> main() in teststack.c(27)
  467. X    0x404E34 teststack.c               67 malloc(4)            0       
  468. X         -> sub2() in teststack.c(65)
  469. X         -> sub1() in teststack.c(46)
  470. X         -> main() in teststack.c(27)
  471. X    0x404E80 teststack.c               82 malloc(5)            1 31   
  472. X         -> sub3() in teststack.c(80)
  473. X         -> sub2() in teststack.c(65)
  474. X         -> sub1() in teststack.c(46)
  475. X         -> main() in teststack.c(27)
  476. X    0x404ECC teststack.c               71 malloc(6)           10 01010...
  477. X         -> sub2() in teststack.c(65)
  478. X         -> sub1() in teststack.c(46)
  479. X         -> main() in teststack.c(27)
  480. X    0x404F20 teststack.c               82 malloc(7)            1 31  
  481. X         -> sub3() in teststack.c(80)
  482. X         -> sub1() in teststack.c(46)
  483. X         -> main() in teststack.c(27)
  484. X    0x404F6C teststack.c               67 malloc(8)            0    
  485. X         -> sub2() in teststack.c(65)
  486. X         -> sub1() in teststack.c(46)
  487. X         -> main() in teststack.c(27)
  488. X    0x404FB8 teststack.c               82 malloc(9)            1 31
  489. X         -> sub3() in teststack.c(80)
  490. X         -> sub2() in teststack.c(65)
  491. X         -> sub1() in teststack.c(46)
  492. X         -> main() in teststack.c(27)
  493. X    0x405004 teststack.c               71 malloc(10)          10 01010...
  494. X         -> sub2() in teststack.c(65)
  495. X         -> sub1() in teststack.c(46)
  496. X         -> main() in teststack.c(27)
  497. X    0x405058 teststack.c               56 malloc(11)          10 01010...
  498. X         -> sub1() in teststack.c(46)
  499. X         -> main() in teststack.c(27)
  500. X    0x4050AC teststack.c               67 malloc(12)           0   
  501. X         -> sub2() in teststack.c(65)
  502. X         -> main() in teststack.c(27)
  503. X    0x4050F8 teststack.c               82 malloc(13)           1 31 
  504. X         -> sub3() in teststack.c(80)
  505. X         -> sub2() in teststack.c(65)
  506. X         -> main() in teststack.c(27)
  507. X    0x405144 teststack.c               71 malloc(14)          10 01010...
  508. X         -> sub2() in teststack.c(65)
  509. X         -> main() in teststack.c(27)
  510. X    0x405198 teststack.c               82 malloc(15)           1 31
  511. X         -> sub3() in teststack.c(80)
  512. X         -> main() in teststack.c(27)
  513. X
  514. X
  515. XThe item of importance is the presence of the stack information on the
  516. Xlines with the arrows (->).
  517. X
  518. END_OF_FILE
  519. if test 20884 -ne `wc -c <'README'`; then
  520.     echo shar: \"'README'\" unpacked with wrong size!
  521. fi
  522. # end of 'README'
  523. fi
  524. if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  525.   echo shar: Will not clobber existing file \"'CHANGES'\"
  526. else
  527. echo shar: Extracting \"'CHANGES'\" \(15052 characters\)
  528. sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
  529. X$Id: CHANGES,v 1.34 1992/09/03 22:24:33 cpcahil Exp $
  530. X
  531. Xpatchlevel 14
  532. X    General
  533. X        - Many configuration changes from Jonathan I. Kamens
  534. X        - added code to support better reallocations when nearby space
  535. X          is available.
  536. X    Configure
  537. X        - changes to support more systems
  538. X    fill.c
  539. X        - fixed bug that caused problem when free-filling was disabled
  540. X    realloc.c
  541. X        - now looks for extra space before the segment to be realloced
  542. X        - if segment is to be increased and it is at the end of memory,
  543. X          just sbrk extra room onto the array
  544. X    malloc.c 
  545. X        - added code to support joining to previous segment
  546. X        - added initialization of free file pointer
  547. X    
  548. Xpatchlevel 13
  549. X    ******IMPORTANT*******
  550. X        - malloc_size() function name changed to malloc_inuse()
  551. X        - mallopt() function name changed to dbmallopt()
  552. X        - new malloc_size() function with different behavior
  553. X        - dbmallopt() now takes a pointer to the union
  554. X    Configure
  555. X        - added check to use string.h instead of memory.h
  556. X        - changed code to guess at settings when they couldn't 
  557. X          be determined
  558. X        - added ability to bypass compilers that couldn't make
  559. X          executables (freq case with g++ if libg++ isn't available)
  560. X        - added ASM checks for older 386 assemblers
  561. X    Makefile
  562. X        - documented new USE_NLS definition
  563. X        - new memalign source/object
  564. X    PROBLEMS
  565. X        - updated descriptions of parameter settings
  566. X    abort.c
  567. X        - new file containing malloc_abort function.
  568. X    cctest.c
  569. X        - added support for overriding inclusion of memory.h
  570. X    datamc.c
  571. X        - asm changes for old ISC assembler
  572. X    free.c 
  573. X        - added warning about freeing marked segments
  574. X    leak.c    
  575. X        - fixed bug in malloc_size
  576. X        - changed name of malloc_size to malloc_inuse since malloc_size
  577. X          collided with funtion of same name on the NeXT.
  578. X    malign.c
  579. X        - new file
  580. X        - support functions for aligned allocations (compatible with
  581. X          SVR4 memalign(3))
  582. X    malloc.3
  583. X        - changed references to malloc_size to malloc_inuse.
  584. X        - removed values from discussions on #defines
  585. X        - changed mallopt references to dbmallopt
  586. X        - added descriptions of the default settings for options
  587. X        - added description of freemark option
  588. X    malloc.c
  589. X        - changed to call malloc_abort
  590. X        - added support for new options
  591. X        - added check for zero byte allocations
  592. X    malloc.h.org
  593. X        - changed references to malloc_size to malloc_inuse.
  594. X        - changed mallopt references to dbmallopt
  595. X        - added definitions for malloc_mark and new malloc_size
  596. X    mallopt.c
  597. X        - changed mallopt to dbmallopt
  598. X        - added support for freemark option
  599. X    realloc.c
  600. X        - added code to make sure marked segment stays marked.
  601. X    size.c
  602. X        - new malloc_size function
  603. X    string.c
  604. X        - fixed CompareUpper macro 
  605. X        - added code to preclude inclusion of ctype.h when USE_NLS
  606. X          is defined to allow for native language support
  607. X    testerr.c
  608. X        - added tests for memalign(), malloc_size() and malloc_inuse()
  609. X        - changed mallopt references to dbmallopt
  610. X    testmalloc.c
  611. X        - changed mallopt calls to dbmallopt
  612. X    
  613. Xpatchlevel 12
  614. X    general
  615. X        - many changes to handle systems with ints smaller than longs
  616. X    Configure
  617. X        - fixed to handle problem on some systems where it didn't 
  618. X          correctly determine if setenv was present
  619. X        - changed to better handle configuration on Sun's
  620. X        - added ability to continue even if an error was found
  621. X    Makefile
  622. X        - added docs on using -DANSI_NULLS to allow for ANSI NULL
  623. X          support in realloc and free
  624. X    cctest.c
  625. X        - added code to assist build on Suns where gcc is present
  626. X    datamc.c
  627. X        - fixed bug that caused overwriting of memory areas
  628. X    free.c
  629. X        - added support for ANSI_NULLS #define
  630. X    malloc.e
  631. X        - some minor format changes.
  632. X    realloc.c
  633. X        - added support for ANSI_NULLS #define
  634. Xpatchlevel 11
  635. X    general
  636. X        - significant performance enhancements
  637. X        - DG/UX libc internal interface (from Paul Smith)
  638. X        - changed filling so that it now will always fill some bytes
  639. X          both before and after the allocated segment
  640. X        - misc changes from port to Minix on Atari (from Rainer Orth)
  641. X        - added use of system memset/memcpy routines for performance
  642. X        - added override capability for fill characters and buffer
  643. X          boundary size
  644. X    Configure
  645. X        - cleaned up reference to DG equipment
  646. X        - added code to pull memset and memcpy out of libc.a
  647. X    Makefile
  648. X        - entries for new source file(s)
  649. X        - added code to automatically use system mem* funcs if
  650. X          the configure script found them appropriate
  651. X    Runtests
  652. X        - added better checking of the test output 
  653. X    cctest.c
  654. X        - added tests for DataMC and DataMS
  655. X        - added program to use to map memset to DataMS and memcpy
  656. X          to DataMC
  657. X    datamc.c  
  658. X        - new module for copying data around
  659. X        - added ASM version for 386 systems
  660. X    datams.c  
  661. X        - new module for filling data
  662. X    dgmalloc.c
  663. X        - new module for DG/UX stuff
  664. X    fill.c
  665. X        - new module containing all code related to filling data areas
  666. X        - added support for several levels of filling
  667. X        - optimized fill mechanism
  668. X    free.c
  669. X        - modified fill area checks
  670. X        - fix over/underruns so error is only reported once
  671. X        - changed to only fill data areas that need filling
  672. X    m_init.c
  673. X        - added initialization of new fill character overrides
  674. X    m_perror.c
  675. X        - added info to error message
  676. X    malloc.3
  677. X        - updated manual to reflect changes in code
  678. X    malloc.h.org
  679. X        - defs for new DG/UX stuff
  680. X    malloc.c
  681. X        - modified filling so that before and after segments are always
  682. X          filled (only fill basic segment if fill area is enabled)
  683. X        - removed filling modules (moved to fill.c)
  684. X        - optimized use of filling so that only fills that were needed
  685. X          get called
  686. X        - support for overriding boundary size
  687. X    mallocin.h
  688. X        - defs for new fillarea stuff
  689. X        - defs for fill optimizations
  690. X        - stuff for fill character overrides
  691. X    mallopt.c
  692. X        - support for new fillarea flags
  693. X        - support for malloc_fill flag setting
  694. X    mchain.c
  695. X        - added underrun check
  696. X        - fix over/underruns so error is only reported once.
  697. X    mcheck.c
  698. X        - more performance enhancements
  699. X        - added verification that segment was in use for pointers that
  700. X          are being verified
  701. X        - added tweak to find segment quickly if the pointer that was
  702. X          passed points to the beginning of the segment.
  703. X    memory.c
  704. X        - changed to use fast DataMC/DataMS funcs for data movements
  705. X        - changed comparison functions to base return upon unsigned
  706. X          comparisons as is required under ANSI C
  707. X    realloc.c
  708. X        - support for new fill mechanism
  709. X        - support for overriding boundary size
  710. X    string.c
  711. X        - changed comparison functions to base return upon unsigned
  712. X          comparisons as is required under ANSI C
  713. X        - changed to use fast memset/memcpy for data movements
  714. X
  715. Xpatchlevel 10
  716. X    general 
  717. X        - more portability changes thanks to Denny Page.
  718. X        - General mechanism for adding new alloc interfaces
  719. X        - XtAlloc routine tracking (idea and sample source from Denny
  720. X          Page)
  721. X        - yet another session with lint
  722. X    Configure
  723. X        - changes to handle compilers that only give warnings for
  724. X          some of the test situations
  725. X        - added creation of system dependency header (sysdefs.h) and
  726. X          moved stuff from malloc.h that is only used for building the
  727. X          library into the new file
  728. X        - renamed temp files to prevent collisions
  729. X        - added auto-determination of X11R4/5
  730. X        - added SETENV stuff
  731. X    Makefile 
  732. X        - added new source file(s) to list of sources
  733. X        - added rules for building sysdefs.h and dependencies on it
  734. X        - moved install of malloc.h to /usr/local/debug_include because
  735. X          gcc2.1 automatically includes /usr/local in the default path
  736. X          when compiling modules
  737. X        - removed docs on setting options that configure now 
  738. X          automatically determines
  739. X    README
  740. X        - updated to reflect changes made in tests
  741. X    Runtests
  742. X        - added better checking of testmalloc output
  743. X    calloc.c 
  744. X        - hooks for X allocation routines
  745. X        - simplification of setting type/counter flags
  746. X    dump.c  
  747. X        - lint changes
  748. X        - changed to use new function name routines to get name of
  749. X          routine that allocated the segment
  750. X    free.c
  751. X        - added identification of which free function free'd segment
  752. X        - support for X allocation routines
  753. X    malloc.c
  754. X        - hooks for X allocation routines
  755. X        - simplification of setting type/counter flags
  756. X        - moved function name determination into its own fcn (so it
  757. X          could be called by dump)
  758. X    malloc.h.org
  759. X        - added protos & defs for new X allocation routines
  760. X    mallocin.h
  761. X        - extended malloc types
  762. X        - added free types
  763. X        - changed magic number to make room for free types
  764. X        - added inclusion of new system dependency header (sysdefs.h)
  765. X        - added some defs for the X stuff so we don't get compile errors
  766. X          when prototypes.h is included
  767. X    realloc.c
  768. X        - hooks for X allocation routines
  769. X    testmalloc.c
  770. X        - lint changes
  771. X        - added tests for Xt allocation hooks
  772. X    testmem.c
  773. X        - lint changes
  774. X    teststack.c
  775. X        - lint changes
  776. X    xheap.c
  777. X        - X11R5 compatibility stuff for Xt Allocation routines
  778. X    xmalloc.c
  779. X        - new source file
  780. X        - XtAlloc routines for easier debugging of X applications
  781. X    
  782. Xpatchlevel 9
  783. X    general
  784. X        - just some minor changes from testing of patch 8 on various
  785. X          system architectures
  786. X    README
  787. X        - spelling corrections
  788. X    Buildpatch
  789. X        - changed to archive old patches
  790. X    Configure
  791. X        - removed used of escape sequences (like \n) from echo cmds
  792. X        - make size_t first choice on strsize setting
  793. X    Runtests 
  794. X        - initialze environment to defaults so that the test runs in
  795. X          a known environment
  796. X    dump.c
  797. X        - require MALLOC_DETAIL to be non-zero as opposed to just being
  798. X          specified in the environment
  799. X    malloc.3
  800. X        - updated manual page to reflect changes
  801. X    malloc.c 
  802. X        - require MALLOC_SHOW_LINKS to be non-zero as opposed to just
  803. X          being specified in the environment
  804. X    mallopt.c
  805. X        - changed ERRFILE handling to allow specification of - to 
  806. X          indicate stderr output
  807. X         - added close of existing errfile if it is changed and it 
  808. X          wasn't pointing to stderr
  809. X    minipatch
  810. X        - new shell to build intermediate patches
  811. X    m_perror.c
  812. X        - spelling corrections
  813. X
  814. Xpatchlevel 8 
  815. X
  816. X    general
  817. X        - added automatic configuration (using shell script)
  818. X        - added support for different data types between the 
  819. X          various components (str*, mem*, and malloc*)
  820. X        - renamed some files so they would fit into MS-DOS namespace
  821. X          mallocint.h -> mallocin.h, malloc_chk.c -> mcheck.c
  822. X          malloc_chn.c -> mchain.c
  823. X        - fixed fill_area stuff so that it can be turned off
  824. X          and on during the execution of a program (thanks
  825. X          to Denny Page - denny@tss.com)
  826. X        - can now disable reuse of segments which makes it easier to
  827. X          track multiple frees of the same segment (idea and some of
  828. X          the code from Denny Page)
  829. X        - added code to assist in identifying duplicate frees of
  830. X          the same malloc area
  831. X        - added support for keeping track of the stack in which the
  832. X          malloc calls are made. (suggested by Paul Smith at DG)
  833. X        - added support for automatic testing and some new tests
  834. X    Configure
  835. X        - new automatic configuration script
  836. X    Makefile
  837. X        - added ranlib call after copying library (needed on some
  838. X          systems because the timestamp changes with the copy)
  839. X    Runtests
  840. X        - new automatic testing script
  841. X    free.c
  842. X        - added check for pointer alignment on the ptr passed to free
  843. X        - added logging of where pointer was freed 
  844. X    leak.c
  845. X        - added support for marking active segments so that they don't
  846. X          get counted in the leak routines
  847. X    m_perror.c 
  848. X        - fixed typo in error message
  849. X    malloc.h
  850. X        - moved real file to malloc.h.org which gets modified and
  851. X          copied to malloc.h by the automatic configuration
  852. X    malloc.c
  853. X        - added code to ensure that calls to abort either cause the
  854. X          process to abort, or, if not, then just exit.
  855. X        - added code to ensure that sbrk() returns data on M_RND
  856. X          boundary (or adjust the pointer accordingly)
  857. X    mchain.c
  858. X        - added pointer alignment checks 
  859. X    realloc.c
  860. X        - added check for pointer alignment 
  861. X    string.c
  862. X        - new functions: stricmp and strincmp (case insensitive strcmp)
  863. X    stack.c
  864. X        - new file which has the stack support functions
  865. X    testmalloc.c
  866. X        - added doubleword boundary check
  867. X    testmem.c
  868. X        - tests for new string functions
  869. X    tostring.c
  870. X        - fixed bug which resulted in empty output if value was zero
  871. X    
  872. X
  873. Xpatchlevel 7
  874. X
  875. X    - general
  876. X        - added support for overriding the use of void for systems
  877. X          that do not support it
  878. X        - added more info to the PROBLEMS and README files
  879. X    - free.c
  880. X        - added call to MALLOC_INIT to initialize the malloc subsystem
  881. X          when free is the first entry point.
  882. X    - malloc.c
  883. X        - fixed typo which resulted in truncation of error message
  884. X        - increased size of error string buffers and added
  885. X          overflow checks
  886. X    - malloc.h
  887. X        - added code so that it could be included by c++ programs
  888. X        - added additional info on setting SIZETYPE and DATATYPE
  889. X        - added code to prevent inclusions of string.h and memory.h
  890. X          after malloc.h has been included (since they conflict)
  891. X        - added prototypes for malloc_dump and malloc_list
  892. X        - added #ifdefs to get the code to compile out of the box for 
  893. X          known systems (hpux,IBMRS6000, and ISC UNIX)
  894. X    - memory.c
  895. X        - changed memccpy to only check the number of chars it is
  896. X          going to copy (some stdio implementations use memccpy with
  897. X          a source string that may not be the full length).
  898. X    - malloc.3
  899. X        - reformatted the SYNOPSIS section and cleaned up some other
  900. X          parts of the doc.
  901. X        - added more warnings about potential problems
  902. X    - Buildpatch
  903. X        - changed to build the patch based upon the old shar files,
  904. X          as opposed to the information in the RCS files
  905. X        - added verification of successful patch
  906. X    - Makefile
  907. X        - misc cleanups for making patch releases
  908. X        - removed \c escape sequence from test run script
  909. X
  910. Xpatchlevel 6
  911. X
  912. X    - README file updated with expanded porting/usage/test program info
  913. X    - PROBLEM file added to mention typical porting problems
  914. X    - CHECKSUMS file added to allow verification of proper transmission
  915. X    - NAME change - default library name changed to libdbmalloc.a so that
  916. X      it doesn't conflict with system libmalloc.a files.
  917. X    - performance enhancements 
  918. X        - selected use of registers for pointers referenced frequently
  919. X        - addition of free list chain, so allocations just search a
  920. X          list of available blocks
  921. X        - portable optimization of the malloc_memset function so that
  922. X          it is much faster when filling malloc'd areas
  923. X        - added ability to turn off pre/post-filling of malloced 
  924. X          areas via an environment variable and/or mallopt()
  925. X        - added option to override first fit algorithm with best fit
  926. X          algorithm (should reduce memory fragmentation)
  927. X    - use #if __STDC__ instead of #ifdef, so if the symbol is defined, but
  928. X      is not set to a 1, it is not interpreted as an ANSI C compiler
  929. X    - cleanup of some warnings from gcc -Wall
  930. X    - makefile changes
  931. X        - addition of manual page installation
  932. X        - added frcinstall target which forces installation
  933. X        - added DESTDIR (equivalent to INSTDIR) which defaults to
  934. X          /usr/local
  935. X        - added targets to build and run tests and removed test
  936. X          building from the all target
  937. X        - documented useful targets
  938. X        - changed to using cshar to generate shar files with MANIFEST
  939. X        - added building of CHECKSUMS file
  940. X    - manual page changes
  941. X        - minor changes to make it compatible with groff
  942. X        - fixed bug in eX macro which was causing fixed font output to
  943. X          be extremely wide
  944. X        - changed references to malloc_opt to mallopt and updated to 
  945. X          the correct usage (using the union malloptarg)
  946. X        - documented new environment variable to control fragmentation
  947. X
  948. X
  949. END_OF_FILE
  950. if test 15052 -ne `wc -c <'CHANGES'`; then
  951.     echo shar: \"'CHANGES'\" unpacked with wrong size!
  952. fi
  953. # end of 'CHANGES'
  954. fi
  955. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  956.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  957. else
  958. echo shar: Extracting \"'MANIFEST'\" \(2856 characters\)
  959. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  960. X   File Name        Archive #    Description
  961. X-----------------------------------------------------------
  962. X README                     1    READ THIS FIRST
  963. X CHANGES                    1    List of changes
  964. X MANIFEST                   1    This shipping list
  965. X CHECKSUMS                  1    Checksums (BSD and SYSV) for each file
  966. X PROBLEMS                   2    List of typical porting/use problems
  967. X Makefile                   1    
  968. X Buildpatch                 2    Shell to build patch file
  969. X Configure                  2    Automatic configuration script
  970. X Config.flags               1    Auto config compiler flags
  971. X Runtests                   2    Automatic test script
  972. X abort.c                    1    malloc_abort support
  973. X calloc.c                   3    calloc and related functions
  974. X cctest.c                   3    Module used by Configure
  975. X datamc.c                   3    Efficient, portable memcpy routine 
  976. X datams.c                   3    Efficient, portable memset routine
  977. X debug.h                    3    debugging output header
  978. X dgmalloc.c                 3    DataGeneral low level allocation functions
  979. X dump.c                     3    malloc chain dumper
  980. X fill.c                     3    Memory fill/check routines
  981. X free.c                     4    free and related functions
  982. X leak.c                     4    memory leak detection stuff
  983. X m_init.c                   4    malloclib initializations
  984. X m_perror.c                 4    malloc error printer
  985. X malign.c                   4    memory alignment routines
  986. X malloc.3                   5    malloc man page ([nt]roff source)
  987. X malloc.c                   6    malloc and related functions
  988. X malloc.h.org               4    include file for programs using the library
  989. X malloc.man                 7    nroff'd version of the manual page
  990. X mallocin.h                 5    internal header file
  991. X mallopt.c                  6    mallopt and related stuff
  992. X mchain.c                   6    chain checking modules
  993. X mcheck.c                   8    error checking modules
  994. X memory.c                   8    mem* and b* functions
  995. X minipatch                  6    shell to build intermediate patches
  996. X patchlevel                 1    current patch level
  997. X prototypes.h               8    functional prototypes 
  998. X realloc.c                  8    realloc and related functions.
  999. X size.c                     7    malloc_size module
  1000. X stack.c                    8    Stack maintenance functions
  1001. X string.c                   9    str* functions
  1002. X testerr.c                  7    error test program
  1003. X testerr.base               9    Baseline output for testerr program
  1004. X testmalloc.c               9    malloc exerciser
  1005. X testmem.c                 10    mem*/str*/b* exerciser
  1006. X teststack.c                2    malloc stack exerciser
  1007. X tostring.c                 9    numeric to string converter
  1008. X tostring.h                 3    header for numeric converter
  1009. X xheap.c                    9    Xt heap stuff (for X11R5 compatibility)
  1010. X xmalloc.c                  9    Xt allocation functions
  1011. END_OF_FILE
  1012. if test 2856 -ne `wc -c <'MANIFEST'`; then
  1013.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  1014. fi
  1015. # end of 'MANIFEST'
  1016. fi
  1017. if test -f 'CHECKSUMS' -a "${1}" != "-c" ; then 
  1018.   echo shar: Will not clobber existing file \"'CHECKSUMS'\"
  1019. else
  1020. echo shar: Extracting \"'CHECKSUMS'\" \(1967 characters\)
  1021. sed "s/^X//" >'CHECKSUMS' <<'END_OF_FILE'
  1022. XSYSV sums:
  1023. X
  1024. X4860 6 MANIFEST
  1025. X1233 1 patchlevel
  1026. X1520 41 README
  1027. X53711 26 PROBLEMS
  1028. X54481 30 CHANGES
  1029. X21929 9 Buildpatch
  1030. X28219 8 minipatch
  1031. X59392 18 Makefile
  1032. X42134 84 malloc.3
  1033. X15245 89 malloc.man
  1034. X50846 72 malloc.c
  1035. X57712 13 datamc.c
  1036. X1153 6 datams.c
  1037. X12469 6 dgmalloc.c
  1038. X18422 16 fill.c
  1039. X52545 17 free.c
  1040. X12060 23 realloc.c
  1041. X47171 10 calloc.c
  1042. X1197 41 string.c
  1043. X6948 22 mcheck.c
  1044. X22126 11 mchain.c
  1045. X62485 18 memory.c
  1046. X38290 9 tostring.c
  1047. X17850 9 m_perror.c
  1048. X50316 12 m_init.c
  1049. X22782 12 mallopt.c
  1050. X1742 22 dump.c
  1051. X22349 16 stack.c
  1052. X30747 10 xmalloc.c
  1053. X47813 8 xheap.c
  1054. X38677 11 malign.c
  1055. X6223 7 size.c
  1056. X24335 3 abort.c
  1057. X4470 12 leak.c
  1058. X36890 12 testmalloc.c
  1059. X21470 49 testmem.c
  1060. X13589 9 testerr.c
  1061. X36582 3 teststack.c
  1062. X22197 21 cctest.c
  1063. X31065 39 malloc.h.org
  1064. X14689 19 mallocin.h
  1065. X32047 7 debug.h
  1066. X25156 3 tostring.h
  1067. X34910 26 prototypes.h
  1068. X63297 59 Configure
  1069. X34953 3 Config.flags
  1070. X58055 8 Runtests
  1071. X45046 8 testerr.base
  1072. X
  1073. XBSD sums (generated using sum -r on SYSV system):
  1074. X
  1075. X19832     6 MANIFEST
  1076. X36134     1 patchlevel
  1077. X00632    41 README
  1078. X38369    26 PROBLEMS
  1079. X32596    30 CHANGES
  1080. X41824     9 Buildpatch
  1081. X49216     8 minipatch
  1082. X39340    18 Makefile
  1083. X48647    84 malloc.3
  1084. X63048    89 malloc.man
  1085. X31748    72 malloc.c
  1086. X39735    13 datamc.c
  1087. X06757     6 datams.c
  1088. X03628     6 dgmalloc.c
  1089. X54189    16 fill.c
  1090. X64699    17 free.c
  1091. X35611    23 realloc.c
  1092. X41523    10 calloc.c
  1093. X11999    41 string.c
  1094. X45665    22 mcheck.c
  1095. X37421    11 mchain.c
  1096. X35727    18 memory.c
  1097. X36790     9 tostring.c
  1098. X46171     9 m_perror.c
  1099. X29352    12 m_init.c
  1100. X08261    12 mallopt.c
  1101. X14488    22 dump.c
  1102. X14329    16 stack.c
  1103. X29660    10 xmalloc.c
  1104. X56822     8 xheap.c
  1105. X30572    11 malign.c
  1106. X29618     7 size.c
  1107. X22299     3 abort.c
  1108. X40992    12 leak.c
  1109. X08442    12 testmalloc.c
  1110. X07389    49 testmem.c
  1111. X23489     9 testerr.c
  1112. X60081     3 teststack.c
  1113. X61032    21 cctest.c
  1114. X39252    39 malloc.h.org
  1115. X62374    19 mallocin.h
  1116. X64613     7 debug.h
  1117. X22528     3 tostring.h
  1118. X40269    26 prototypes.h
  1119. X41051    59 Configure
  1120. X02132     3 Config.flags
  1121. X61218     8 Runtests
  1122. X27051     8 testerr.base
  1123. END_OF_FILE
  1124. if test 1967 -ne `wc -c <'CHECKSUMS'`; then
  1125.     echo shar: \"'CHECKSUMS'\" unpacked with wrong size!
  1126. fi
  1127. # end of 'CHECKSUMS'
  1128. fi
  1129. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  1130.   echo shar: Will not clobber existing file \"'Makefile'\"
  1131. else
  1132. echo shar: Extracting \"'Makefile'\" \(9026 characters\)
  1133. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  1134. X#
  1135. X# 
  1136. X#  (c) Copyright 1990, 1991, 1992 Conor P. Cahill (uunet!virtech!cpcahil).  
  1137. X# 
  1138. X#  This software may be distributed freely as long as the following conditions
  1139. X#  are met:
  1140. X#          * the distribution, or any derivative thereof, may not be
  1141. X#           included as part of a commercial product
  1142. X#         * full source code is provided including this copyright
  1143. X#         * there is no charge for the software itself (there may be
  1144. X#           a minimal charge for the copying or distribution effort)
  1145. X#         * this copyright notice is not modified or removed from any
  1146. X#           source file
  1147. X#
  1148. X#
  1149. X# $Id: Makefile,v 1.39 1992/08/22 16:27:13 cpcahil Exp $
  1150. X#
  1151. X# This is the Makefile for the malloc debugging library
  1152. X#
  1153. X# NOTE: while most porting changes are made here, the malloc.h file
  1154. X#       may require hand editing (mostly the DATATYPE and SIZETYPE
  1155. X#    typedefs) because of system wierdities.
  1156. X#
  1157. X# Usefull targets:
  1158. X#
  1159. X#    all        make all programs/libs in the local directory
  1160. X#    install        install updated programs/libs
  1161. X#    frcinstall    install all programs/libs
  1162. X#    tests        build tests
  1163. X#    runtests    build and run all tests
  1164. X#    clean        clean up after yourself
  1165. X#    fullclean    clean up everything (including configure stuff)
  1166. X#
  1167. X# NOTE: there are several other targets used by myself for souce code
  1168. X# maintenance related functions.  These are probably specific to my system
  1169. X# and may not do what they are supposed to do in a different environment.
  1170. X# Therefore, unless you know what you are doing, I would suggest not running
  1171. X# them (hence why they are not documented here).
  1172. X#
  1173. X# And now, onto a few definitions that you may need to alter
  1174. X#
  1175. X# The following defines may be added as necessary to the CFLAGS definition:
  1176. X#
  1177. X# -DANSI_NULLS      if you want to allow passing of NULL pointers to realloc
  1178. X#            and/or free (as ANSI does) even if the library is
  1179. X#            compiled by a non-ANSI compiler.
  1180. X# -DNO_ANSI_NULLS     if you DON'T want to allow passing of NULL pointers to
  1181. X#            realloc and/or free, even if the library is compiled by
  1182. X#            an ANSI conforming compiler.
  1183. X# -DDONT_USE_ASM    don't use ASM speedups when replacing system memcpy
  1184. X#            and/or memset routines
  1185. X# -DCTYPE_SUPPORT=x    where x is one of the following
  1186. X#
  1187. X#                1 - use plain-jane ctype.h which is only valid
  1188. X#                    for the ansii character set (DEFAULT)
  1189. X#                2 - use POSIX setlocal() to setup the character
  1190. X#                    set definitions
  1191. X#                3 - use C library islower() & toupper()
  1192. X#                    functions
  1193. X#
  1194. X# NOTE: if you add any flags other than the above to the CFLAGS, you might want
  1195. X#    to add a similar arguement in the Config.flags file.  However, you
  1196. X#     should remember that the malloc.h configuration will depend upon these
  1197. X#    settings and you could have a problem if you attempt to use the file
  1198. X#    in a compile session that doesn't include these flags.
  1199. X#
  1200. XCFLAGS=-g
  1201. X#
  1202. X# Where the code will be installed
  1203. X#
  1204. X#    DESTDIR        root for installation directory
  1205. X#    INSTDIR     installation directory
  1206. X#    LIBINSTDIR    install directory for library
  1207. X#    INCINSTDIR    install directory for include files
  1208. X#    MANINSTDIR    manual installation directory
  1209. X#    MANINSTNAME    name to install the manual as
  1210. X#    MANINSTVER    manual install version (use malloc.3 for troff/nroff
  1211. X#            source and malloc.man for pre-formatted)
  1212. X#
  1213. XDESTDIR=
  1214. XINSTDIR=$(DESTDIR)/usr/local
  1215. XLIBINSTDIR=$(INSTDIR)/lib
  1216. XINCINSTDIR=$(INSTDIR)/debug_include
  1217. XMANINSTDIR=$(INSTDIR)/man/man3
  1218. XRANLIB=/usr/local/bin/ranlib
  1219. XMANINSTNAME=dbmalloc.3
  1220. XMANINSTVER=malloc.3
  1221. X
  1222. X#
  1223. X# miscellaneous commands
  1224. X#
  1225. X# NOTE: if you change CC to a non-K&R compiler be sure to read the 
  1226. X#       PROBLEMS file first.
  1227. X#
  1228. XCC=cc
  1229. XCPROTO=/usr/local/bin/cproto
  1230. XLINT=lint
  1231. XNROFF=nroff
  1232. XSHARCMD=makekit -p -m -nmallocshar.
  1233. XSHELL=/bin/sh
  1234. X
  1235. XLIB=libdbmalloc.a
  1236. XLINTLIB=llib-ldbmal.ln
  1237. X
  1238. X#
  1239. X# You shouldn't have to modify anything below this line
  1240. X#
  1241. XLIBSRCS=    malloc.c    \
  1242. X        datamc.c    \
  1243. X        datams.c    \
  1244. X        dgmalloc.c    \
  1245. X        fill.c        \
  1246. X        free.c        \
  1247. X        realloc.c    \
  1248. X        calloc.c    \
  1249. X        string.c    \
  1250. X        mcheck.c    \
  1251. X        mchain.c    \
  1252. X        memory.c    \
  1253. X        tostring.c    \
  1254. X        m_perror.c    \
  1255. X        m_init.c    \
  1256. X        mallopt.c    \
  1257. X        dump.c         \
  1258. X        stack.c        \
  1259. X        xmalloc.c    \
  1260. X        xheap.c        \
  1261. X        malign.c    \
  1262. X        size.c        \
  1263. X        abort.c        \
  1264. X        leak.c    
  1265. X
  1266. XLIBOBJS=    malloc.o    \
  1267. X        datamc.o    \
  1268. X        datams.o    \
  1269. X        dgmalloc.o    \
  1270. X        fill.o        \
  1271. X        free.o        \
  1272. X        realloc.o    \
  1273. X        calloc.o    \
  1274. X        string.o    \
  1275. X        mcheck.o    \
  1276. X        mchain.o    \
  1277. X        memory.o    \
  1278. X        tostring.o    \
  1279. X        m_perror.o    \
  1280. X        m_init.o    \
  1281. X        mallopt.o    \
  1282. X        dump.o         \
  1283. X        stack.o        \
  1284. X        xmalloc.o    \
  1285. X        xheap.o        \
  1286. X        malign.o    \
  1287. X        size.o        \
  1288. X        abort.o        \
  1289. X        leak.o    
  1290. X
  1291. XSRCS=$(LIBSRCS) testmalloc.c testmem.c testerr.c teststack.c cctest.c
  1292. XHDRS= malloc.h.org mallocin.h debug.h tostring.h
  1293. X
  1294. XBUILDFILES=malloc.man prototypes.h 
  1295. X
  1296. XMANSRCFILES=patchlevel README PROBLEMS CHANGES Buildpatch minipatch Makefile \
  1297. X    malloc.3 malloc.man $(SRCS) $(HDRS) prototypes.h \
  1298. X    Configure Config.flags Runtests testerr.base
  1299. XSRCFILES=MANIFEST $(MANSRCFILES)
  1300. X
  1301. XTESTS=testmalloc testmem testerr teststack
  1302. X
  1303. Xall:    $(LIB)
  1304. X
  1305. Xinstall: $(LIBINSTDIR)/$(LIB) $(INCINSTDIR)/malloc.h \
  1306. X    $(MANINSTDIR)/$(MANINSTNAME)
  1307. X
  1308. Xfrcinstall: rminstall install
  1309. X
  1310. Xrminstall:
  1311. X    rm -f $(LIBINSTDIR)/$(LIB) $(INCINSTDIR)/malloc.h \
  1312. X    $(MANINSTDIR)/$(MANINSTNAME)
  1313. X
  1314. X$(LIBINSTDIR)/$(LIB): $(LIB)
  1315. X    -rm -f $@.old
  1316. X    -mv -f $@ $@.old
  1317. X    cp $? $@
  1318. X    @-if test -s $(RANLIB); then $(RANLIB) $@; \
  1319. X         else if test -s /bin/ranlib; then /bin/ranlib $@; \
  1320. X     else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $@; \
  1321. X     else exit 0; fi; fi; fi
  1322. X    -chmod 644 $@
  1323. X    -rm -f $@.old
  1324. X
  1325. X$(INCINSTDIR)/malloc.h: malloc.h
  1326. X    -rm -f $@.old
  1327. X    -mv -f $@ $@.old
  1328. X    cp $? $@
  1329. X    -chmod 644 $@
  1330. X    -rm -f $@.old
  1331. X    
  1332. X$(MANINSTDIR)/$(MANINSTNAME): $(MANINSTVER)
  1333. X    -rm -f $@.old
  1334. X    -mv -f $@ $@.old
  1335. X    cp $? $@
  1336. X    -chmod 644 $@
  1337. X    -rm -f $@.old
  1338. X
  1339. Xtests:    $(TESTS)
  1340. X
  1341. X#
  1342. X# runtests - target for building and running the tests.  Note that we 
  1343. X# run testmalloc with fill_area disabled.  This is because testmalloc is
  1344. X# a malloc exerciser and we just want to see if we broke malloc, not verify
  1345. X# that the test doesn't overwrite memory (since it doesn't).
  1346. X#
  1347. Xruntests: tests
  1348. X    @echo "Running all of the test programs.  This may take a while so"
  1349. X    @echo "please be patient.  Note that you won't see any output unless"
  1350. X    @echo "a test fails....."
  1351. X    ./Runtests
  1352. X
  1353. Xclean:  
  1354. X    rm -f $(TESTS) pgm cctest $(LIB) *.o *.ln Runtests.out malloc.h \
  1355. X        sysdefs.h
  1356. X
  1357. Xfullclean: clean
  1358. X    rm -f .configure .configure.[sO] *.O core cscope.out tags
  1359. X
  1360. Xsharfile: $(SRCFILES) CHECKSUMS
  1361. X    $(SHARCMD)
  1362. X
  1363. XCHECKSUMS: $(SRCFILES)
  1364. X    echo "SYSV sums:\n" > CHECKSUMS
  1365. X    sum $(SRCFILES) >> CHECKSUMS
  1366. X    echo "\nBSD sums (generated using sum -r on SYSV system):\n" >>CHECKSUMS
  1367. X    sum -r $(SRCFILES) >> CHECKSUMS
  1368. X
  1369. XMANIFEST: $(MANSRCFILES)    
  1370. X    $(SHARCMD) -x
  1371. X    chmod -w MANIFEST
  1372. X    
  1373. X$(LIB): $(LIBOBJS)
  1374. X    ar ru $(LIB) $(LIBOBJS)
  1375. X    @-if test -s $(RANLIB); then $(RANLIB) $@; \
  1376. X         else if test -s /bin/ranlib; then /bin/ranlib $@; \
  1377. X     else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $@; \
  1378. X     else exit 0; fi; fi; fi
  1379. X
  1380. X$(LINTLIB): $(LIBSRCS)
  1381. X    $(LINT) -x -v -o dbmal $(LIBSRCS)
  1382. X
  1383. Xmalloc.h: malloc.h.org Configure
  1384. X    ./Configure 
  1385. X
  1386. Xsysdefs.h: Configure
  1387. X    ./Configure 
  1388. X
  1389. X#
  1390. X# stuff for building the nroffed version of the manual page
  1391. X#
  1392. Xman:    malloc.man
  1393. X
  1394. Xmalloc.man: malloc.3
  1395. X    rm -f malloc.man
  1396. X    $(NROFF) -man malloc.3 | col -b > malloc.man
  1397. X
  1398. X#
  1399. X# stuff for building the test programs
  1400. X#
  1401. Xtestmalloc:    $(LIB) testmalloc.o
  1402. X    $(CC) $(CFLAGS) -o $@ testmalloc.o $(LIB)
  1403. X
  1404. Xtestmem:    $(LIB) testmem.o
  1405. X    $(CC) $(CFLAGS) -o $@ testmem.o $(LIB)
  1406. X
  1407. Xteststack:    $(LIB) teststack.o
  1408. X    $(CC) $(CFLAGS) -o $@ teststack.o $(LIB)
  1409. X
  1410. Xtesterr:    $(LIB) testerr.o
  1411. X    $(CC) $(CFLAGS) -o $@ testerr.o $(LIB)
  1412. X
  1413. X#
  1414. X# misc stuff for source code maintenance
  1415. X#
  1416. Xlint:    
  1417. X    $(LINT) $(CFLAGS) $(SRCS)
  1418. X
  1419. Xproto:
  1420. X    rm -f prototypes.h
  1421. X    make prototypes.h
  1422. X
  1423. Xprototypes.h: $(LIBSRCS) $(HDRS) malloc.h
  1424. X    @if [ ! -s $(CPROTO) ]; then \
  1425. X        echo "Need cproto to rebuild prototypes file";\
  1426. X        exit 1; \
  1427. X    else \
  1428. X        exit 0; \
  1429. X    fi
  1430. X    -rm -f prototypes.h
  1431. X    cp /dev/null prototypes.h
  1432. X    $(CPROTO) -Dforce_cproto_to_use_defines -D__STDC__ \
  1433. X         -DDONT_USE_ASM -m__stdcargs -f4 $(LIBSRCS) \
  1434. X         | sed -e "s/const/CONST/g" > prototypes.new
  1435. X    mv prototypes.new prototypes.h
  1436. X    chmod -w prototypes.h
  1437. X    
  1438. Xpatch: $(SRCFILES)
  1439. X    sh Buildpatch $(SRCFILES)
  1440. X
  1441. Xsrclist:
  1442. X    @echo $(SRCFILES)
  1443. X
  1444. Xrcsclean: $(BUILDFILES)
  1445. X    -rcsclean -q $(SRCFILES)
  1446. X    -ls $(SRCFILES) 2>/dev/null > files.list
  1447. X    -rcs -i -t/dev/null `cat files.list` 2>/dev/null
  1448. X    @set -e; \
  1449. X    echo "files to be checked in: `cat files.list`"; \
  1450. X    echo "\n\tMessage: \c"; \
  1451. X    read message; \
  1452. X    echo ""; \
  1453. X    rcs -q -l `cat files.list`; \
  1454. X    ci -m"$$message" `cat files.list`; \
  1455. X    co -u $(SRCFILES)
  1456. X
  1457. X#
  1458. X# special rules for building datams.o and datamc.o
  1459. X#
  1460. Xdatams.o: datams.c malloc.h mallocin.h sysdefs.h
  1461. X    @rm -f datams.o; \
  1462. X    if [ -s datams.O ]; then \
  1463. X        echo "        cp datams.O $@"; \
  1464. X        cp datams.O $@; \
  1465. X    else \
  1466. X        echo "        $(CC) $(CFLAGS) -c datams.c"; \
  1467. X        $(CC) $(CFLAGS) -c datams.c; \
  1468. X    fi
  1469. X
  1470. Xdatamc.o: datamc.c malloc.h mallocin.h sysdefs.h
  1471. X    @rm -f datamc.o; \
  1472. X    if [ -s datamc.O ]; then \
  1473. X        echo "        cp datamc.O $@"; \
  1474. X        cp datamc.O $@; \
  1475. X    else \
  1476. X        echo "        $(CC) $(CFLAGS) -c datamc.c"; \
  1477. X        $(CC) $(CFLAGS) -c datamc.c; \
  1478. X    fi
  1479. X
  1480. X#
  1481. X# include file dependencies
  1482. X#
  1483. X$(LIBOBJS):    malloc.h mallocin.h sysdefs.h
  1484. X
  1485. Xtesterr.o testmalloc.o testmem.o:    malloc.h sysdefs.h
  1486. X
  1487. Xtostring.o malloc.o dump.o:    tostring.h sysdefs.h
  1488. END_OF_FILE
  1489. if test 9026 -ne `wc -c <'Makefile'`; then
  1490.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1491. fi
  1492. # end of 'Makefile'
  1493. fi
  1494. if test -f 'Config.flags' -a "${1}" != "-c" ; then 
  1495.   echo shar: Will not clobber existing file \"'Config.flags'\"
  1496. else
  1497. echo shar: Extracting \"'Config.flags'\" \(1175 characters\)
  1498. sed "s/^X//" >'Config.flags' <<'END_OF_FILE'
  1499. X#!/bin/sh
  1500. X#
  1501. X#
  1502. X# (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1503. X#
  1504. X# This software may be distributed freely as long as the following conditions
  1505. X# are met:
  1506. X#         * the distribution, or any derivative thereof, may not be
  1507. X#          included as part of a commercial product
  1508. X#        * full source code is provided including this copyright
  1509. X#        * there is no charge for the software itself (there may be
  1510. X#          a minimal charge for the copying or distribution effort)
  1511. X#        * this copyright notice is not modified or removed from any
  1512. X#          source file
  1513. X#
  1514. X# $Id: Config.flags,v 1.3 1992/08/22 16:27:13 cpcahil Exp $
  1515. X#
  1516. X# This file is used by the configure script to determine the flags that should
  1517. X# be specified for each compiler as the configuration is determined.  The
  1518. X# compiler *MUST* start in column one and the flags must be on the same line
  1519. X#
  1520. X# For example, if you wanted to add -pedantic to gcc (although this would
  1521. X# probably cause the configure to fail because it is so restrictive) you
  1522. X# would add the following line:
  1523. X#
  1524. X#     gcc -pedantic
  1525. X#
  1526. X# Note that the g in gcc would be in column 1
  1527. X#
  1528. X# By default, the compilers use no flags and therefore are not specified here
  1529. X#
  1530. END_OF_FILE
  1531. if test 1175 -ne `wc -c <'Config.flags'`; then
  1532.     echo shar: \"'Config.flags'\" unpacked with wrong size!
  1533. fi
  1534. # end of 'Config.flags'
  1535. fi
  1536. if test -f 'abort.c' -a "${1}" != "-c" ; then 
  1537.   echo shar: Will not clobber existing file \"'abort.c'\"
  1538. else
  1539. echo shar: Extracting \"'abort.c'\" \(1094 characters\)
  1540. sed "s/^X//" >'abort.c' <<'END_OF_FILE'
  1541. X/*
  1542. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1543. X *
  1544. X * This software may be distributed freely as long as the following conditions
  1545. X * are met:
  1546. X *         * the distribution, or any derivative thereof, may not be
  1547. X *          included as part of a commercial product
  1548. X *        * full source code is provided including this copyright
  1549. X *        * there is no charge for the software itself (there may be
  1550. X *          a minimal charge for the copying or distribution effort)
  1551. X *        * this copyright notice is not modified or removed from any
  1552. X *          source file
  1553. X */
  1554. X#include <stdio.h>
  1555. X#include "mallocin.h"
  1556. X#include "debug.h"
  1557. X
  1558. X/*
  1559. X * Function:    malloc_abort()
  1560. X *
  1561. X * Purpose:    abort routine which cause a core dump.  This routine is 
  1562. X *        put here so that the user can override it with thier own
  1563. X *        abort routine. 
  1564. X *
  1565. X * Arguments:    none
  1566. X *
  1567. X * Returns:    nothing of any value
  1568. X *
  1569. X * Narrative:
  1570. X *        call abort routine to cause core dump
  1571. X */
  1572. X#ifndef lint
  1573. Xstatic
  1574. Xchar rcs_hdr[] = "$Id: abort.c,v 1.2 1992/08/22 16:27:13 cpcahil Exp $";
  1575. X#endif
  1576. X
  1577. XVOIDTYPE
  1578. Xmalloc_abort()
  1579. X{
  1580. X
  1581. X    VOIDCAST abort();
  1582. X
  1583. X} /* malloc_abort(... */
  1584. END_OF_FILE
  1585. if test 1094 -ne `wc -c <'abort.c'`; then
  1586.     echo shar: \"'abort.c'\" unpacked with wrong size!
  1587. fi
  1588. # end of 'abort.c'
  1589. fi
  1590. if test -f 'patchlevel' -a "${1}" != "-c" ; then 
  1591.   echo shar: Will not clobber existing file \"'patchlevel'\"
  1592. else
  1593. echo shar: Extracting \"'patchlevel'\" \(15 characters\)
  1594. sed "s/^X//" >'patchlevel' <<'END_OF_FILE'
  1595. XPatchlevel: 14
  1596. END_OF_FILE
  1597. if test 15 -ne `wc -c <'patchlevel'`; then
  1598.     echo shar: \"'patchlevel'\" unpacked with wrong size!
  1599. fi
  1600. # end of 'patchlevel'
  1601. fi
  1602. echo shar: End of archive 1 \(of 10\).
  1603. cp /dev/null ark1isdone
  1604. MISSING=""
  1605. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1606.     if test ! -f ark${I}isdone ; then
  1607.     MISSING="${MISSING} ${I}"
  1608.     fi
  1609. done
  1610. if test "${MISSING}" = "" ; then
  1611.     echo You have unpacked all 10 archives.
  1612.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1613. else
  1614.     echo You still need to unpack the following archives:
  1615.     echo "        " ${MISSING}
  1616. fi
  1617. ##  End of shell archive.
  1618. exit 0
  1619. *** SENTINEL(tm) The ultimate Debugging Environment - email for more info ***
  1620.  
  1621. Conor P. Cahill              (703)430-9247            cpcahil@virtech.vti.com
  1622. Virtual Technologies, Inc.  46030 Manekin Plaza          Dulles, VA 21066 
  1623.  
  1624. exit 0 # Just in case...
  1625.