Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Quoting and the expr parser
@ 2008-08-05 19:25 Keith Seitz
  2008-08-05 19:46 ` Mark Kettenis
  2008-08-05 20:22 ` Daniel Jacobowitz
  0 siblings, 2 replies; 4+ messages in thread
From: Keith Seitz @ 2008-08-05 19:25 UTC (permalink / raw)
  To: gdb

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).

Keith


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Quoting and the expr parser
  2008-08-05 19:25 Quoting and the expr parser Keith Seitz
@ 2008-08-05 19:46 ` Mark Kettenis
  2008-08-06  7:03   ` André Pönitz
  2008-08-05 20:22 ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2008-08-05 19:46 UTC (permalink / raw)
  To: keiths; +Cc: gdb

> 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 is a fundamental problem with C++.  It is
so badly designed that it is almost impossible to write a proper
parser for it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Quoting and the expr parser
  2008-08-05 19:25 Quoting and the expr parser Keith Seitz
  2008-08-05 19:46 ` Mark Kettenis
@ 2008-08-05 20:22 ` Daniel Jacobowitz
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-08-05 20:22 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb

On Tue, Aug 05, 2008 at 12:24:04PM -0700, Keith Seitz wrote:
> 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).

Yes, it should.  This is an omission in c-exp.y; cp-name-parser.y
(not used for expressions) handles it correctly.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Quoting and the expr parser
  2008-08-05 19:46 ` Mark Kettenis
@ 2008-08-06  7:03   ` André Pönitz
  0 siblings, 0 replies; 4+ messages in thread
From: André Pönitz @ 2008-08-06  7:03 UTC (permalink / raw)
  To: gdb

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-06  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-05 19:25 Quoting and the expr parser Keith Seitz
2008-08-05 19:46 ` Mark Kettenis
2008-08-06  7:03   ` André Pönitz
2008-08-05 20:22 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox