Manipulating memory

Nick Roberts nickrob@snap.net.nz
Wed Aug 6 08:15:00 GMT 2008


 > > I have read the GDB manual, and I could not find a way to manipulate a
 > > memory, for example: set values at given address. I only found a way
 > > to view it using '-data-read-memory' command,
 > > is this true or did I miss something?
 > 
 > I'd be glad if someone had a real solution for that task, too.
 > 
 > So far I used something along the lines of
 > 
 >    call sprintf(address, "%d %s ..", token, ... )
 > 
 > to write something to target memory, but I am looking for an alternative
 > too, as this gets mis-parsed in some cases.
 > 
 > Maybe  
 > 
 >    restore filename [binary] bias start end
 > 
 > as described in section 8.16 of the manual would help, but that seems to
 > require the contents to be put in a file first. Not really convenient either.


GDB has an undocumented MI command called -data-write-memory.  I've not used it
though, and don't know if it works or does what you want.

-- 
Nick                                           http://www.inet.net.nz/~nickrob



More information about the Gdb mailing list