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

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
Message-ID: <20020708183050.51412.qmail@web21007.mail.yahoo.com>
Date: Mon, 8 Jul 2002 11:30:50 -0700 (PDT)
From: Nicholas Wourms <nwourms AT yahoo DOT com>
Subject: Re: patch to make strace printfs available to C code
To: Joe Buehler <jbuehler AT hekimian DOT com>, cygwin AT cygwin DOT com
In-Reply-To: <3D29D707.10401@hekimian.com>
MIME-Version: 1.0

Joe,

Thank for this patch, but there are a few guidelines for submitting
patches that should be followed.  Please check out:

http://cygwin.com/contrib.html

for the guidelines concerning this.  First, you should always patch
against cvs sources.  Secondly, for more then 10 lines of code, you should
submit an assignment form.  It only takes a minute, and they'll send you
some nice stuff for taking the time to do so.  Once you have your patch
properly made, with your assignment in the mail, feel free to resubmit it
to the cygwin-patches mailing list.

Looking forward to your contribution!

Cheers,
Nicholas 
--- Joe Buehler <jbuehler AT hekimian DOT com> wrote:
> I forgot the attachment, here it is.
> 
> Joe Buehler
> > --- 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;
> 
> > --
> 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/


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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

- Raw text -


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