This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Use watchpoint's language when re-parsing expression
- From: Tom Tromey <tom at tromey dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Thu, 18 May 2017 15:41:01 -0600
- Subject: Re: [RFA] Use watchpoint's language when re-parsing expression
- Authentication-results: sourceware.org; auth=none
- References: <20170518023916.19913-1-tom@tromey.com> <mvminky1up8.fsf@suse.de>
>>>>> "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