Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@is.elta.co.il>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: Naushit_Sakarvadia@quintum.com, gdb@sources.redhat.com
Subject: Re: 8 bit read
Date: Wed, 25 Jul 2001 01:45:00 -0000	[thread overview]
Message-ID: <Pine.SUN.3.91.1010725114619.14848E-100000@is> (raw)
In-Reply-To: <1010724211116.ZM20834@ocotillo.lan>

On Tue, 24 Jul 2001, Kevin Buettner wrote:

> > But the current API in memattr.c doesn't allow GDB applications code
> > to create memory regions except via the "mem" commands.
> 
> Can you explain in more detail?

I hope an example will have more success than my explanations until
now ;-)

During debugging a program, it is customary to do things like this:

   (gdb) p *(struct foobar *)foo

or this:

   (gdb) p/x *bar@num

This displays the contents of a structure or a portion of an array.
(There's nothing special about the particular forms of the print
command I've chosen to show here, it's just an example of examining
program's data.)

Now suppose that the variables foo and bar are outside the normal
address space used to store program's data.  In the DJGPP case, it
could be some memory on a memory-mapped device, or some DOS data
structure in conventional memory.  I cannot currently examine such
data with GDB, because the to_xfer_memory method only copies data from
and to the debugged application's normal data segment.

Suppose, however, that I could say something like this:

   (gdb) p/x *($fs:foo)@num

meaning that the array is at offset `foo' from the segment whose
selector is in the FS register.  (The syntax is not important; I'm not
saying that I care for this particular syntax.)  What would it take to
implement such a feature?

My line of thought was to have the `print' command create a memory
region descriptor which would hold the value of $fs, the selector
required to access the data, and maybe its limits.  Since the
to_xfer_memory method accepts a `struct mem_attrib' argument, it will
see that information, and will be able to DTRT.

In other words, my problem was how to pass the information about the
memory to be accessed from the GDB application level to the target
vector.  Memory attributes seemed like a perfect candidate.

However, for that, I need the `print' command to be able to create
memory regions with certain attributes, and we don't have an API for
that.  It was a small shock for me to see that the only way to create
regions is with an interactive user command, and that the only
exported programmatic interface is lookup_mem_region; I wonder why
would it make sense to limit access to memory attributes only to
looking up regions.  Perhaps I don't understand something about memory
regions.

Do I make any sense?


  reply	other threads:[~2001-07-25  1:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23  9:04 Naushit Sakarvadia
2001-07-23  9:56 ` Daniel Jacobowitz
2001-07-23 11:50 ` Andrew Cagney
2001-07-24  4:49   ` Eli Zaretskii
2001-07-24  9:25     ` Kevin Buettner
2001-07-24 11:11       ` Eli Zaretskii
2001-07-24 14:11         ` Kevin Buettner
2001-07-25  1:45           ` Eli Zaretskii [this message]
2001-07-25 11:40             ` Kevin Buettner
2001-07-25 23:39               ` Eli Zaretskii
2001-07-26  6:17                 ` Andrew Cagney
2001-07-26  6:45                   ` Eli Zaretskii
2001-07-26  6:53                     ` Andrew Cagney
2001-07-26  6:59                       ` Eli Zaretskii
2001-07-26  7:09                         ` Andrew Cagney
2001-07-26  7:01                     ` Andrew Cagney
2001-07-26  9:20                     ` Kevin Buettner
2001-07-26  9:25                       ` Eli Zaretskii

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=Pine.SUN.3.91.1010725114619.14848E-100000@is \
    --to=eliz@is.elta.co.il \
    --cc=Naushit_Sakarvadia@quintum.com \
    --cc=gdb@sources.redhat.com \
    --cc=kevinb@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