aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/cygheap.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-07-17 00:51:03 +0000
committerChristopher Faylor <me@cgf.cx>2005-07-17 00:51:03 +0000
commite8454a340033a287a9245e049a6f23eb68ec7f95 (patch)
treee235728e012c817a8bc813232961e972d49f4ac1 /winsup/cygwin/cygheap.cc
parentcd929277d69996a60f29d17bb4d612063926a5f7 (diff)
downloadnewlib-e8454a340033a287a9245e049a6f23eb68ec7f95.zip
newlib-e8454a340033a287a9245e049a6f23eb68ec7f95.tar.gz
newlib-e8454a340033a287a9245e049a6f23eb68ec7f95.tar.bz2
* child_info.h (child_info::sync): Pass pid and HANDLE rather than using pinfo.
(child_info::child_info): Accept an argument controlling whether to create proc_subproc. (child_info_spawn::child_info_spawn): Ditto. * sigproc.cc (child_info::child_info): Ditto. (child_info_spawn::child_info_spawn): Ditto. (child_info::sync): Use passed in pid and HANDLE. * fork.cc (fork_parent): Reflect additional arguments required for child_info::sync. * hookapi.cc (hook_or_detect_cygwin): Rename. Change so that NULL 'fn' argument just returns "true", indicating that program uses cygwin1.dll. * spawn.cc (av::win16_exe): New element. * spawn.cc (av::iscygwin): New element. (av::fixup): New function. (spawn_guts): Protect against SEGV. Use fixup function to detect when it is safe to wait for a spawned (as opposed to an execed) program. Reflect changes in child_info::sync arguments. * external.cc (cygwin_internal): Reflect function renaming to hook_or_detect_cygwin. * cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup has been done to prevent false positives in handle collision. * exceptions.cc (try_to_debug): Notify debugger if already being debugged.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 633df7f..9f2f7d4 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -51,7 +51,7 @@ extern "C" {
static void __stdcall _cfree (void *) __attribute__((regparm(1)));
static void *__stdcall _csbrk (int);
}
-
+
/* Called by fork or spawn to reallocate cygwin heap */
void __stdcall
cygheap_fixup_in_child (bool execed)
@@ -60,13 +60,16 @@ cygheap_fixup_in_child (bool execed)
cygheap = (init_cygheap *) cygheap_max;
_csbrk ((char *) child_proc_info->cygheap_max - (char *) cygheap);
child_copy (child_proc_info->parent, child_proc_info->dwProcessId, "cygheap", cygheap, cygheap_max);
+ cygheap_init ();
+ debug_fixup_after_fork_exec ();
+
+ /* Need to do this after debug_fixup_after_fork_exec or DEBUGGING handling of
+ handles might get confused. */
if (execed)
{
CloseHandle (child_proc_info->parent);
child_proc_info->parent = NULL;
}
- cygheap_init ();
- debug_fixup_after_fork_exec ();
if (execed)
{