From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Michael Snyder Cc: Jim Blandy , gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] gdb extension for Harvard architectures Date: Tue, 02 Oct 2001 19:09:00 -0000 Message-id: <3BBA72D7.30009@cygnus.com> References: <3BB4D843.A92818B9@cygnus.com> <3BB512A9.6050801@cygnus.com> <3BB5195F.6050603@cygnus.com> <3BBA2DC9.5060500@cygnus.com> <3BBA58BC.5060108@cygnus.com> <3BBA5C26.3058B1F@cygnus.com> X-SW-Source: 2001-10/msg00044.html > 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