From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: problems with minimal symbols (without a type)
Date: Fri, 17 Nov 2017 11:32:00 -0000 [thread overview]
Message-ID: <4978e1ba-ecfe-15ad-5532-5cf543498543@redhat.com> (raw)
In-Reply-To: <20171115185204.qku477ejfyescpie@adacore.com>
On 11/15/2017 06:52 PM, Joel Brobecker wrote:
>> This is to follow usual language rules. A cast expression isn't
>> an lvalue, so you can't take its address:
>
> Ah, ok.
>
> My philosophy is been that it's OK, and sometimes good, to allow
> in the debugger something that's not allowed in the language, if
> it makes it easier for the user to do his debugging. Would allowing
> this as an extension be introducing possible confusion?
Sorry, somehow I missed this question. I agree that sometimes
extensions are OK, but IMO, they need to have some clear advantage.
Since there's a just-as-easy way to do the same thing within the
language, IMO, we shouldn't add such an extension. I think that yes,
it can introduce confusion, and I could see someone reporting a bug
if they notice "&(int)global" works.
Extending the language always has risk of conflicting with future
revisions of the language, or running into cases that we can't make
work, kind of painting ourselves into an odd corner. For example,
consider the case of the "compile" command, when we pass the
expression to a real compiler to parse. Ideally we'll teach the
gcc C/C++ frontends about all our syntax extensions somehow (e.g, behind
some special "#pragma GCC gdb_extensions" or something in the code we
hand over to the compiler), so that "compile print" can become a strict
superset of "print". IMO we'd even ditch our internal
C/C++ parser and always go via the compiler (though we're still far
from being able to do that). This extension sounds like the kind that
would run into implementation difficulties and maybe
"language-lawer-ish"-resistance in GCC.
In this case, taking the address of an rvalue expression never worked,
even with debug info for the symbol at hand, so IMO adding such
a feature would/should be considered as an orthogonal enhancement.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-11-17 11:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 1:25 Joel Brobecker
2017-11-09 10:47 ` Pedro Alves
2017-11-15 1:35 ` Joel Brobecker
2017-11-15 12:17 ` Pedro Alves
2017-11-15 18:52 ` Joel Brobecker
2017-11-17 0:51 ` Joel Brobecker
2017-11-17 11:32 ` Pedro Alves [this message]
2017-11-17 17:19 ` Joel Brobecker
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=4978e1ba-ecfe-15ad-5532-5cf543498543@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@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