delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/03/02:42:26

Date: Thu, 3 Jun 1999 09:38:27 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Anton Helm <tony AT nt DOT tuwien DOT ac DOT at>
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: <Pine.SUN.3.91.990603093805.7269E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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.)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019