* 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.
This commit is contained in:
Christopher Faylor 2002-05-27 02:25:28 +00:00
parent 0cfbfc249f
commit 918a268c80
5 changed files with 16 additions and 2 deletions

View File

@ -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

View File

@ -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)));

View File

@ -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';

View File

@ -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");

View File

@ -38,6 +38,9 @@ strace::hello()
return;
}
if (!being_debugged ())
return;
__small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active);
OutputDebugString (buf);