aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-05-27 02:25:28 +0000
committerChristopher Faylor <me@cgf.cx>2002-05-27 02:25:28 +0000
commit918a268c8085f18ff6683a9b5979411c064ace82 (patch)
treeedd780e3950fc24cc81f9f39d5a6d1fd6e449d63
parent0cfbfc249f26bec6c407bb54d8e5e7a65c95afe0 (diff)
downloadnewlib-918a268c8085f18ff6683a9b5979411c064ace82.zip
newlib-918a268c8085f18ff6683a9b5979411c064ace82.tar.gz
newlib-918a268c8085f18ff6683a9b5979411c064ace82.tar.bz2
* 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.
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/debug.h3
-rw-r--r--winsup/cygwin/dtable.cc2
-rw-r--r--winsup/cygwin/exceptions.cc2
-rw-r--r--winsup/cygwin/strace.cc3
5 files changed, 16 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4896d95..7eb4250 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2002-05-26 Christopher Faylor <cgf@redhat.com>
+
+ * 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 <rbtcollins@hotmail.com>
* winsup.h: Remove duplicate declarations of malloc_lock and
diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h
index 0b7e533..9efafc1 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 2a43b0b..f43baea 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 1bca810..8e00e07 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 afb3882..7c93865 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);