From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: debugger and exception, help needed Date: Sun, 11 Jan 1998 16:17:44 -0500 Organization: Two pounds of chaos and a pinch of salt. Lines: 51 Message-ID: <34B936F8.162F@cs.com> References: <69atvo$4c9$1 AT kadri DOT ut DOT ee> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp206.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Olavi Hytt wrote: > > I'm stuck with one program and I don't know what the hell is going on. When > I was creating function A, function B has gone mad. They both don't even use > same data and don't have common variables. It seems to me like some memory > corruption, coz function does forget variable value, and writes strange > symbols to file. And then all functions start making strange things. > I don't use pointers unless some c function needs a pointer for parameter. > And I don't allocate/free memory in my program. > I tryed a debugger too, and after running the program some times it says: > exception 14, error code 0x4. This is of course very much info, but there > was no button on my keyboard to print the explanation of this error. Could > someone say, which files in djgpp 150 megs dos archive are explanations of > exception 14 and error code 0x4? > Strange is too, that this error happens randomly and not after every program > run. Please give more details, as this explanation isn't enough for us to tell you what is wrong. First, try to resolve the erroneous code down to a small, compilable fragment that exhibits the error(s). Then post this code, along with an _exact_ copy of the error(s) you received. Best would be a stack traceback processed with 'symify'. (You do get a traceback when the program crashes, right? If not, this is something you should tell us.) In the absence of specific details, I can give you some tips. If one function seems to be corrupting the data in another unrelated function, and neither function allocates memory or writes to pointers, then the most likely cause is a stack overflow. Make sure that you aren't using large automatic arrays in either function, and that you are doing proper bounds checking on array accesses within the functions. In DJGPP, the default stack is 256K in size and is fixed. You can change the size by setting the _stklen global variable or by using 'stubedit'. For more information on debugging and stack-related issues, please read the DJGPP Frequently Asked Questions list (v2/faq210b.zip from SimTel or online at http://www.delorie.com/djgpp/v2faq/). Chapter 12 deals with debugging, and chapter 15 deals with run-time memory issues such as the stack. hth -- John M. Aldrich, aka Fighteer I -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------