* strace.cc (attach_process): Don't tell process to start stracing here.
(proc_child): Do it here, instead, after first debug event. This should work around inexplicable races with DebugActiveProcess. (dostrace): Pass any pid argument to proc_child.
This commit is contained in:
parent
40a4eb7300
commit
d73f9745f1
@ -1,3 +1,11 @@
|
|||||||
|
2002-05-26 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* strace.cc (attach_process): Don't tell process to start stracing
|
||||||
|
here.
|
||||||
|
(proc_child): Do it here, instead, after first debug event. This
|
||||||
|
should work around inexplicable races with DebugActiveProcess.
|
||||||
|
(dostrace): Pass any pid argument to proc_child.
|
||||||
|
|
||||||
2002-05-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
2002-05-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
* setfacl.c (usage): Standardize usage output. Change return type to
|
* setfacl.c (usage): Standardize usage output. Change return type to
|
||||||
|
@ -291,7 +291,6 @@ attach_process (pid_t pid)
|
|||||||
if (!DebugActiveProcess (child_pid))
|
if (!DebugActiveProcess (child_pid))
|
||||||
error (0, "couldn't attach to pid %d<%d> for debugging", pid, child_pid);
|
error (0, "couldn't attach to pid %d<%d> for debugging", pid, child_pid);
|
||||||
|
|
||||||
(void) cygwin_internal (CW_STRACE_TOGGLE, pid);
|
|
||||||
printf ("Attached to pid %d (windows pid %u)\n", pid, (unsigned) child_pid);
|
printf ("Attached to pid %d (windows pid %u)\n", pid, (unsigned) child_pid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -572,7 +571,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
proc_child (unsigned mask, FILE *ofile)
|
proc_child (unsigned mask, FILE *ofile, pid_t pid)
|
||||||
{
|
{
|
||||||
DEBUG_EVENT ev;
|
DEBUG_EVENT ev;
|
||||||
int processes = 0;
|
int processes = 0;
|
||||||
@ -595,6 +594,12 @@ proc_child (unsigned mask, FILE *ofile)
|
|||||||
if (!debug_event)
|
if (!debug_event)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (pid)
|
||||||
|
{
|
||||||
|
(void) cygwin_internal (CW_STRACE_TOGGLE, pid);
|
||||||
|
pid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (ev.dwDebugEventCode)
|
switch (ev.dwDebugEventCode)
|
||||||
{
|
{
|
||||||
case CREATE_PROCESS_DEBUG_EVENT:
|
case CREATE_PROCESS_DEBUG_EVENT:
|
||||||
@ -651,7 +656,7 @@ dostrace (unsigned mask, FILE *ofile, pid_t pid, char **argv)
|
|||||||
create_child (argv);
|
create_child (argv);
|
||||||
else
|
else
|
||||||
attach_process (pid);
|
attach_process (pid);
|
||||||
proc_child (mask, ofile);
|
proc_child (mask, ofile, pid);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user