* 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:
		| @@ -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> | 2002-05-25  Robert Collins   <rbtcollins@hotmail.com> | ||||||
|  |  | ||||||
| 	* winsup.h: Remove duplicate declarations of malloc_lock and | 	* winsup.h: Remove duplicate declarations of malloc_lock and | ||||||
|   | |||||||
| @@ -28,6 +28,9 @@ DWORD __stdcall WFMO (DWORD, CONST HANDLE *, BOOL, DWORD) __attribute__ ((regpar | |||||||
| #if !defined(_DEBUG_H_) | #if !defined(_DEBUG_H_) | ||||||
| #define _DEBUG_H_ | #define _DEBUG_H_ | ||||||
|  |  | ||||||
|  | #define being_debugged() \ | ||||||
|  |   (IsDebuggerPresent () || GetLastError () == ERROR_PROC_NOT_FOUND) | ||||||
|  |  | ||||||
| void threadname_init (); | void threadname_init (); | ||||||
| HANDLE __stdcall makethread (LPTHREAD_START_ROUTINE, LPVOID, DWORD, const char *) __attribute__ ((regparm(3))); | HANDLE __stdcall makethread (LPTHREAD_START_ROUTINE, LPVOID, DWORD, const char *) __attribute__ ((regparm(3))); | ||||||
| const char * __stdcall threadname (DWORD, int lockit = TRUE) __attribute__ ((regparm(2))); | const char * __stdcall threadname (DWORD, int lockit = TRUE) __attribute__ ((regparm(2))); | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ dtable::extend (int howmuch) | |||||||
| void | void | ||||||
| dtable::get_debugger_info () | dtable::get_debugger_info () | ||||||
| { | { | ||||||
|   if (IsDebuggerPresent ()) |   if (being_debugged ()) | ||||||
|     { |     { | ||||||
|       char std[3][sizeof ("/dev/ttyNNNN")]; |       char std[3][sizeof ("/dev/ttyNNNN")]; | ||||||
|       std[0][0] = std[1][0] = std [2][0] = '\0'; |       std[0][0] = std[1][0] = std [2][0] = '\0'; | ||||||
|   | |||||||
| @@ -393,7 +393,7 @@ try_to_debug (bool waitloop) | |||||||
|       if (!waitloop) |       if (!waitloop) | ||||||
| 	return 1; | 	return 1; | ||||||
|       SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); |       SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); | ||||||
|       while (!IsDebuggerPresent ()) |       while (!being_debugged ()) | ||||||
| 	/* spin */; | 	/* spin */; | ||||||
|       Sleep (4000); |       Sleep (4000); | ||||||
|       small_printf ("*** continuing from debugger call\n"); |       small_printf ("*** continuing from debugger call\n"); | ||||||
|   | |||||||
| @@ -38,6 +38,9 @@ strace::hello() | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |   if (!being_debugged ()) | ||||||
|  |     return; | ||||||
|  |  | ||||||
|   __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active); |   __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active); | ||||||
|   OutputDebugString (buf); |   OutputDebugString (buf); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user