public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* simplistic examine command
@ 2007-08-02 23:51 Andrew Cagney
  0 siblings, 0 replies; only message in thread
From: Andrew Cagney @ 2007-08-02 23:51 UTC (permalink / raw)
  To: frysk

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-02 23:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-02 23:51 simplistic examine command 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).