This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Use watchpoint's language when re-parsing expression


>>>>> "Andreas" == Andreas Schwab <schwab@suse.de> writes:

Andreas> On Mai 17 2017, Tom Tromey <tom@tromey.com> wrote:
>> So, in the end I made a hook to let each language choose what
>> expression to use.  I made all the languages other than Rust use the C
>> expression, because that is the status quo ante.  However, this is
>> probably not truly correct.  After this patch, at least, it is easy to
>> correct by someone who knows the language(s) in question.

Andreas> The docs say that gdb is supposed to support C style casts in every
Andreas> language.  Also, there is the {type} operator that is also supported in
Andreas> every language.

I never noticed that before.  However, I don't think it is a good reason
to reject this patch.

First, the docs are simply incorrect now, as the Rust parser doesn't
support this, and I don't think it ought to.  The docs state the
rationale for this as being the usefulness of casting -- and while it's
indeed useful, Rust already supports a syntax for this, so implementing
the C syntax additionally seems strange.

Second, while the cast is supported, nothing in the docs claims that the
prefix "*" is supported by all languages.  So, even if you accept the
cast part of the expression (which you shouldn't), the expression as a
whole is still wrong.

Finally, I'm not at all certain that C-style casts or the {type}
operator can be added to the Rust expression parser without breaking
something else.  And, that seems like a complex request just to unbreak
what amount to an implementation detail.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]