Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC/RFA] gdb extension for Harvard architectures
Date: Fri, 28 Sep 2001 17:15:00 -0000	[thread overview]
Message-ID: <3BB512A9.6050801@cygnus.com> (raw)
In-Reply-To: <3BB4D843.A92818B9@cygnus.com>

> This is an extension to help with debugging on Harvard architectures
> (machines with two or more address spaces, typically one for 
> instructions and one for data).  The idea here is to provide the user 
> with a mechanism for specifying the address space of a pointer or
> a raw address (eg. to display the contents of code memory as opposed
> to data memory, when the address alone is not enough to differentiate).
> 
> Rather than provide extensions for specific commands such as print
> and examine, it seemed more useful and general to provide an 
> extension to the syntax for type expressions.  Thus we can identify
> a pointer to (say) code address space by using a pointer cast, and
> that expression can be used in any command that accepts an expression.
> 
> 	(gdb) x /xb (@code short *) foo
> 	(gdb) print *(@data char *) 0x1000
> 	(gdb) set *(@code long long *) 0x1000 = 0
> 
> The idea is that the modifiers "@code" and "@data" can be used
> anywhere where it would be legal to use "const" or "volatile".
> I've used the "@" character to remove the new keywords from the
> user name space, but I'm open to discussion on that choice
> ("$" might be another possibility).
> 
> So, for instance, a (@code int *) would be a pointer to an int in
> code space, while a (int * @code) would be a pointer in code space
> to an int (presumably in data space).

The syntax feels long winded - which probably isn't unexpected.  It is 
playing around with a type system.  Shortened / abreviated forms are 
going to be useful.

I know Fche once suggested:

	x/i $code + 100

where $code designates a code base address.  I guess, using the above, 
$code would be syntatic sugar for ``(@code char *) 0'' giving ``(@code 
char *)0 + 100'' for the above.

--

Looking at the output and how it interacts.  I'll give several examples 
and possible outputs:

	(gdb) print (@data char *) 0x1000

	(@data char *) 0x1000
or 
(char *) 0x1000

	(gdb) print ((@code *)()) 0x1000
(I think)

	((@code *)()) 0x1000
or 
((*)()) 0x1000

I think in each case it should display the latter - the ``@code'' 
attribute is redundant information.  Only when the space conflicts with 
the values type should it be displayed.

--

What about expressions.

Consider
	(gdb) print (char *) function

should that return:

	(@data char *) ...
or 
(@code char *) ...





> The idea should be extendable to more address spaces (eg. if 
> there was an I/O space), and possibly also to segmented architectures.
> 
> Here's a somewhat preliminary (but buildable and working) patch:
> 
> 



  parent reply	other threads:[~2001-09-28 17:15 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-28 13:07 Michael Snyder
2001-09-28 13:50 ` Andrew Cagney
2001-10-03 10:41   ` Michael Snyder
2001-10-03 11:06     ` Daniel Jacobowitz
2001-10-03 11:12       ` Michael Snyder
2001-10-03 11:19         ` Andrew Cagney
2001-10-03 11:49           ` Michael Snyder
2001-10-03 14:38             ` Andrew Cagney
2001-10-03 14:14     ` Jim Blandy
2001-10-03 14:31       ` Andrew Cagney
2001-10-03 16:14         ` Jim Blandy
2001-10-04 11:44       ` Michael Snyder
2001-10-04 16:28         ` Jim Blandy
2001-09-28 17:15 ` Andrew Cagney [this message]
2001-09-28 17:44   ` Andrew Cagney
2001-10-02 12:59     ` Jim Blandy
2001-10-02 14:13       ` Andrew Cagney
2001-10-02 15:09         ` Michael Snyder
2001-10-02 16:58           ` Andrew Cagney
2001-10-03 10:10             ` Jim Blandy
2001-10-03 12:22               ` Andrew Cagney
2001-10-03 15:08                 ` Jim Blandy
2001-10-10  0:56                   ` Andrew Cagney
2001-10-09 23:34               ` Andrew Cagney
2001-10-10 10:53                 ` Jim Blandy
2001-10-10 11:17                   ` Andrew Cagney
2001-10-10 12:15                     ` Jim Blandy
2001-10-10 12:31                       ` Andrew Cagney
2001-10-10  0:16               ` Andrew Cagney
2001-10-03 11:11             ` Michael Snyder
2001-10-04 12:08             ` Michael Snyder
2001-10-04 13:13               ` Andrew Cagney
2001-10-08 10:36                 ` Michael Snyder
2001-10-10  1:25                   ` Andrew Cagney
2001-11-05 11:34                     ` Michael Snyder
2001-10-02 16:14         ` Jim Blandy
2001-10-02 17:16           ` Andrew Cagney
2001-10-02 17:31             ` Michael Snyder
2001-10-02 19:09               ` Andrew Cagney
2001-10-03 12:41         ` Jim Blandy
2001-10-03 12:52           ` Andrew Cagney
2001-10-03 16:13             ` Jim Blandy
2001-10-03 16:51             ` Frank Ch. Eigler
2001-10-03 10:55     ` Michael Snyder
2001-10-03 11:06       ` Andrew Cagney
2001-10-03 11:51         ` Michael Snyder
2001-10-03 12:17           ` Andrew Cagney
2001-10-03 16:54             ` Michael Snyder
2001-10-03 14:33         ` Jim Blandy
2001-10-03 14:44           ` Andrew Cagney
2001-10-03 16:17             ` Jim Blandy
2001-10-04 13:16               ` Andrew Cagney
2001-10-10  0:45               ` Andrew Cagney
2001-10-10 10:56                 ` Jim Blandy
2001-10-03 14:48           ` Andrew Cagney
2001-10-04 11:49             ` Michael Snyder
2001-10-03 10:49   ` Michael Snyder
2001-09-29  2:29 ` Eli Zaretskii
2001-10-02 19:27 ` Andrew Cagney
2001-10-03 14:04   ` 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=3BB512A9.6050801@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@cygnus.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