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

Andrew Cagney
2001-10-02T19:09:00Z

> We're also expected to make GDB user friendly.
>>
>> In the above, if the user wanted to convert the function pointer into a
>> data pointer then they would enter:
>>
>> (@data int *)foo
>>
>> and who knows what the result would be.

Mild sarcasm :-)

> The result would be a data address corresponding to the
> code address 'foo'. For example, if code addresses have their
> 32nd bit set and data addresses do not, then the address of foo
> might be 0x80001234, and (@data int *) foo would be 0x1234.
> BTW, (int *) foo would also be 0x1234, because an int pointer
> is by default located in data space.

A specific combination of ISA and C language implementation will always
give the above meaning. However, each such combination will result in a
different behavour. On the d10v it is:

(*foo)() = 0x1234; // 0x010048d0
char *c = foo; // 0x2001234
The C language spec has nothing to say about how this should be
interpreted. As they say, ``we're making this up as we go along'' :-)

Going back to my point ``user friendly''. When, if ever, would a user
want to evaluate the expression:

(@data int *@data) func

(aka ``(int*)func'') compared to a desire to evaluate the expression:

(@code int *@data) func

(aka ``(@code int *) func'').

Andrew