diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4896d9514..7eb4250b8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2002-05-26 Christopher Faylor + + * debug.h (being_debugged): New macro. + * dtable.cc (dtable::extend): Use new macro. + * exceptions.cc (try_to_debug): Ditto. + * strace.cc (strace::hello): Only output debugging info when we think + we're being debugged. + 2002-05-25 Robert Collins * winsup.h: Remove duplicate declarations of malloc_lock and diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h index 0b7e53359..9efafc159 100644 --- a/winsup/cygwin/debug.h +++ b/winsup/cygwin/debug.h @@ -28,6 +28,9 @@ DWORD __stdcall WFMO (DWORD, CONST HANDLE *, BOOL, DWORD) __attribute__ ((regpar #if !defined(_DEBUG_H_) #define _DEBUG_H_ +#define being_debugged() \ + (IsDebuggerPresent () || GetLastError () == ERROR_PROC_NOT_FOUND) + void threadname_init (); HANDLE __stdcall makethread (LPTHREAD_START_ROUTINE, LPVOID, DWORD, const char *) __attribute__ ((regparm(3))); const char * __stdcall threadname (DWORD, int lockit = TRUE) __attribute__ ((regparm(2))); diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 2a43b0bfd..f43baea29 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -92,7 +92,7 @@ dtable::extend (int howmuch) void dtable::get_debugger_info () { - if (IsDebuggerPresent ()) + if (being_debugged ()) { char std[3][sizeof ("/dev/ttyNNNN")]; std[0][0] = std[1][0] = std [2][0] = '\0'; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 1bca810dd..8e00e072f 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -393,7 +393,7 @@ try_to_debug (bool waitloop) if (!waitloop) return 1; SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); - while (!IsDebuggerPresent ()) + while (!being_debugged ()) /* spin */; Sleep (4000); small_printf ("*** continuing from debugger call\n"); diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index afb388206..7c93865f1 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -38,6 +38,9 @@ strace::hello() return; } + if (!being_debugged ()) + return; + __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active); OutputDebugString (buf);