Mail Archives: cygwin/2002/07/08/14:21:33
--------------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 -