Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB command to write to memory
@ 2008-02-28  8:31 Guillaume MENANT
  2008-02-28  9:42 ` Guillaume MENANT
  2008-02-28 19:36 ` Michael Snyder
  0 siblings, 2 replies; 4+ messages in thread
From: Guillaume MENANT @ 2008-02-28  8:31 UTC (permalink / raw)
  To: gdb


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.

Thanks
-- 
View this message in context: http://www.nabble.com/GDB-command-to-write-to-memory-tp15730605p15730605.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB command to write to memory
  2008-02-28  8:31 GDB command to write to memory Guillaume MENANT
@ 2008-02-28  9:42 ` Guillaume MENANT
  2008-02-28 15:57   ` Andreas Schwab
  2008-02-28 19:36 ` Michael Snyder
  1 sibling, 1 reply; 4+ messages in thread
From: Guillaume MENANT @ 2008-02-28  9:42 UTC (permalink / raw)
  To: gdb




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.
> 
> Thanks
> 
The only solution i've found is the "set var" command but it's limited in
use. Is there a more flexible command ?
-- 
View this message in context: http://www.nabble.com/GDB-command-to-write-to-memory-tp15730605p15731837.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB command to write to memory
  2008-02-28  9:42 ` Guillaume MENANT
@ 2008-02-28 15:57   ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2008-02-28 15:57 UTC (permalink / raw)
  To: Guillaume MENANT; +Cc: gdb

Guillaume MENANT <guillaume.menant@geensys.com> writes:

> The only solution i've found is the "set var" command but it's limited in
> use. Is there a more flexible command ?

(gdb) set {int}0xdeadbeef = 42

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB command to write to memory
  2008-02-28  8:31 GDB command to write to memory Guillaume MENANT
  2008-02-28  9:42 ` Guillaume MENANT
@ 2008-02-28 19:36 ` Michael Snyder
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2008-02-28 19:36 UTC (permalink / raw)
  To: Guillaume MENANT; +Cc: gdb

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-28 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-28  8:31 GDB command to write to memory Guillaume MENANT
2008-02-28  9:42 ` Guillaume MENANT
2008-02-28 15:57   ` Andreas Schwab
2008-02-28 19:36 ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox