This is the mail archive of the
mailing list for the Cygwin project.
Re: 1.5.5: SEGV in calloc before start of main
- From: Lloyd Lewins <lloydlewins at yahoo dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 21 Nov 2003 16:29:49 -0800 (PST)
- Subject: Re: 1.5.5: SEGV in calloc before start of main
Well I figured out the problem. The application
defines its own heap management routines (malloc,
free, realloc). However it does NOT define calloc. The
existance of an application defined malloc causes
malloc_wrappers to vector dll calloc calls to the
application. However, since the application doesn't
define calloc, the stub immediately calls the wrapper
version again. An infinite recursion results, ensuing
in a segv. I suggest that the wrappers would be more
robust if they checked for the existance of all the
routines they plan to call (including free) -- and at
least generated a helpful error message (this was a
pain for a non-cygwin expert to debug!)
I am a little uncomfortable with the idea that the
startup code makes calls into the application (malloc
etc) before the application is fully initialized (and
before it has a chance to initialize itself in main).
However, I guess that is one of the hazards of writing
your own "system calls" (malloc etc).
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html