This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB command to write to memory


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".




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]