* how to r/w memory
@ 2009-06-16 5:47 loody
2009-06-16 6:53 ` Paul Pluzhnikov
2009-06-16 7:40 ` André Pönitz
0 siblings, 2 replies; 5+ messages in thread
From: loody @ 2009-06-16 5:47 UTC (permalink / raw)
To: gdb
Dear all:
From the gdb document, we can use "x/nfu address" to read memory, but
how we can write it?
I have tried "x 0x80000000=0" like "p var=val" but it fail.
thanks for your help,
miloody
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to r/w memory
2009-06-16 5:47 how to r/w memory loody
@ 2009-06-16 6:53 ` Paul Pluzhnikov
2009-06-16 7:32 ` Alfred M. Szmidt
2009-06-16 7:40 ` André Pönitz
1 sibling, 1 reply; 5+ messages in thread
From: Paul Pluzhnikov @ 2009-06-16 6:53 UTC (permalink / raw)
To: loody; +Cc: gdb
On Mon, Jun 15, 2009 at 10:47 PM, loody<miloody@gmail.com> wrote:
> From the gdb document, we can use "x/nfu address" to read memory, but
> how we can write it?
I usually do:
(gdb) set *(int *)0x80000000 = 0
If GDB knows has debug info associated with the memory location,
(gdb) print var = 2
or
(gdb) set var = 3
also work for me.
If GDB knows the symbol, but doesn't have debug info for it, you'll have
to do cast again:
(gdb) set *(int *)&var = 4
Cheers,
--
Paul Pluzhnikov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to r/w memory
2009-06-16 6:53 ` Paul Pluzhnikov
@ 2009-06-16 7:32 ` Alfred M. Szmidt
0 siblings, 0 replies; 5+ messages in thread
From: Alfred M. Szmidt @ 2009-06-16 7:32 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: miloody, gdb
One can also use the `restore' command (and its friends to dump memory
regions to a file), see (gdb) Dump/Restore Files for further
information.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to r/w memory
2009-06-16 5:47 how to r/w memory loody
2009-06-16 6:53 ` Paul Pluzhnikov
@ 2009-06-16 7:40 ` André Pönitz
2009-06-16 11:25 ` loody
1 sibling, 1 reply; 5+ messages in thread
From: André Pönitz @ 2009-06-16 7:40 UTC (permalink / raw)
To: gdb
On Tuesday 16 June 2009 07:47:50 loody wrote:
> Dear all:
> From the gdb document, we can use "x/nfu address" to read memory, but
> how we can write it?
> I have tried "x 0x80000000=0" like "p var=val" but it fail.
> thanks for your help,
> miloody
I use
set {char[5]} &buffer = {65,66,67,68,69}
I am not sure it's the recommended approach but "works".
Andre'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to r/w memory
2009-06-16 7:40 ` André Pönitz
@ 2009-06-16 11:25 ` loody
0 siblings, 0 replies; 5+ messages in thread
From: loody @ 2009-06-16 11:25 UTC (permalink / raw)
Cc: gdb
Hi:
2009/6/16 André Pönitz <andre.poenitz@nokia.com>:
> On Tuesday 16 June 2009 07:47:50 loody wrote:
>> Dear all:
>> From the gdb document, we can use "x/nfu address" to read memory, but
>> how we can write it?
>> I have tried "x 0x80000000=0" like "p var=val" but it fail.
>> thanks for your help,
>> miloody
>
> I use
>
> set {char[5]} &buffer = {65,66,67,68,69}
>
> I am not sure it's the recommended approach but "works".
thanks for your help.
BTW, when checking the usage of breakpoint.
It seems 2 kinds of them, HW and SW.
What are the differences?
appreciate your help,
miloody
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-16 11:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 5:47 how to r/w memory loody
2009-06-16 6:53 ` Paul Pluzhnikov
2009-06-16 7:32 ` Alfred M. Szmidt
2009-06-16 7:40 ` André Pönitz
2009-06-16 11:25 ` loody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox