From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42315 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJ2Me-0001gf-JT for qemu-devel@nongnu.org; Thu, 18 Nov 2010 06:09:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJ2Md-0003iJ-Hb for qemu-devel@nongnu.org; Thu, 18 Nov 2010 06:09:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJ2Md-0003iD-9Y for qemu-devel@nongnu.org; Thu, 18 Nov 2010 06:09:15 -0500 Message-ID: <4CE50956.90400@redhat.com> Date: Thu, 18 Nov 2010 12:09:10 +0100 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [RFC][PATCH v3 03/21] virtproxy: add debug functions for virtproxy core References: <1289870175-14880-1-git-send-email-mdroth@linux.vnet.ibm.com> <1289870175-14880-4-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1289870175-14880-4-git-send-email-mdroth@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: agl@linux.vnet.ibm.com, abeekhof@redhat.com, qemu-devel@nongnu.org, aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com, amit.shah@redhat.com On 11/16/10 02:15, Michael Roth wrote: > Signed-off-by: Michael Roth > --- > virtproxy.c | 17 +++++++++++++++++ > 1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/virtproxy.c b/virtproxy.c > index 8f18d83..3686c77 100644 > --- a/virtproxy.c > +++ b/virtproxy.c > @@ -13,6 +13,23 @@ > > #include "virtproxy.h" > > +#define DEBUG_VP > + > +#ifdef DEBUG_VP > +#define TRACE(msg, ...) do { \ > + fprintf(stderr, "%s:%s():L%d: " msg "\n", \ > + __FILE__, __FUNCTION__, __LINE__, ## __VA_ARGS__); \ > +} while(0) > +#else > +#define TRACE(msg, ...) \ > + do { } while (0) > +#endif > + > +#define LOG(msg, ...) do { \ > + fprintf(stderr, "%s:%s(): " msg "\n", \ > + __FILE__, __FUNCTION__, ## __VA_ARGS__); \ > +} while(0) > + I wonder if it wouldn't make sense to do this in a more generic way and stick it in a header file. This type of debug code seems to show up repeatedly all over the place. Cheers, Jes