From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org, Phil Muldoon <pmuldoon@redhat.com>
Subject: Re: [obv] compile-print.exp: xfail->kfail for '@' GDB array operator
Date: Fri, 05 Jun 2015 12:40:00 -0000 [thread overview]
Message-ID: <20150605124035.GA1995@host1.jankratochvil.net> (raw)
In-Reply-To: <86d21ao5vw.fsf@gmail.com>
On Fri, 05 Jun 2015 11:34:43 +0200, Yao Qi wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> > Patch implementing '@' GDB array operator in GCC has been rejected:
> > https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00414.html
> > and so there is now a GDB tracker to implement it just in GDB:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=18489
>
> If '@' is rejected in GCC, why do we need to support it in "compile"
> feature in GDB? The manual of command "compile print" says:
>
> Compile and execute expr with the compiler language found as the
> current language in GDB
>
> '@' isn't a valid operator for C language, we should emit error here.
'compile print' should one day replace the standard 'print' command, like in
LLDB. Otherwise 'compile print' makes no sense.
Now we can argue whether the '@' GDB operator is useful or not but I think
majority of GDB users considers it as useful.
Whether the manual wording is right or not is up to Eli.
> IMO, "compile" feature should *only* accept valid source code according
> to the language spec and the compiler.
GDB 'compile print' should ideally accept all the features of GDB 'print'
command. There is an internal TODO list:
------------------------------------------------------------------------------
* Add some gdb extensions to the GCC C parser.
* "@" could be handled by having it create a new array
* Convenience variables could be handled with perhaps some difficulty
* Hack the parser to recognize them and call into gdb
* Use copy-in/copy-out semantics as we do for registers
* Use the variable value's current type and recompile the expression when the type changes (even trickier than it seems because the variable can be reassigned from inside the code)
* Convenience functions are much harder. Maybe they could be done by annotating them with type information and then arranging for call-backs to gdb. It's likely that this isn't worth the effort; perhaps better would be to expose interesting and relevant gdb state to the compiled expressions somehow
* "::" could be handled by hacking the parser
* gdb's extended "." could also probably be handled
* Not sure if the two {...} extensions are doable or not -- would need research to see if they introduce ambiguous parses. These are:
* you can use {...} to make an array:
(gdb) print {1,2,3,4}
(gdb) ptype {1,2,3,4}
type = int [4]
* the cast-like '{int} foo'
------------------------------------------------------------------------------
These GDB operators (currently only '@') probably should not be supported by
'compile code' / 'compile file'.
> It will be really confusing if we add some other things (like '@' in this
> case) which is out of the scope of the language.
So why were these operators added to the GDB expression evaluator in the first
place?
> > - xfail "$test (gcc does not support '@')"
> > + kfail compile/18489 "$test"
>
> I think xfail is correct as gcc doesn't support '@'.
This does not match the original plan of the 'compile' project.
Jan
next prev parent reply other threads:[~2015-06-05 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 19:38 Jan Kratochvil
2015-06-05 9:35 ` Yao Qi
2015-06-05 12:40 ` Jan Kratochvil [this message]
2015-06-05 15:19 ` Doug Evans
2015-06-05 15:26 ` Jan Kratochvil
2015-06-05 16:13 ` Yao Qi
2015-06-05 21:23 ` Jan Kratochvil
2015-06-05 13:24 ` Jan Kratochvil
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=20150605124035.GA1995@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.com \
--cc=qiyaoltc@gmail.com \
/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