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

I got curious and worked through this:

> I think the following rule is worth preserving:
> 
>   - If an expression E has some type T, then &E has type T *.
> 
> This is a fundamental operation, and choosing the wrong behavior here
> will inevitably cause troubles elsewhere, too.
> 
> Suppose you attach the qualifier to the pointer, and not the pointee.
> That is, `@code' may only be applied to pointer types, and it means
> that the pointer points to something in code space.
> 
>     Now suppose that `q' is an int living in code space.  Since
>     qualifiers apply to pointers only, q's type must be simply `int'.
>     You'd like `&q' to have the type `int * @code', but the `&' rule
>     above requires q's type must be simply `int'.  So you have to
>     break the `&' rule, or get stupid behavior.
> 
>     Also, there isn't any nice, compact way to describe what q is.
>     The best you can say is, "q is an int in code space," as I did
>     above.
> 
> Suppose, on the other hand, that you attach a space qualifier to an
> object, indicating that it lives in that space.  That is, `@code' may
> be applied to any type, and it means the object itself lives in code
> space.
> 
>     Suppose again that `q' is an int living in code space.  Since
>     qualifiers apply to objects, q's type must be `@code int'.  As
>     above, you'd like `&q' to have type `@code int *'.  (This is the
>     same type as above --- pointer to int in code space --- just
>     written according to the new syntax) And this is in fact the type
>     the `&' rule requires.  All is well.
> 
>     Also, there is a nice way to describe q.  You can simply say, "q
>     is a @code int", or "@code int q".
> 
> So the latter is what Michael proposed.

I think that there are several things kicking around here.


The syntax:

The @<region> attribute being attached to the pointee rather than 
pointer.  As you note, a syntax which attached the attribute to the 
pointer would lead to unnatural behavour in the C language.


The representation within GDB.

GDB's ``struct type'' needs to be  modified so that it includes the 
space that a pointer is designating.  Michael added it to the pointee so 
that it matched the syntax.  As a consequence, both the syntax and the 
modified type system allow the representation of meaningless types such 
as ``@code struct { @data int i; }''.

I suspect that ``struct type'' could be modified so that the address 
space attribute is stored with the pointer rather than pointee. 
However, I take it from Michael and your comments that this would lead 
to a cumbersom implementation - there is no longer a simple 1:1 mapping 
between the syntax and GDB's internal data structures.


Andrew



  parent reply	other threads:[~2001-10-10  0:16 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 [this message]
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
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=3BC3F5A3.8070005@cygnus.com \
    --to=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