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>2008-12-19 22:09:51 +0300
committerChristopher Faylor <me@cgf.cx>2008-12-19 22:09:51 +0300
commit1af6bb97a4c189f734e03580f238c68865b4b21f (patch)
treeb5e6999eaba73b31dc30cab33adbec66202c659b
parent887eb76fca6231e6d6b9a5058a95cba28dcc46b6 (diff)
* pinfo.cc (pinfo_basic): New class.
(pinfo_basic::pinfo_basic): Define constructor for new class. (myself): Initialize from myself_initial. (set_myself): Set pid and progname from already myself_initial. * strace.cc (strace::strace): Split apart strace::hello. Send notification to strace as early as possible. (strace::hello): Just send clause which describes the current process. This can now be preceded by early initialization strace output. * include/sys/strace.h (strace::strace): Declare new constructor.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/include/sys/strace.h1
-rw-r--r--winsup/cygwin/pinfo.cc24
-rw-r--r--winsup/cygwin/strace.cc17
4 files changed, 41 insertions, 13 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3ee453fb3..f9aec8bad 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-19 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * pinfo.cc (pinfo_basic): New class.
+ (pinfo_basic::pinfo_basic): Define constructor for new class.
+ (myself): Initialize from myself_initial.
+ (set_myself): Set pid and progname from already myself_initial.
+ * strace.cc (strace::strace): Split apart strace::hello. Send
+ notification to strace as early as possible.
+ (strace::hello): Just send clause which describes the current process.
+ This can now be preceded by early initialization strace output.
+ * include/sys/strace.h (strace::strace): Declare new constructor.
+
2008-12-19 Christian Franke <franke@computer.org>
* fhandler_registry.cc (perf_data_files): New table.
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
index 9b9da1743..4685e5f36 100644
--- a/winsup/cygwin/include/sys/strace.h
+++ b/winsup/cygwin/include/sys/strace.h
@@ -39,6 +39,7 @@ class strace
void write (unsigned category, const char *buf, int count);
unsigned char _active;
public:
+ strace ();
int microseconds ();
int version;
int lmicrosec;
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 3cfa82a70..d5b3bc09d 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -30,9 +30,21 @@ details. */
#include "tls_pbuf.h"
#include "child_info.h"
-static char NO_COPY pinfo_dummy[sizeof (_pinfo)] = {0};
+class pinfo_basic: public _pinfo
+{
+public:
+ pinfo_basic();
+};
-pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks
+pinfo_basic::pinfo_basic()
+{
+ pid = dwProcessId = GetCurrentProcessId ();
+ GetModuleFileName (NULL, progname, sizeof (progname));
+}
+
+pinfo_basic myself_initial NO_COPY;
+
+pinfo NO_COPY myself (static_cast<_pinfo *> (&myself_initial)); // Avoid myself != NULL checks
bool is_toplevel_proc;
@@ -43,12 +55,12 @@ void __stdcall
set_myself (HANDLE h)
{
if (!h)
- cygheap->pid = cygwin_pid (GetCurrentProcessId ());
+ cygheap->pid = cygwin_pid (myself_initial.pid);
+
myself.init (cygheap->pid, PID_IN_USE, h ?: INVALID_HANDLE_VALUE);
myself->process_state |= PID_IN_USE;
- myself->dwProcessId = GetCurrentProcessId ();
-
- GetModuleFileName (NULL, myself->progname, sizeof (myself->progname));
+ myself->dwProcessId = myself_initial.pid;
+ strcpy (myself->progname, myself_initial.progname);
strace.hello ();
debug_printf ("myself->dwProcessId %u", myself->dwProcessId);
if (h)
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 46726150a..b9af9df91 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -31,16 +31,19 @@ class strace NO_COPY strace;
#ifndef NOSTRACE
+strace::strace ()
+{
+ if (!dynamically_loaded && !_active && being_debugged ())
+ {
+ char buf[30];
+ __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &_active);
+ OutputDebugString (buf);
+ }
+}
+
void
strace::hello ()
{
- if (_active || !being_debugged ())
- return;
-
- char buf[30];
- __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &_active);
- OutputDebugString (buf);
-
if (active ())
{
char pidbuf[40];