? save Index: dll_init.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/dll_init.cc,v retrieving revision 1.21 diff -u -p -r1.21 dll_init.cc --- dll_init.cc 2001/10/21 03:38:41 1.21 +++ dll_init.cc 2001/12/07 18:57:29 @@ -305,13 +305,26 @@ dll_list::load_after_fork (HANDLE parent LoadLibrary (d.name); } else if (try2) + { + system_printf ("remap failed twice for %s with old handle = %p, new handle = %p", d.name, d.handle, h); + for (next = first; next; next = d.next) + { + DWORD nb; + /* Read the dll structure from the parent. */ + if (!ReadProcessMemory (parent, next, &d, sizeof (dll), &nb) || + nb != sizeof (dll)) + break; + system_printf ("name = %s handle = %p", d.name, d.handle); + } api_fatal ("unable to remap %s to same address as parent -- %p", d.name, h); + } else { /* It loaded in the wrong place. Dunno why this happens but it always seems to happen when there are multiple DLLs attempting to load into the same address space. In the "forked" process, the second DLL always loads into a different location. */ + system_printf ("remap failed for %s with old handle = %p, new handle = %p", d.name, d.handle, h); FreeLibrary (h); /* Block all of the memory up to the new load address. */ reserve_upto (d.name, (DWORD) d.handle);