This is the mail archive of the gdb@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: dump memory to file



redirect-output is a neat idea, but I think dumping a section of
target memory to a file is a different problem, and needs its
own solution.  This is particularly valuable in embedded systems,
where I can remember at least two times it would have been valuable
to me:

 1) Saving the contents of a small (512k) memory-mapped flash device
    so I could examine it and restore it if necessary.  This was
    on an os-less MIPS 3k board with GDB over RS232.
 2) Grabbing a generated jpg (jfif) image out of memory on an
    MPC823-based digital camera prototype board, to verify that
    it was valid.  Also GDB over RS232.

In both cases I hacked up something to dump the memory region out of
a second serial port and gobble up the output on the host. :P

So having a 'dump-region' command would be a nice addition to GDB,
IMO.

-Jamie


On Wed, 22 Aug 2001, Kevin Buettner wrote:

> On Aug 22, 11:00am, Grant Edwards wrote:
>
> > A while back I had asked if gdb could dump a section of target
> > memory to disk (as bin, elf, hex, whatever).  The answer at the
> > time was no -- is that still the case?  If I added such a
> > command, would it be of interest to anybody else? (IOW, should
> > I submit a patch?)
>
> I think it'd be nice to provide a more general solution.  I.e, I think
> it'd be nice if GDB had a facility whereby output from subsequent
> commands would be redirected to a file.  Maybe something along the
> following lines?
>
> (gdb) redirect-output /tmp/foo
> (gdb) x/10000x 0x01000
> (gdb) print/x $pc
> (gdb) x/100i $pc-200
> (gdb) redirect-output STDOUT
>
> And, it'd also be nice to redirect to be able to redirect to two or
> more destinations at the same time...
>
> (gdb) redirect-output /tmp/foo STDOUT
> ...
>
> Kevin


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