From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19193 invoked by alias); 6 Aug 2008 07:03:24 -0000 Received: (qmail 19176 invoked by uid 22791); 6 Aug 2008 07:03:20 -0000 X-Spam-Check-By: sourceware.org Received: from hoat.troll.no (HELO hoat.troll.no) (62.70.27.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Aug 2008 07:02:41 +0000 Received: from hoat.troll.no (tedur.troll.no [62.70.27.154]) by hoat.troll.no (Postfix) with SMTP id 9394A20BA4 for ; Wed, 6 Aug 2008 09:02:38 +0200 (CEST) Received: from gar.trolltech.de (gar.trolltech.de [10.4.0.24]) by hoat.troll.no (Postfix) with ESMTP id 7AA3920B84 for ; Wed, 6 Aug 2008 09:02:38 +0200 (CEST) From: =?utf-8?q?Andr=C3=A9_P=C3=B6nitz?= To: gdb@sourceware.org Subject: Re: Quoting and the expr parser Date: Wed, 06 Aug 2008 07:03:00 -0000 User-Agent: KMail/1.9.9 References: <4898A8D4.2040100@redhat.com> <200808051945.m75Jj0qD013712@brahms.sibelius.xs4all.nl> In-Reply-To: <200808051945.m75Jj0qD013712@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200808060905.26995.apoenitz@trolltech.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00093.txt.bz2 On Tuesday 05 August 2008 21:45:00 Mark Kettenis wrote: > > Date: Tue, 05 Aug 2008 12:24:04 -0700 > > From: Keith Seitz > >=20 > > Hi, > >=20 > > I have a simple question: > >=20 > > Why must one type "my_class::'operator+'" instead of simply > > "my_class::operator+"? > >=20 > > *Should* gdb accept the latter; after all, it's not ambiguous (assuming= =20 > > it's not overloaded). >=20 > GDB probably should accept that if the selected language is C++. The > problem though is that it is actually pretty difficult to make GDB > accept that wiouout the additional quotes. Normally a '+' sign isn't > allowed in a function name, so you'd have to teach the lexer/parser > that it is allowed but only if there the "operator" keyword is used > right in front of it. [This sounds like a one-line rule for a parser generator. But that's not the point, see below] > This is a fundamental problem with C++. It is=20 > so badly designed that it is almost impossible to write a proper > parser for it. While this seems like a good opportunity for a bit of C++ bashing I'd like to point out that the problem is _not_ a "C++ parser". The problem is "gdb cannot read back what gdb writes out", and that's a very=20 generic one, completely independent of the language. There are several places where gdb produces type information that cannot be easily handed back to gdb because it needs to be quoted in order to survive the gdb CLI parsing. Now quoting would be not a problem if there were rules for it. Unfortunately, for gdb the quoting rules are far from obvious, let alone from being documented. It would be _so easy_ if there were a 'replace x by \x' or 'put quotes around it' or even 'encode it in base64' or 'only use mangled names'. Andr=C3=A9=20 PS: As usual: These are my opinions, not the company's.