public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@redhat.com>
To: frysk@sourceware.org
Subject: simplistic examine command
Date: Thu, 02 Aug 2007 23:51:00 -0000	[thread overview]
Message-ID: <46B26DF8.6090202@redhat.com> (raw)

FYI,

I've added a very simplistic implementation of the examine command.  My 
main purpose is to help illustrate the differences between "print" and 
"examine" by providing more concrete code.  It is far from finished (it 
should list location addresses et.al.)

The main thing to note is the implementation vis:

    Value v = <<evaluate expression>>
    ByteBuffer b = v.getLocation().getByteBuffer()
    for (int i = 0; i < b.capacity(); i++)
       print b.getByte(i)

Thus examine is about examining the value's underlying data in different 
formats, for instance, consider:

    (fhpd) print int_22
    22
    (fhpd) examine int_22
    0: 22
    1: 0
    2: 0
    3: 0

The print command, on the other hand, is much simpler.  it's 
implementation is meant to be:

    Format format = Format.???
    Value v = <<evalutate expression>>
    v.toPrint(printWriter, getMemory(), format)

For instance:

    (fhpd) print struct_s --format x
    { int a = 0x1; int b = 0x2 }

(Ok, it doesn't at present, there's some stray code to delete :-).  That 
is it always displays a value according to that value's type.  But 
possibly with the formating of fields changed slightly.

This is different to gdb's examine command which can only examine 
memory, and not arbitrary values that are possibly in memory and/or 
registers.

Andrew

                 reply	other threads:[~2007-08-02 23:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=46B26DF8.6090202@redhat.com \
    --to=cagney@redhat.com \
    --cc=frysk@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).