Forums

Writing memory with GDB.

Started by Joseph Casey February 12, 2005
Greetings.
Can I write memory locations with GDB? I have been looking through 
Debugging With GDB and a few tutorials but can't find anything - only 
how to read memory and write to variables. I am using GDB 5.1.1 for TI 
MSP430 in text mode but I expect the commands would be the same as for 
native debugging.
Help appreciated.
Joseph Casey.

Joseph Casey <joecasey@indigo.ie> wrote:
> Greetings. > Can I write memory locations with GDB?
I'm pretty sure you can. Even if it doesn't have a special command for that, something like set *((unsigned char *) 0x1234567) = 50 at the command line should always work.
> I have been looking through Debugging With GDB and a few tutorials > but can't find anything - only how to read memory and write to > variables.
To some extent, that's understandable --- GDB is a source-level debugger, mainly. I.e. if some piece of memory isn't available as some variable, then you shouldn't need to fiddle with it, because the program has no (allowed) way of accessing that memory. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.