From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12272 invoked by alias); 14 Mar 2012 14:47:28 -0000 Received: (qmail 12263 invoked by uid 22791); 14 Mar 2012 14:47:27 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 14:47:13 +0000 Received: from eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id q2EEkwLI005859; Wed, 14 Mar 2012 09:47:02 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.46]) by eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) with mapi; Wed, 14 Mar 2012 10:46:43 -0400 From: Marc Khouzam To: "'Stan Shebs'" , "'Andreas Schwab'" CC: "'gdb-patches@sourceware.org'" Date: Wed, 14 Mar 2012 14:47:00 -0000 Subject: RE: [PATCH] dynamic printf Message-ID: References: <4F4DCDD5.2040807@earthlink.net> <4F5FD3A6.1090106@earthlink.net> In-Reply-To: <4F5FD3A6.1090106@earthlink.net> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes 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 X-SW-Source: 2012-03/txt/msg00478.txt.bz2 > -----Original Message----- > From: gdb-patches-owner@sourceware.org=20 > [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Stan Shebs > Sent: Tuesday, March 13, 2012 7:09 PM > To: Andreas Schwab > Cc: gdb-patches@sourceware.org > Subject: Re: [PATCH] dynamic printf >=20 > On 2/29/12 1:14 AM, Andreas Schwab wrote: > > Stan Shebs writes: > > > >> This patch implements a "dynamic printf", which is=20 > basically a breakpoint > >> with a printf;continue as its command list - but with=20 > additional features > >> that make it more interesting. > > How about: > > > > break [LOCATION] [thread THREADNUM] [if CONDITION] [printf=20 > FORMAT,ARGS...] When I tried it a while back, using a breakpoint + printf printed to the GDB console. The new dprintf has the goal of printing to the=20 inferior's console. With dprintf, the resulting printouts should look exactly the same as if the user had added the printf in the code + recompiled. Another way to achieve this may be to have a new 'inferior-printf' command similar to GDB's 'printf' then break [LOCATION] [thread THREADNUM] [if CONDITION] [inferior-printf FORMA= T,ARGS...] would work too, I think. However, one would loose the disconnected printing aspect of the feature, which also makes it much closer to actually adding a real printf in the code. > I've been wondering whether that might be a better idea. An=20 > advantage=20 > of "dprintf" for the command line is that it can abbreviate=20 > to just "dp"=20 > and tab completion works, while the optional arguments to the break=20 > command don't have any way to abbreviate (although they probably=20 > could). That's not super-compelling, as by its nature a=20 > printf command=20 > entails typing in format string, double quotes and newlines=20 > and all, and=20 > in practice I expect a lot of these will tend to accumulate=20 > in script files. >=20 > Another consideration is how the collection looks in an info break=20 > command. If dynamic prints are a different kind of=20 > breakpoint, then you=20 > can (in theory) filter the breakpoint listing to a single=20 > category, but=20 > if they are just breakpoints with special commands, they'll=20 > continue to=20 > be in the big list. >=20 > My intuition isn't giving me a strong read on which approach=20 > users will=20 > like better. As the goal is at least partly to entice=20 > printf()+recompile users into using a GDB command instead, I think it=20 > needs to be among GDB's simpler commands. Maybe include both=20 > syntaxes,=20 > mapping down to same functionality? I think those points are good. I personally don't have a strong opinion on those, since I'm looking at it from the point of view of using this feature from Eclipse. BTW, I think this is one cool feature! Marc