home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11770 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  11.6 KB

  1. Xref: sparky comp.os.msdos.programmer:11770 comp.lang.c:19160 alt.msdos.programmer:3079
  2. Path: sparky!uunet!stanford.edu!rutgers!cmcl2!panix!bergman
  3. From: bergman@panix.com (Mark Bergman)
  4. Newsgroups: comp.os.msdos.programmer,comp.lang.c,alt.msdos.programmer
  5. Subject: C Memory Debuggers (SUMMARY)
  6. Message-ID: <C0B10F.A2H@panix.com>
  7. Date: 4 Jan 93 00:50:39 GMT
  8. Organization: Panix Public Access Internet & Unix, NYC
  9. Lines: 252
  10.  
  11. Sorry for the long delay, but here is a summary of responses
  12. I got from my request for information on DOS C source memory
  13. debuggers. Any additions are welcome, and all E-mail will
  14. get a response.
  15.  
  16. Many thanks to those who responded:
  17.  
  18.     FFAAC01%BLEKUL11.BITNET@pucc.Princeton.EDU
  19.     John.Larson@f824.n107.z1.ieee.org (John Larson)
  20.     Levin F Magruder <cmcl2!world.std.com!levin>
  21.     Rick Huff <cmcl2!billnext.tamu.edu!rick>
  22.     bryan@stiatl.salestech.com (Bryan Donaldson)
  23.     chris.lincoln%travel@wugate.wustl.edu (Chris Lincoln)
  24.     draper@ais.org (Patrick Draper)
  25.     freeman@gradient.cis.upenn.edu (Jon Freeman)
  26.     gap@TRICERATOPS.SOAR.CS.CMU.EDU
  27.     ilic@utkux1.utk.edu
  28.     janos%novdpd@novell.com (Janos Haide)
  29.     mikey@ontek.com (euphausia superba)
  30.     schunix!sonix@transfer.stratus.com (Duane Morin)
  31.     scs@adam.mit.edu (Steve Summit)
  32.     smclewin@ultrix.ramapo.edu (Scott M McLewin)
  33.  
  34.  
  35. ==> Date: Tue, 8 Sep 92 12:06 EDT
  36. ==> From: cmcl2!transfer.stratus.com!schunix!sonix (Duane Morin)
  37. ==> Organization: SCHUNIX Public Access Unix for Worcester County, Massachusetts, USA
  38. ==> 
  39. ==> 
  40. ==> Memcheck is an actual C library that you #include and link in to the code
  41. ==> that you want to check.  It's THIS program that defaults to only measuring 
  42. ==> alloc'd memory, expecting you to explicitly mention arrays and things of 
  43. ==> that sort.  Again, I had little luck with this one because, since it does
  44. ==> run within your program (as compared to a BC or a SoftIce), using it means
  45. ==> changing the addresses within your program, therefore possibly negating 
  46. ==> statements that were causing errors.  Many times, I'd have a NULL pointer 
  47. ==> running around that would cause my program to crash.  I'd link in memcheck,
  48. ==> only to discover that the shifting around of memory had caused the error to 
  49. ==> show up in a different place, or perhaps not at all.
  50. ==> 
  51. ==> BoundsChecker - Disappointing.
  52. ==> BoundsChecker runs on top of your program and checks for places where,
  53. ==> of course, bounds have been overwritten.  Examples of this would include:
  54. ==> executing code out of your program space (i.e. jumping into your data segment),
  55. ==> writing into your code space, or trying to access normally unreadable 
  56. ==> memory (such as Video memory, or certain BIOS variables or interrupt tables).  
  57. ==> My problem with it is that, as they say in a little addition to the manual,
  58. ==> certain compilers (such as Borland C++) DO overwrite code segments or call
  59. ==> supposedly bad memory areas, and are perfectly legitimate in doing so.  Thus,
  60. ==> when boundschecker pops up with a screen full of assembly language pointing
  61. ==> to a " rep movsb "  at location 0Af3:0002, you are expected to determine 
  62. ==> whether or not this is your fault, or the compiler just doing something that's
  63. ==> perfectly legal.  Basically, I spent most of my time using it by telling it
  64. ==> to "ignore" every bounds error that it caught.  So, basically, it told me
  65. ==> little to nothing about my errors.
  66. ==> 
  67. ==> Soft Ice - From the same people, but surprisingly worlds better.  You have 
  68. ==> to have a certain affinity for assembly language, because this is it's 
  69. ==> natural mode.  But we've used it with our c++ code (always interesting to 
  70. ==> see how that stuff compiles!) and found NUMEROUS memory errors.  For example:
  71. ==> 
  72. ==> Soft Ice crashes with an "invalid instruction" at point X.  You see, however,
  73. ==> that point X is well within your code space.  Hmm.  Resetting the program, 
  74. ==> you look at that address BEFORE you run the program.  It's not illegal, it's
  75. ==> ok.  Hmm again.  Set a "break whenever someone writes to this address" 
  76. ==> breakpoint and run it.  Bang.  Stops dead in its tracks at point y.  Switch
  77. ==> to source mode, and it's stopped right on a strcpy or something like that.  
  78. ==> You look at your addresses, and see that you've overwritten a boundary.  
  79. ==> 
  80. ==> 
  81. ==> Duane
  82. ==> 
  83. ==> Hope it helps,
  84. ==>  Duane Morin
  85. ==>  Software Development Manager 
  86. ==>  Walker Sonix
  87. ==>  Worcester, MA 01604
  88. ==> 
  89. ==> 
  90. ==> Date: Tue, 8 Sep 1992 12:28:48 -0400
  91. ==> From: cmcl2!world.std.com!levin (Levin F Magruder)
  92. ==> To: bergman@panix.com
  93. ==> Organization: The World Public Access UNIX, Brookline, MA
  94. ==> 
  95. ==> I got a simple to use two-filer from the Dr. Dobbs Journal place
  96. ==> on compuserve.  It just tracks calls to malloc, alloc, strdup,
  97. ==> realloc and free, and creates a log file.  It works.
  98. ==> 
  99. ==> 
  100. ==> From: cmcl2!TRICERATOPS.SOAR.CS.CMU.EDU!gap
  101. ==> To: Mark Bergman <bergman@panix.com>
  102. ==> Date: Tue, 8 Sep 92 15:57:34 EDT
  103. ==> 
  104. ==> I have a memory allocation package that runs somewhat slowly but 
  105. ==> finds every instance of memory problems that I have ever needed. It
  106. ==> is written in ANSI C. You can ftp it if you want. It handles
  107. ==> the following problems:
  108. ==> 
  109. ==>     Memory overwrites (at least sequential memory overwrites)
  110. ==>           at time memory is freed.
  111. ==>     Freeing memory not allocated or freeing memory twice.
  112. ==>     Not Freeing memory.
  113. ==>     Using information in an already Freed memory block.
  114. ==> 
  115. ==> It normally reports the infraction, along with the file name
  116. ==> and address of the call that allocated the memory block.
  117. ==> 
  118. ==> If you would like to ftp it then I need to set up the FTP
  119. ==> directory and so forth. However, I would be willing to do
  120. ==> so.
  121. ==> 
  122. ==> Gary
  123. ==> 
  124. ==> From uupsi3!@martha.utcc.utk.edu:ilic@utkux1.utk.edu Wed Sep  9 00:18 EDT 1992
  125. ==> Date: Tue, 8 Sep 92 23:57:46 -0400
  126. ==> From: cmcl2!utkux1.utk.edu!ilic
  127. ==> To: bergman@panix.com (Mark Bergman)
  128. ==> 
  129. ==> if your code is portable you might try memfence.c.  It is PD but it 
  130. ==> runs under almost  anything but DOS.  It catches all bad pointers by 
  131. ==> [                           ^^^^^^^  ]
  132. ==> using sbrk() and setting protected memory pages right after and before your 
  133. ==> arrays.  It is good. 
  134. ==> 
  135. ==> ilic@hickory.engr.utk.edu
  136. ==> 
  137. ==> Date: Wed, 9 Sep 92 21:03 EDT
  138. ==> From: cmcl2!ais.org!draper (Patrick Draper)
  139. ==> 
  140. ==> I've used Bounds checker, and it's a disaster, because our application
  141. ==> doesn't cause the memory exceptions. The errors occur somewhere inside a
  142. ==> third party library, usually.
  143. ==> 
  144. ==> Also, Memcheck is also a disaster, because it doesn't check errors that I
  145. ==> tend to make. It *will* do checking on function calls, but if you assign a
  146. ==> pointer or copy memory outside a function, you can still bypass that. It's
  147. ==> also expensive for what it does. I might pay 50 bucks for it, but not 129.
  148. ==> 
  149. ==> 
  150. ==> Date: Wed, 9 Sep 92 22:23:28 EDT
  151. ==> From: Levin F Magruder <cmcl2!world.std.com!levin>
  152. ==> 
  153. ==> Here is the malloc debugging stuff from DDJ.  
  154. ==> 
  155. ==> [ File Deleted ]
  156. ==> 
  157. ==> [ I tried the enclosed debugging aids, but with little success. I'm
  158. ==> looking for something a little more turn-key, enve if that means $$ ]
  159. ==> 
  160. ==> Date: Sun, 27 Sep 92 00:14:14 -0400
  161. ==> From: cmcl2!ultrix.ramapo.edu!smclewin (Scott M McLewin)
  162. ==> 
  163. ==> My company uses Super Malloc in one of thier applications.  It is not a 
  164. ==> memory checker, but a sort of replacement for the malloc/free functions
  165. ==> in C.  It provides better memory management to avoid fragmentation, but
  166. ==> does not give reports on misuse of pointers, etc.  The product is 
  167. ==> simply an .OBJ file to link into your project, and the manual is 
  168. ==> pretty small ( under 10 pages).  I recommend it if your DOS app 
  169. ==> allocates and frees lots of little blocks.
  170. ==> 
  171. ==> I am presently beta tesing (gamma now) Bounds-Checker.  Their version
  172. ==> 2 is simply AWESOME!  If you write in C under DOS, I strongly urge you
  173. ==> to use it.  It watches for writes past arrays (local, global, heap),
  174. ==> writes to your code, jumps out of your code space, reports on 
  175. ==> memory leakage, warns you if you use a free'd pointer.  It will even
  176. ==> do all this on a TSR....  I am quite impressed by it.   
  177. ==> 
  178. ==> In a month or so I will be beta testing soft-ice, their DOS debugger.
  179. ==> I used their version 2.5 breifly and found it quite powerful.  Even
  180. ==> when the program was hung solid Soft-Ice was still able to activate
  181. ==> and see what happened.  Soft-Ice and the new Bound-Checker together
  182. ==> will be heaven.
  183. ==> 
  184. ==> Scott M McLewin
  185. ==> 
  186. ==> Date: Mon, 28 Sep 92 08:14:38 -0500
  187. ==> From: Rick Huff <cmcl2!billnext.tamu.edu!rick>
  188. ==> 
  189. ==> >     Bounds-Checker    Nu-Mega Technologies, Inc.
  190. ==> 
  191. ==> I used this product two years ago before I got into doing Windows  
  192. ==> development.  It is great!  It works well do find bugs that you know  
  193. ==> about, but it is also very useful to leave the hooks in while you are  
  194. ==> doing in-house testing to find bugs that you didn't know about.  
  195. ==> 
  196. ==> 
  197. ==> I hope that this helps.
  198. ==> --
  199. ==> Rick Huff, Systems Analyst (409) 845-8454 (rick@billnext.tamu.edu)
  200. ==> CSC, Computing Account Services, Texas A&M University
  201. ==> 
  202. ==> Date: Mon, 28 Sep 92 12:05:08 GMT
  203. ==> From: bryan@stiatl.salestech.com (Bryan Donaldson)
  204. ==> 
  205. ==> About BoundsChecker from NuMega,  the last time I heard from them this product 
  206. ==> did not check dynamically allocated memory.  BoundsChecker is a Device-Driver/
  207. ==> TSR-type program which loads at boot up.  When a program is loaded using
  208. ==> its special command, it will check that your code doesn't get overwritten and
  209. ==> that local variables and static variables are not overwritten.
  210. ==> 
  211. ==> So the bootom line is, check with NuMega again about this.  By the way, I have
  212. ==> version 1.11.
  213. ==> 
  214. ==> Bryan Donaldson
  215. ==> 
  216. ==> From: cmcl2!wugate.wustl.edu!chris.lincoln%travel (Chris Lincoln)
  217. ==> Date: Sun, 27 Sep 92 11:37:00 -0500
  218. ==> Organization: Travel Online, St. Louis, MO
  219. ==> 
  220. ==>            Bounds-Checker  Nu-Mega Technologies, Inc.
  221. ==>            ^^^^^^^^^^^^^^  I've got 1.0.  2.0 now handles scads more
  222. ==>                            exceptions, like the normal heap errors.  It
  223. ==>                            also catches overwrites by library routines.
  224. ==>                            I would definately buy BC again.  Excellent
  225. ==>                            product.
  226. ==> 
  227. ==> Chris Lincoln
  228. ==> 
  229. ==> chris.lincoln@travel.com
  230. ==> 
  231. ==> From: cmcl2!adam.mit.edu!scs (Steve Summit)
  232. ==> 
  233. ==> I have written such a dbmalloc library (not the one you've heard
  234. ==> about).  It should be quite portable; I've used it under Unix
  235. ==> (several machines, several compilers) and MS-DOS (Microsoft C).
  236. ==> Write back if you're interested in a copy.
  237. ==> 
  238. ==>                     Steve Summit
  239. ==>                     scs@adam.mit.edu
  240. ==> 
  241. ==> Date: Sun, 27 Sep 92 12:31:44 EST
  242. ==> From: cmcl2!f824.n107.z1.fidonet.org!John.Larson (John Larson)
  243. ==> 
  244. ==> Multiscope Debuggers for Dos or Windows are both excellent debuggers which run
  245. ==> under Windows or as a Character Mode dos application.  These guys offer a post
  246. ==> mortem debugger and C library called MED which allow you to create CORE DUMP
  247. ==> files which can then be loaded into the debugger to show you the state of the
  248. ==> program at the time of the crash. You can view this PostMortem dump in context
  249. ==> of the source code just as if you were running the debugger during the
  250. ==> development phase.  The MED facility can be used with or without adding
  251. ==> special code to your program.  However, with the use of the associated
  252. ==> libraries you can do things like force a dump during runtime when ever you
  253. ==> feel it may be necessary.
  254. ==> 
  255. ==>  John Larson - Internet: John.Larson@f824.n107.z1.ieee.org
  256. ==> 
  257. ----
  258. Mark Bergman    (Biker, Stagehand, (former) Unix user support grunt)
  259. 718-855-9148
  260.  
  261. bergman@panix.com
  262. {cmcl2,uunet}!panix!bergman
  263.