Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!apple!motcsd!mcdcup!mcdchg!tellab5!mtcchi!thj From: thj@mtcchi.uucp (XT0221000-Tom Hjellming(ZG90210)0000) Newsgroups: comp.os.msdos.programmer Subject: Re: NULL pointer error Keywords: Null dos error Message-ID: <1990Jul16.145157.4105@mtcchi.uucp> Date: 16 Jul 90 14:51:57 GMT References: <2008@bnlux0.bnl.gov> Organization: Memorex Telex Corporation NSBG/STP Lines: 37 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