thj@mtcchi.uucp (XT0221000-Tom Hjellming(ZG90210)0000) (07/16/90)
reilly@bnlux0.bnl.gov (kevin reilly) writes: >After exiting my program DOS writes an error to the screen >NULL pointer error R6001 >I understand the meaning of the error message but how do I go about >debugging the program to find what is causing it. >From reading the documentation from MicroSoft (QC2.5) the program will >compile and link error free. But when run and then exited that is when >the error will appear. >The program ran error free up until I linked in the menu.obj file that >came with the compiler. >I guess the question is: What memory address do I watch when stepping >through the program? >Thank you in advance! >reilly@bnlux0.bnl.gov If you have codeview or some other debugger that supports watchpoints, set it to break when someone overwrites the first 4 or so bytes of the data segment (ds:0). Microsoft uses this area as the NULL segment. When a program terminates, the exit code will check to see if this area has been modified. I think the NULL segment is 16 bytes long, but you can probably get away with just watching the first 4 bytes. Hope this helps. Tom Hjellming Software Consultant Analysts International Corp. (AiC) Schaumburg, IL ...!uunet!tellab5!mtcchi!thj -- Tom Hjellming Software Consultant Analysts International Corp. (AiC) Schaumburg, IL
miket@mars.cs.umbc.edu (Mike Taube) (07/19/90)
In article <319@taumet.com> steve@taumet.com (Stephen Clamage) writes: >weisen@eniac.seas.upenn.edu (Neil Weisenfeld) writes: >>If the program is attempting to write to a NULL pointer, you could >>try watching address 0x0000:0x0000 as this is where the "NULL" pointer >>points. > >Sadly, it's not this simple. The NULL pointer error is reported for >a range about about 128 bytes starting at data address zero. In a small >data model program, this is not 0x0000:0x0000, but addresses DS:0x0000 - >DS:0x007F. I don't believe this error can be reliably reported for >other-model programs, since there is no place to put the checksummed data >for comparison at program exit. >-- > >Steve Clamage, TauMetric Corp, steve@taumet.com You may try this, though... initialize a pointer to char to be NULL then in a loop, use putchar(*ptr) for about 20 chars or so this will print out Microsoft's copyright message that they always put at the NULL memory location. It doesn't work ALL the time, but when it does it's a lifesaver by the way... don't DON'T use printf.. it doesn't work Mike Taube MikeT@cs.umbc.edu miket@umbc2.bitnet ...uunet!umbc3!miket