[PATCH] Add an additional relocation attempt pass to load_after_fork()

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Mon Apr 4 14:39:00 GMT 2011

On Mon, Apr 04, 2011 at 01:42:54PM +0100, Jon TURNEY wrote:
>On 30/03/2011 22:29, Christopher Faylor wrote:
>> On Wed, Mar 30, 2011 at 11:15:56PM +0200, Corinna Vinschen wrote:
>>> Chris, are you going to take a look into this patch?
>> yep.
>Attached is an updated version of the patch which fixes the warning identified
>by Yaakov.
>I've also attached a slightly cleaned up version of the additional fork
>debugging output patch I was using.

>2011-03-12  Jon TURNEY  <jon.turney@dronecode.org.uk>
>	* dll_init.cc (reserve_at, release_at): New functions.
>	(load_after_fork): Make a 3rd pass at trying to load the DLL in
>	the right place.

Rather than add a new pass could we just add rename/enhance "reserve_upto" so
that it both reserves the block of memory up to the dll's preferred load address
and the block of memory erroneously occupied by the dll?  Or is the extra step

If so, it seems like we're allocating and freeing the space up to the DLL more
than once.  I think we could avoid doing that.

As far as fork debugging is concerned, do you know about building cygwin with
--enable-debugging and then setting "CYGWIN_DEBUG=blah"?  That will force a
gdb to start whenever cygwin runs a program named "blah".  That's how I usually
debug projects like this.

--enable-debugging has some irritating races so you have to use it sparingly but
it's invaluable for figuring out problems in forked processes.


More information about the Cygwin-patches mailing list