delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/08/14:21:33

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: Joe Buehler <jbuehler AT hekimian DOT com>
Newsgroups: gmane.os.cygwin
Subject: Re: patch to make strace printfs available to C code
Date: Mon, 08 Jul 2002 14:16:39 -0400
Lines: 129
Message-ID: <3D29D707.10401@hekimian.com>
References: <3D29D614 DOT 5030809 AT hekimian DOT com>
NNTP-Posting-Host: hekimian.com
Mime-Version: 1.0
X-Trace: main.gmane.org 1026152156 21366 206.205.138.10 (8 Jul 2002 18:15:56 GMT)
X-Complaints-To: usenet AT main DOT gmane DOT org
NNTP-Posting-Date: Mon, 8 Jul 2002 18:15:56 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020530
X-Accept-Language: en-us, en

--------------080009020700050101060407
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I forgot the attachment, here it is.

Joe Buehler

--------------080009020700050101060407
Content-Type: text/plain;
 name="temp.patch.strace"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="temp.patch.strace"

--- src/winsup/cygwin/include/sys/strace.h	2002-06-10 15:58:21.000000000 -0400
+++ src/winsup/cygwin/include/sys/strace.h	2002-06-25 14:05:34.000000000 -0400
@@ -78,6 +78,7 @@
 #define _STRACE_MALLOC	 0x20000 // trace malloc calls
 #define _STRACE_THREAD	 0x40000 // thread-locking calls
 #define _STRACE_NOTALL	 0x80000 // don't include if _STRACE_ALL
+
 #if defined (DEBUGGING)
 # define _STRACE_ON strace.active = 1;
 # define _STRACE_OFF strace.active = 0;
@@ -92,29 +93,37 @@
 
 void small_printf (const char *, ...);
 void strace_printf (unsigned, const char *func, const char *, ...);
+int strace_active();
 
 #ifdef __cplusplus
 }
 #endif
 
 #ifdef __cplusplus
-
-#ifdef NOSTRACE
-#define define_strace(c, f)
-#define define_strace1(c, f)
+#define STRACE_PRINTF strace.prntf
+#define STRACE_ACTIVE strace.active
 #else
+#define STRACE_PRINTF strace_printf
+#define STRACE_ACTIVE strace_active()
+#endif /* __cplusplus */
+
 #ifdef NEW_MACRO_VARARGS
 /* Output message to strace log */
 
 #define define_strace0(c,...) \
   do { \
-      if ((c & _STRACE_SYSTEM) || strace.active) \
-	strace.prntf (c, __PRETTY_FUNCTION__, __VA_ARGS__); \
+      if ((c & _STRACE_SYSTEM) || STRACE_ACTIVE) \
+	STRACE_PRINTF (c, __PRETTY_FUNCTION__, __VA_ARGS__); \
     } \
   while (0)
 
+#ifdef NOSTRACE
+#define define_strace(c, f)
+#define define_strace1(c, f)
+#else
 #define define_strace(c, ...) define_strace0 (_STRACE_ ## c, __VA_ARGS__)
 #define define_strace1(c, ...) define_strace0 ((_STRACE_ ## c | _STRACE_NOTALL), __VA_ARGS__)
+#endif
 
 #define debug_printf(...)	define_strace (DEBUG, __VA_ARGS__)
 #define paranoid_printf(...)	define_strace (PARANOID, __VA_ARGS__)
@@ -127,19 +136,26 @@
 #define minimal_printf(...)	define_strace1 (MINIMAL, __VA_ARGS__)
 #define malloc_printf(...)	define_strace1 (MALLOC, __VA_ARGS__)
 #define thread_printf(...)	define_strace1 (THREAD, __VA_ARGS__)
+
+#else /*NEW_MACRO_VARARGS*/
+
+#ifdef NOSTRACE
+#define strace_printf_wrap(what, fmt, args...)
+#define strace_printf_wrap1(what, fmt, args...)
 #else
 #define strace_printf_wrap(what, fmt, args...) \
    ((void) ({\
-	if ((_STRACE_ ## what & _STRACE_SYSTEM) || strace.active) \
-	  strace.prntf(_STRACE_ ## what, __PRETTY_FUNCTION__, fmt, ## args); \
+	if ((_STRACE_ ## what & _STRACE_SYSTEM) || STRACE_ACTIVE) \
+	  STRACE_PRINTF(_STRACE_ ## what, __PRETTY_FUNCTION__, fmt, ## args); \
 	0; \
     }))
 #define strace_printf_wrap1(what, fmt, args...) \
     ((void) ({\
-	if ((_STRACE_ ## what & _STRACE_SYSTEM) || strace.active) \
-	  strace.prntf((_STRACE_ ## what) | _STRACE_NOTALL, __PRETTY_FUNCTION__, fmt, ## args); \
+	if ((_STRACE_ ## what & _STRACE_SYSTEM) || STRACE_ACTIVE) \
+	  STRACE_PRINTF((_STRACE_ ## what) | _STRACE_NOTALL, __PRETTY_FUNCTION__, fmt, ## args); \
 	0; \
     }))
+#end
 
 #define debug_printf(fmt, args...) strace_printf_wrap(DEBUG, fmt , ## args)
 #define paranoid_printf(fmt, args...) strace_printf_wrap(PARANOID, fmt , ## args)
@@ -152,7 +168,7 @@
 #define minimal_printf(fmt, args...) strace_printf_wrap1(MINIMAL, fmt , ## args)
 #define malloc_printf(fmt, args...) strace_printf_wrap1(MALLOC, fmt , ## args)
 #define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args)
+
 #endif /*NEW_MACRO_VARARGS*/
-#endif /*NOSTRACE*/
-#endif /* __cplusplus */
+
 #endif /* _SYS_STRACE_H */
--- src/winsup/cygwin/strace.cc	2002-06-19 11:27:25.000000000 -0400
+++ src/winsup/cygwin/strace.cc	2002-06-25 14:04:16.000000000 -0400
@@ -234,6 +234,12 @@
     }
 }
 
+extern "C" int
+strace_active()
+{
+  return strace.active;
+}
+
 static NO_COPY struct tab
 {
   int v;


--------------080009020700050101060407
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--------------080009020700050101060407--



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019