This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GDB command to write to memory
- From: Michael Snyder <msnyder at specifix dot com>
- To: Guillaume MENANT <guillaume dot menant at geensys dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 28 Feb 2008 11:29:16 -0800
- Subject: Re: GDB command to write to memory
- References: <15730605.post@talk.nabble.com>
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".