* child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.

* dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing since
strace::write_child relies on it.  Use strace.activate to notify strace
process, passing in arg indicating whether we're forked.
* sigproc.cc (wait_sig): Accommodate new strace::activate argument.
* spawn.cc (child_info_spawn::worker): Oops.  Previous suspended test was
actually correct.  Revert and document.
* strace.cc (strace::activate): Send additional flag indicating whether this is
an attempt to activate a forked process.
(strace::hello): Report on windows pid.
* include/sys/strace.h (strace::strace): Make a dummy.
(strace::activate): Modify declaration to accept an argument.
(strace::write_childpid): Set regparm.
This commit is contained in:
Christopher Faylor 2011-11-24 02:17:55 +00:00
parent 5f38ec4681
commit 8942ed09ac
7 changed files with 32 additions and 12 deletions

View File

@ -1,3 +1,20 @@
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.
* dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing
since strace::write_child relies on it. Use strace.activate to notify
strace process, passing in arg indicating whether we're forked.
* sigproc.cc (wait_sig): Accommodate new strace::activate argument.
* spawn.cc (child_info_spawn::worker): Oops. Previous suspended test
was actually correct. Revert and document.
* strace.cc (strace::activate): Send additional flag indicating whether
this is an attempt to activate a forked process.
(strace::hello): Report on windows pid.
* include/sys/strace.h (strace::strace): Make a dummy.
(strace::activate): Modify declaration to accept an argument.
(strace::write_childpid): Set regparm.
2011-11-23 Christopher Faylor <me.cygwin2011@cgf.cx>
* pipe.cc (fhandler_pipe::create): Avoid derefencing a NULL pointer.

View File

@ -35,7 +35,7 @@ enum child_status
#define EXEC_MAGIC_SIZE sizeof(child_info)
/* Change this value if you get a message indicating that it is out-of-sync. */
#define CURR_CHILD_INFO_MAGIC 0x24f4be4bU
#define CURR_CHILD_INFO_MAGIC 0x76041b78U
#define NPROCS 256

View File

@ -545,9 +545,10 @@ get_cygwin_startup_info ()
multiple_cygwin_problem ("fhandler size", res->fhandler_union_cb, sizeof (fhandler_union));
if (res->isstraced ())
{
for (unsigned i = 0; !being_debugged () && i < 10000; i++)
res->ready (false);
for (unsigned i = 0; !being_debugged () && i < 1000000; i++)
yield ();
strace.hello ();
strace.activate (res->type == _CH_FORK);
}
break;
default:

View File

@ -39,8 +39,8 @@ class strace
void write (unsigned category, const char *buf, int count);
unsigned char _active;
public:
void activate ();
strace () {activate ();}
void activate (bool) __attribute__ ((regparm (2)));;
strace () {}
int microseconds ();
int version;
int lmicrosec;
@ -50,7 +50,7 @@ public:
void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/;
void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((regparm(3)))*/;
void wm (int message, int word, int lon) __attribute__ ((regparm(3)));
void write_childpid (child_info&, unsigned long) __attribute__ ((regparm (2)));
void write_childpid (child_info&, unsigned long) __attribute__ ((regparm (3)));
bool attached () const {return _active == 3;}
bool active () const {return _active & 1;}
unsigned char& active_val () {return _active;}

View File

@ -1295,7 +1295,7 @@ wait_sig (VOID *)
talktome (&pack.si);
break;
case __SIGSTRACE:
strace.activate ();
strace.activate (false);
strace.hello ();
break;
case __SIGPENDING:

View File

@ -692,7 +692,8 @@ loop:
goto out;
}
if (iscygwin ())
/* The CREATE_SUSPENDED case is handled below */
if (!(c_flags & CREATE_SUSPENDED))
strace.write_childpid (*this, pi.dwProcessId);
/* Fixup the parent data structures if needed and resume the child's

View File

@ -32,12 +32,12 @@ class strace NO_COPY strace;
#ifndef NOSTRACE
void
strace::activate ()
strace::activate (bool isfork)
{
if (!dynamically_loaded && !_active && being_debugged ())
{
char buf[30];
__small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &_active);
__small_sprintf (buf, "cYg%8x %x %d", _STRACE_INTERFACE_ACTIVATE_ADDR, &_active, isfork);
OutputDebugString (buf);
}
}
@ -47,9 +47,10 @@ strace::hello ()
{
if (active ())
{
char pidbuf[40];
char pidbuf[80];
if (myself->progname[0])
__small_sprintf (pidbuf, "(pid %d, ppid %d)", myself->pid, myself->ppid ?: 1);
__small_sprintf (pidbuf, "(pid %d, ppid %d, windows pid %u)", myself->pid,
myself->ppid ?: 1, GetCurrentProcessId ());
else
{
GetModuleFileNameW (NULL, myself->progname, sizeof (myself->progname));