From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8914 invoked by alias); 17 Jan 2014 02:40:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8903 invoked by uid 89); 17 Jan 2014 02:40:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 17 Jan 2014 02:39:59 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BEA2C116493; Thu, 16 Jan 2014 21:39:57 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OmHIFOJoKsm1; Thu, 16 Jan 2014 21:39:57 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 4F10B11648E; Thu, 16 Jan 2014 21:39:57 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 5E18EE03FC; Fri, 17 Jan 2014 06:39:55 +0400 (RET) Date: Fri, 17 Jan 2014 02:40:00 -0000 From: Joel Brobecker To: Doug Evans Cc: Yao Qi , Pedro Alves , gdb-patches Subject: Re: [PATCH 4/6] gdbserver: Delimit debugging output for readability Message-ID: <20140117023955.GU4762@adacore.com> References: <52B1842F.5020401@redhat.com> <21205.55987.69477.892571@ruffy.mtv.corp.google.com> <52D826DF.4000505@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-01/txt/msg00665.txt.bz2 > >> if (debug_threads) > >> - fprintf (stderr, "stop pc is %08lx\n", pc); > >> + debug_printf ("stop pc is %08lx\n", pc); > >> return pc; > > > > IWBN to move "if (debug_threads)" into debug_printf too. > > I thought of that, but there are times when you want to check > debug_threads before calling debug_printf. I used to think the same way as Yao. But I think the pattern that has been followed pretty consistently is the one above. I've seen also emails or articles (I can't remember which), which justify the use of the current pattern. From memory, you're saving a function call, the string formatting, and also, if you need to call functions with side-effects, you're saving that too. It doesn't sound like it is all such a big problem, but I think it's significant enough that we want to continue with our currently established pattern. Some units have dealt with that issue by defining a macro expanding to "if (debug_[...]) call_debug_trace_fun ([...]);". As Doug suggested, maybe for a followup patch, for those interested. -- Joel