From: "André Pönitz" <apoenitz@trolltech.com>
To: gdb@sourceware.org
Subject: Re: Quoting and the expr parser
Date: Wed, 06 Aug 2008 07:03:00 -0000 [thread overview]
Message-ID: <200808060905.26995.apoenitz@trolltech.com> (raw)
In-Reply-To: <200808051945.m75Jj0qD013712@brahms.sibelius.xs4all.nl>
On Tuesday 05 August 2008 21:45:00 Mark Kettenis wrote:
> > Date: Tue, 05 Aug 2008 12:24:04 -0700
> > From: Keith Seitz <keiths@redhat.com>
> >
> > Hi,
> >
> > I have a simple question:
> >
> > Why must one type "my_class::'operator+'" instead of simply
> > "my_class::operator+"?
> >
> > *Should* gdb accept the latter; after all, it's not ambiguous (assuming
> > it's not overloaded).
>
> 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
> 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
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é
PS: As usual: These are my opinions, not the company's.
next prev parent reply other threads:[~2008-08-06 7:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 19:25 Keith Seitz
2008-08-05 19:46 ` Mark Kettenis
2008-08-06 7:03 ` André Pönitz [this message]
2008-08-05 20:22 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808060905.26995.apoenitz@trolltech.com \
--to=apoenitz@trolltech.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox