Re: [RFC/RFA] gdb extension for Harvard architectures

Jim Blandy
2001-10-03T15:08:00Z

Andrew Cagney <ac131313@cygnus.com> writes:
> > - If an expression E has some type T, then &E has type T *.
>
> To be pedantic:
>
> An expression E has some type T, then &E has type T *@data.
>
> It is defining a pointer from data space to either code or data
> space.

If something isn't an lvalue, the space qualifier is meaningless.

> > 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.
>
> Sorry, you've lost me. What is being discussed is the cast operator and
> its semantics. A cast takes a type and expression parameter and returns
> an expression.

That was meant to answer the following question you asked:

> The basic framework attached the segment information to the pointee
> rather than pointer. Was this an arbitrary decision or based on some
> theoretical framework.

> To the best of my knowledge, ISO C says nothing about cast operations
> that convert between code and data pointers. What we do have is a
> certain level of accepted behavour. For instance on a unified byte
> addressable address space architecture things like:
>
> sizeof(void*) == sizeof((*)())
> ((*)()) (void*) foo == ((*)()) foo
>
> However, on a harvard address space architecture we have none of that.

Right. We don't. What's your point?