home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / dbmalloc / part01 < prev    next >
Encoding:
Text File  |  1992-09-03  |  56.7 KB  |  1,619 lines

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