[ale] Q: How can I capture a binary block with emacs/gdb?

Fletch fletch at phydeaux.org
Fri Jul 9 08:25:11 EDT 2004


>>>>> "John" == John Mills <johnmills at speakeasy.net> writes:

    John> ALErs - I'm debugging a Linux application with gdb running
    John> under emacs. My application receives JPEG images that it
    John> caches in dynamically allocated storage, telling me what it
    John> got, as in: Breakpoint 2, CINet::PostImg(int, int, lbuf)
    John> (this=0x805fa00, i=7, type=2, lBuf= {len = 9685, buf =
    John> 0x80d1a08 "????"}) at INet.cpp:435

    John> I would like to write that 9685-byte block at 0x80d1a0a to a
    John> file and look at it with a JPEG viewer. I haven't been able
    John> to find a promising command combination for emacs and/or gbd
    John> to write off a binary block like that, although it seems a
    John> reasonable thing to need sometimes.

Not directly a gdb command, but if you wrote a friend dump_to_file
function that took a path as an argument you should be able to call
that from gdb interactively (friend int dump_to_file( CINet::PostImg
*); then call it with dump_to_file( this ) or the like).

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list