Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Jim Blandy <jimb@cygnus.com>, Michael Snyder <msnyder@cygnus.com>,
	gdb-patches@sources.redhat.com
Subject: Re: [RFC/RFA] gdb extension for Harvard architectures
Date: Wed, 03 Oct 2001 16:13:00 -0000	[thread overview]
Message-ID: <npwv2cmi3g.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <3BBB6C50.50207@cygnus.com>

Andrew Cagney <ac131313@cygnus.com> writes:
> > - doesn't change the meaning of any valid C expressions
> 
> Is this a valid C expression?
> 
> 	int foo();
> 	char *c = foo;
> 
> I.e. does ISO C define its semantics?

No, it's not a valid C expression.  It's a declaration, followed by a
definition with an initializer.  :)

The expression:

        (int *) &func

is a valid C expression.  Its meaning is unspecified by ISO C, but
every compiler does assign some meaning to it.  The same applies to
your example.

If I understand you correctly, you would like GDB to evaluate that
expression in a way which yields a pointer to an int in code space.
You argue that, since this expression's meaning is not fixed by the
standard, GDB is free to interpret it in whatever way is most helpful
to the user.  Is that correct?

While the expression's meaning is not fixed by the standard, the
compiler does assign some meaning to it.  I feel it is important that
GDB should produce the same value for an expression that the compiler
would.  So I feel that GDB is not, in fact, free to make the
interpretation you suggest.

You've said that the compiler's interpretation is useless.  Probably
so.  But what if the user's bug is that they have cast a function
pointer to a data pointer, and tried to use it to fetch the
instructions?  If they try their expression in GDB, they should get
the same (unexpected!) answer that GCC gives them.  This consistency
is, in fact, critical to them finding their bug!

So, what I meant by the assertion quoted by you at the top of this
message is: our proposal does not require GDB to evaluate any
expressions differently than the compiler would.  It is strictly an
extension of the language accepted by the compiler.  Your suggested
change would assign expressions like `(int *) &func' a meaning
different from the one the compiler would.  This is, to my mind, a
serious point against it.


  reply	other threads:[~2001-10-03 16:13 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-28 13:07 Michael Snyder
2001-09-28 13:50 ` Andrew Cagney
2001-10-03 10:41   ` Michael Snyder
2001-10-03 11:06     ` Daniel Jacobowitz
2001-10-03 11:12       ` Michael Snyder
2001-10-03 11:19         ` Andrew Cagney
2001-10-03 11:49           ` Michael Snyder
2001-10-03 14:38             ` Andrew Cagney
2001-10-03 14:14     ` Jim Blandy
2001-10-03 14:31       ` Andrew Cagney
2001-10-03 16:14         ` Jim Blandy
2001-10-04 11:44       ` Michael Snyder
2001-10-04 16:28         ` Jim Blandy
2001-09-28 17:15 ` Andrew Cagney
2001-09-28 17:44   ` Andrew Cagney
2001-10-02 12:59     ` Jim Blandy
2001-10-02 14:13       ` Andrew Cagney
2001-10-02 15:09         ` Michael Snyder
2001-10-02 16:58           ` Andrew Cagney
2001-10-03 10:10             ` Jim Blandy
2001-10-03 12:22               ` Andrew Cagney
2001-10-03 15:08                 ` Jim Blandy
2001-10-10  0:56                   ` Andrew Cagney
2001-10-09 23:34               ` Andrew Cagney
2001-10-10 10:53                 ` Jim Blandy
2001-10-10 11:17                   ` Andrew Cagney
2001-10-10 12:15                     ` Jim Blandy
2001-10-10 12:31                       ` Andrew Cagney
2001-10-10  0:16               ` Andrew Cagney
2001-10-03 11:11             ` Michael Snyder
2001-10-04 12:08             ` Michael Snyder
2001-10-04 13:13               ` Andrew Cagney
2001-10-08 10:36                 ` Michael Snyder
2001-10-10  1:25                   ` Andrew Cagney
2001-11-05 11:34                     ` Michael Snyder
2001-10-02 16:14         ` Jim Blandy
2001-10-02 17:16           ` Andrew Cagney
2001-10-02 17:31             ` Michael Snyder
2001-10-02 19:09               ` Andrew Cagney
2001-10-03 12:41         ` Jim Blandy
2001-10-03 12:52           ` Andrew Cagney
2001-10-03 16:13             ` Jim Blandy [this message]
2001-10-03 16:51             ` Frank Ch. Eigler
2001-10-03 10:55     ` Michael Snyder
2001-10-03 11:06       ` Andrew Cagney
2001-10-03 11:51         ` Michael Snyder
2001-10-03 12:17           ` Andrew Cagney
2001-10-03 16:54             ` Michael Snyder
2001-10-03 14:33         ` Jim Blandy
2001-10-03 14:44           ` Andrew Cagney
2001-10-03 16:17             ` Jim Blandy
2001-10-04 13:16               ` Andrew Cagney
2001-10-10  0:45               ` Andrew Cagney
2001-10-10 10:56                 ` Jim Blandy
2001-10-03 14:48           ` Andrew Cagney
2001-10-04 11:49             ` Michael Snyder
2001-10-03 10:49   ` Michael Snyder
2001-09-29  2:29 ` Eli Zaretskii
2001-10-02 19:27 ` Andrew Cagney
2001-10-03 14:04   ` Jim Blandy

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=npwv2cmi3g.fsf@zwingli.cygnus.com \
    --to=jimb@zwingli.cygnus.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@cygnus.com \
    --cc=msnyder@cygnus.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