« Return to Thread: GDB command to write to memory

Re: GDB command to write to memory

by Michael Snyder-3 :: Rate this Message:

Reply to Author | View in Thread

On Wed, 2008-02-27 at 22:38 -0800, Guillaume MENANT wrote:
> The command x is used to examine memory but i don't find the command to write
> directly a value in memory. I've tried X but it is not recognized.

There's no such command.  The general method is to use
an assignment expression.  You use a cast to determine
the size of memory (byte, word...) you want to write.

(gdb) set *(char *) 0xabcd = -1

You can do tricky things by using or omitting "signed",
and usually write up to an 8-byte word by using "long long".



 « Return to Thread: GDB command to write to memory