This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] new command: 'dump' a region of memory in ascii and hex


> Date: Wed, 22 Nov 2000 15:21:39 -0800
> From: David Whedon <dwhedon@gordian.com>
> 
> 2. I sort of like the "Dumping from . . ." that Eli suggested, but I think it
> looks bad when you are only dumping 16 or so bytes:
> (top-gdb) x /r main
> Dumping from 0x806bf08 <main> to 0x806bf09 <main+1>
> <main>:
> 0x806bf08:  5589e583 ec188b45 088b550c 8945f88d U......E..U..E..
> End of dump from 0x806bf08 <main> to 0x806bf09 <main+1>
> (top-gdb)
> It looks good for the larger dumps.  One option is to make the header/footer
> conditional on the size of the dump.  That is what I have now, though it feels
> somewhat bad, arbitrary, questionable.

How about the following strategy:

  - always print the first "Dumping from... to..." line;

  - if the dump takes more than a screenful, print the trailing "End
    of dump from... to..." line as well.

> 3. Now that 'dump' is integrated with the examine ('x') command I wanted to do
> something with the size letters.  I decided to make the size letters control
> where I put spaces in the output.
> (top-gdb) x /r main
> <main>:
> 0x806bf08:  5589e583 ec188b45 088b550c 8945f88d U......E..U..E..
> (top-gdb) x /br main
> <main>:
> 0x806bf08:  55 89 e5 83 ec 18 8b 45 08 8b 55 0c 89 45 f8 8d U......E..U..E..
> (top-gdb) 
> That looks nice, might be easier to understand, but it might be confusing if the
> user is expecting the command to be taking endianess into account.

Hmm... this begins to creep into a full-fledged emulation of the GNU
`od'...  Not necessarily a bad thing, but perhaps you should take the
various options from `od' as well?

> --- doc/gdb.texinfo.orig	Wed Nov 22 14:34:16 2000
> +++ doc/gdb.texinfo	Wed Nov 22 14:45:02 2000

If and when the change to the sources is approved, the docs changes
are approved as well, provided that you take care of these minor
gotchas:

> -The repeat count is a decimal integer; the default is 1.  It specifies
> -how much memory (counting by units @var{u}) to display.
> +The repeat count is a decimal integer.  It specifies
> +how much memory (counting by units @var{u}) to display. Each time you use @code{x} the default repeat count is updated.

Please make sure there are two spaces after each period which ends a
sentence.

> -@samp{s} (null-terminated string), or @samp{i} (machine instruction).
> +@samp{r} (raw, displays hex and ascii dump), @samp{s} (null-terminated string), or @samp{i} (machine instruction).

"ascii" should be written as "@sc{ascii}", to generate small caps in
the printed version (and ordinary caps in the Info version).

Also, please add index entries here, like this:

  @cindex hex dump
  @cindex dumping memory contents

I would also suggest to provide an example of a display generated by
"x/r", to make the point more clear.

Thanks!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]