From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17874 invoked by alias); 9 Jan 2010 15:18:10 -0000 Received: (qmail 17833 invoked by uid 22791); 9 Jan 2010 15:18:08 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS,WEIRD_QUOTING X-Spam-Check-By: sourceware.org Received: from mail-pz0-f189.google.com (HELO mail-pz0-f189.google.com) (209.85.222.189) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Jan 2010 15:18:03 +0000 Received: by pzk27 with SMTP id 27so340186pzk.12 for ; Sat, 09 Jan 2010 07:18:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.143.27.42 with SMTP id e42mr19327565wfj.220.1263050282135; Sat, 09 Jan 2010 07:18:02 -0800 (PST) In-Reply-To: <20100109105557.GA2007@adacore.com> References: <4B29018C.6060307@codesourcery.com> <4B3BEDCC.9040103@earthlink.net> <20100106075757.GF24777@adacore.com> <20100109105557.GA2007@adacore.com> From: Hui Zhu Date: Sat, 09 Jan 2010 15:18: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/msg00216.txt.bz2 Sorry Joel, I didn't write anything about the doc in prev mail because I want write a special mail for it. The current eval doesn't like shell. It just use " point out the simple st= ring. And if the string is outside out ", eval will try to convert it to val. The special chat is " and \ If want add " in string. Use \" If we want add \ in string. Use \\ For example: eval "echo \""$a++"\"" "echo \"" and "\"" is simple string. $a++ is val. I know you want eval more like a language, but we already have python support. So I suggest we use a simple eval. On Sat, Jan 9, 2010 at 18:55, Joel Brobecker wrote: >> This value will be convert to string and =A0execute_command (cmd, >> from_tty); will use it. > > Which parts of the argument will be expanded. To take another language > as an example, let's have a look at what a POSIX shell does: > > =A0 =A0 =A0 =A0echo "1 $foo 2" > > In double-quoted strings, the dollar sign has a the usual special > meaning introducing parameter expansion. As a result, if our > parameter "foo" was set to "bar", =A0the final value for the string above > would be "1 bar 2". > > What I would like from you is a formal description of what your > command does. "This value will be convert to string" is too vague. > How will the conversion be done, and which parts of the string will > be evaluated, and which parts won't? > > Intuitively, I think that you want to do the same as posix shells. > In other words, if I borrow and adjust part of the POSIX shell language > standard from the opengroup: > > | Enclosing characters in double-quotes ( "" ) shall preserve the literal > | value of all characters within the double-quotes, with the exception of > | the characters dollar sign, and backslash, as follows: > | > | $ =A0 The dollar sign shall retain its special meaning introducing > | =A0 =A0 parameter expansion > | > | \ =A0 The backslash shall retain its special meaning as an escape chara= cter > | =A0 =A0 only when followed by one of the following characters: > | > | =A0 =A0 =A0 =A0 $ =A0 " =A0 \ =A0 > > The issue I'm having, which is leading to this discussion about > the semantics of your command, is that I do not think that the > implementation that you chose follows the semantics above. > >> value_print print the value VAL in C-ish syntax on stream STREAM >> according to OPTIONS. >> But cannot find a example how to do it, could you help me with it? > > In fact, it will print the value in the syntax of the current language. > I will fix the comment. > > What you need to do, in order to convert your value into a string, > is create a memory ui_file, call value_print with your value and > the memory ui_file, and then extract the contents of your ui_file > as a string. See mem_fileopen and ui_file_xstrdup. > I got it. Thanks. Best regards, Hui