Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-11-24 06:17:55 +0400
committerChristopher Faylor <me@cgf.cx>2011-11-24 06:17:55 +0400
commit8942ed09ac9491f52337395e11b6dc0c554be05f (patch)
treebdd0f41aa11c48fe91eb07f483fad89f7baffe8f
parent5f38ec468115a6ddf2c458f2b8f9c4abfd8b0359 (diff)
* 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.
-rw-r--r--winsup/cygwin/ChangeLog17
-rw-r--r--winsup/cygwin/child_info.h2
-rw-r--r--winsup/cygwin/dcrt0.cc5
-rw-r--r--winsup/cygwin/include/sys/strace.h6
-rw-r--r--winsup/cygwin/sigproc.cc2
-rw-r--r--winsup/cygwin/spawn.cc3
-rw-r--r--winsup/cygwin/strace.cc9
7 files changed, 32 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 95ba756d1..38a950edf 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,22 @@
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.
* child_info.h (child_info): Reorganize some elements so that the ones
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 91cf3c58c..1dfa51bf5 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -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
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 62105ab61..40c893538 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -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:
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
index a8eb05f91..5b1ccb5b2 100644
--- a/winsup/cygwin/include/sys/strace.h
+++ b/winsup/cygwin/include/sys/strace.h
@@ -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;}
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index bbfed1fcd..666bdd8c8 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1295,7 +1295,7 @@ wait_sig (VOID *)
talktome (&pack.si);
break;
case __SIGSTRACE:
- strace.activate ();
+ strace.activate (false);
strace.hello ();
break;
case __SIGPENDING:
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 4e93b1888..688655c8a 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -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
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 6b3de5c73..58dbb8887 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -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));