Re: [PATCH] debug prints

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 10 Aug 2012 13:57:54 +1200

On 9/08/2012 12:12 a.m., Alexander Komyagin wrote:
> Following patch fixes nested debug() calls problem.
> Since debugs() is a macros, it should not change static Debugs::level
> before putting debug message to the internal stream. Otherwise we
> encounter problems when debug message itself contains calls to debugs().
>
> --- src/Debug.h 2012-03-07 05:42:55.000000000 +0300
> +++ src/Debug.h 2012-08-08 14:49:20.000000000 +0400
> @@ -106,8 +106,9 @@
> /* Debug stream */
> #define debugs(SECTION, LEVEL, CONTENT) \
> do { \
> - if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \
> + if ((LEVEL) <= Debug::Levels[SECTION]) { \
> Debug::getDebugOut() << CONTENT; \
> + Debug::level = (LEVEL); \
> Debug::finishDebug(); \
> } \
> } while (/*CONSTCOND*/ 0)
>

Looks okay. How much testing has this had?

Amos
Received on Fri Aug 10 2012 - 01:58:10 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 10 2012 - 12:00:04 MDT