This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

Lloyd Lewins

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]