* 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.
This commit is contained in:
parent
887eb76fca
commit
1af6bb97a4
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue