Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: Michael Eager <eager@eagercon.com>
Cc: gdb@sources.redhat.com
Subject: Re: Non-uniform address spaces
Date: Mon, 25 Jun 2007 22:23:00 -0000	[thread overview]
Message-ID: <m3ejjz65co.fsf@codesourcery.com> (raw)
In-Reply-To: <46801FDD.4020408@eagercon.com> (Michael Eager's message of "Mon, 25 Jun 2007 13:04:45 -0700")


Michael Eager <eager@eagercon.com> writes:
> For an example, the SPEs in a Cell processors could be configured
> to distribute pieces of an array over different SPEs.
>
>> How do you declare such an array?  How do you index it?  What code is
>> generated for an array access?  How does it relate to C's rules for
>> pointer arithmetic?
>
> In UPC (a parallel extension to C) there is a new attribute "shared"
> which says that data is (potentially) distributed across multiple processors.
>
> In UPC, pointer arithmetic works exactly the same as in C: you can
> compare pointers, subtract them to get a difference, and add integers.
> The compiler generates code which does the correct computation.

All right.  Certainly pointer arithmetic and array indexing need to be
fixed to handle such arrays.  Support for such a system will entail
having the compiler describe to GDB how to index these things, and
having GDB understand those descriptions.  

If those were fixed, how do the other CORE_ADDR uses look to you?
Say, in the frame code?  Or the symtab code?

> The C standard doesn't require objects to be contiguous or to be
> stored entirely in a single memory space.

Actually, my mentioning the C standard there was a red herring; we're
talking about how CORE_ADDR is used in GDB, and CORE_ADDR has no
necessary relation to anything in the C standard.

But just for the murky glory of language lawyering: it seems to me
that the standard does require objects to be contiguous.  6.2.4
para. 20:

  Any number of derived types can be constructed from the object,
  function, and incomplete types, as follows:

  — An array type describes a contiguously allocated nonempty set of
    objects with a particular member object type, called the element
    type.

And 6.3.2.3, para. 7:

  A pointer to an object or incomplete type may be converted to a
  pointer to a different object or incomplete type. ... When a pointer
  to an object is converted to a pointer to a character type, the
  result points to the lowest addressed byte of the object. Successive
  increments of the result, up to the size of the object, yield
  pointers to the remaining bytes of the object.

Now, the implementation could do all sorts of magic under the covers
that takes these apparently contiguous objects and scatters them
around memory in some useful way.  And that lower level is exactly the
level at which CORE_ADDR operates, so your point stands.


  reply	other threads:[~2007-06-25 22:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-23 16:31 Michael Eager
2007-06-23 21:25 ` Daniel Jacobowitz
2007-06-23 21:47   ` Michael Eager
2007-06-23 23:09     ` Daniel Jacobowitz
2007-06-25 17:46     ` Jim Blandy
2007-06-25 18:08       ` Michael Eager
2007-06-25 19:05         ` Jim Blandy
2007-06-25 19:09           ` Daniel Jacobowitz
2007-06-25 20:04           ` Michael Eager
2007-06-25 22:23             ` Jim Blandy [this message]
2007-06-25 22:55               ` Michael Eager
2007-06-25 23:08                 ` basic gdb usage question Matt Funk
     [not found]                   ` <655C3D4066B7954481633935A40BB36F041415@ussunex02.svl.access-company.com>
2007-06-25 23:36                     ` Matt Funk
2007-06-26  1:25                       ` Michael Eager
2007-06-26  3:12                   ` Eli Zaretskii
2007-06-26 16:13                     ` Matt Funk
2007-06-27  3:29                       ` Eli Zaretskii
2007-06-26 16:56                 ` Non-uniform address spaces Jim Blandy
2007-06-26 17:22                   ` Michael Eager
2007-06-26 17:55                     ` Jim Blandy
2007-06-26 18:08                     ` Jim Blandy
2007-06-26 23:08                       ` Michael Eager
2007-06-26 23:39                         ` 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=m3ejjz65co.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=eager@eagercon.com \
    --cc=gdb@sources.redhat.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