Date: Thu, 3 Jun 1999 09:38:27 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Anton Helm cc: djgpp AT delorie DOT com Subject: Re: problems debugging segfault In-Reply-To: <4.1.19990602155545.00a21100@hal.nt.tuwien.ac.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 2 Jun 1999, Anton Helm wrote: > 1) The program works fine when buildt with DJGPP v2.01 > 2) When buildt with v2.02 I get a seg-fault in > malloc+349 > > I know this looks very much like a memory problem > (either allocated not enough memory somewhere or freed twice ...). > > 3) I used MSS v1.2 to build a testversion of the program. > Setting the MSS options to "paranoid" (well, you know ...) > I sent the program to the remote user and asked him to mail me the > MSS logfile. The testversion of the program worked there without ANY > problem. It produced a rather big logfile which I searched carefully. > No warnings or errors in this file. Several things come to mind: 1) Try YAMD instead of MSS. (This will only work if the program runs in plain DOS on the target machine.) 2) Use the `_CRT0_FLAG_FILL_SBRK_MEMORY' bit in `_crt0_startup_flags', and see what happens. Perhaps the program uses uninitialized memory somewhere. 3) Find out exactly where in malloc does it crash, then introduce a small change there to print the buffer around the faulty pointer. Perhaps looking at the values will give a hint (e.g., if it looks like ASCII text, you could look for places where this text might have come from). (I said "a small change" because a large one might work like MSS, and make the problem mysteriously go away.)