From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30481 invoked by alias); 10 Jan 2010 13:30:30 -0000 Received: (qmail 30466 invoked by uid 22791); 10 Jan 2010 13:30:30 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f192.google.com (HELO mail-pz0-f192.google.com) (209.85.222.192) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 10 Jan 2010 13:30:25 +0000 Received: by pzk30 with SMTP id 30so12745685pzk.24 for ; Sun, 10 Jan 2010 05:30:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.62.35 with SMTP id k35mr2766955wfa.129.1263130224074; Sun, 10 Jan 2010 05:30:24 -0800 (PST) In-Reply-To: <20100110054328.GD2007@adacore.com> References: <4B3BEDCC.9040103@earthlink.net> <20100106075757.GF24777@adacore.com> <20100109105557.GA2007@adacore.com> <20100110054328.GD2007@adacore.com> From: Hui Zhu Date: Sun, 10 Jan 2010 13:30:00 -0000 Message-ID: Subject: Re: [RFC] Let "gcore" command accept a suffix argument To: Joel Brobecker Cc: Stan Shebs , Tom Tromey , Stan Shebs , Michael Snyder , gdb-patches ml , Eli Zaretskii Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-01/txt/msg00223.txt.bz2 Thanks Joel, I think the idea that you told is very good. But I think we have know the type of the val that we want output, the string we want it as string, the number we want it to be number. Are you sure we need point out the type of val to be output? And this idea is out of my ability. Sorry about it. Best regards, Hui On Sun, Jan 10, 2010 at 13:43, Joel Brobecker wrote: > > > The current eval doesn't like shell. =A0It just use " point out the > > simple string. =A0And if the string is outside out ", eval will try to > > convert it to val. > > OK, I think I understand, now. I see pros and cons to your approach. > The approach I suggested (where we only expand convenience variables > by detecting the $ sign) is limited because it does not handle > expressions in general. =A0Your proposal, does, which is more powerful. > > If the other maintainers like your syntax, then that'll be fine with me. > > I have a counter proposal: Have eval follow the same syntax as the > printf command. =A0In other words: > > =A0 =A0(gdb) eval "gcore filename.%s.%d", suffix, $counter++ > > That way, you save yourself having to implement yet-another-parser > in GDB, however simple. All you have to do, is factorize the > printf_command implementation into a function that stores the > string in a memory ui_file, and have both printf_command and > eval_command call that function. > > And we save ourselves the trouble of have to explain the syntax > followed by the eval command, as it is identical to the syntax > used by the printf command. > > How does that sound? > > -- > Joel