public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Harvard Architecture issues -- addresses vs pointers
@ 2001-02-08 12:51 David Taylor
       [not found] ` <taylor@cygnus.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Taylor @ 2001-02-08 12:51 UTC (permalink / raw)
  To: gdb

I will refer to things as:

. a user address
. an internal gdb address
. a target pointer

For most targets, all three are the same thing.

GDB clearly currently distinguishes between the last two -- an
internal gdb address vs a target pointer, with the former living in a
CORE_ADDR.

I would maintain that while, long term, a user address should be
separated from the other two, that gdb does not currently do so.  And
that if you peruse the code, modulo an occassional bug, you'll become
convinced that currently, gdb treats user addresses and internal gdb
addresses as the same thing.

I feel that a user address should always mean the same thing.
And that, for example,

    x/x 0x12345678

    x/i 0x12345678

should both read the same set of bytes from the target.  That the
interpretation of 0x12345678 -- as a specific location within a
specific address space -- should not depend upon whether the user
typed /x or /i.  That it should not be the case that one returns
something from the data space and the other from the instruction
space.

Comments?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Harvard Architecture issues -- addresses vs pointers
       [not found] ` <taylor@cygnus.com>
@ 2001-02-08 13:14   ` Kevin Buettner
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2001-02-08 13:14 UTC (permalink / raw)
  To: gdb

On Feb 8,  3:50pm, David Taylor wrote:

> I feel that a user address should always mean the same thing.
> And that, for example,
> 
>     x/x 0x12345678
> 
>     x/i 0x12345678
> 
> should both read the same set of bytes from the target.  That the
> interpretation of 0x12345678 -- as a specific location within a
> specific address space -- should not depend upon whether the user
> typed /x or /i.  That it should not be the case that one returns
> something from the data space and the other from the instruction
> space.

I agree with David.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Harvard Architecture issues -- addresses vs pointers
  2001-02-08 12:51 Harvard Architecture issues -- addresses vs pointers David Taylor
       [not found] ` <taylor@cygnus.com>
@ 2001-02-08 13:21 ` Per Bothner
  2001-02-23 17:51 ` Andrew Cagney
  2 siblings, 0 replies; 4+ messages in thread
From: Per Bothner @ 2001-02-08 13:21 UTC (permalink / raw)
  To: David Taylor; +Cc: gdb

David Taylor <taylor@cygnus.com> writes:

> I feel that a user address should always mean the same thing.
> And that, for example,
> 
>     x/x 0x12345678
> 
>     x/i 0x12345678
> 
> should both read the same set of bytes from the target.

I agree.  We need soem syntax to specify address space literals.
I might suggest '@' followed by an address-space name.  (I'm
not sure if this conflicts with the array "repeat" operator.)

0x12345678@i

0x12345678@d

More generally:
        integer-expression @NAME
coerces the integer to a pointer in the named space.

This syntax could also be used for output.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Harvard Architecture issues -- addresses vs pointers
  2001-02-08 12:51 Harvard Architecture issues -- addresses vs pointers David Taylor
       [not found] ` <taylor@cygnus.com>
  2001-02-08 13:21 ` Per Bothner
@ 2001-02-23 17:51 ` Andrew Cagney
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-02-23 17:51 UTC (permalink / raw)
  To: David Taylor; +Cc: gdb

David Taylor wrote:
> 
> I will refer to things as:
> 
> . a user address
> . an internal gdb address
> . a target pointer

I'm not quite sure what a ``user address'' is.

Would it be defined as the output the user expects from a program like:

	void *v = ...;
	void (*f)() = ... ;
	long vl = v;
	long vf = f;
	printf ("vl=%ld vf=%ld\n", vl, vf);

or is it more like a user (printable) representation of a CORE_ADDR.

Thinking about the above the user would expect the GDB commands:

	set $vl = (long) v;
	set $vf = (long) f;
	print $vl, $vf

to print the same output as C code.  With commands like:

	set $v = (void*) 0x1234
	set $f = ((*)()) 0x5678
	print $f()

being similar.

	Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-02-23 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-08 12:51 Harvard Architecture issues -- addresses vs pointers David Taylor
     [not found] ` <taylor@cygnus.com>
2001-02-08 13:14   ` Kevin Buettner
2001-02-08 13:21 ` Per Bothner
2001-02-23 17:51 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).