Hi,
Can you can tell me the GDB command to do following:
1. Read a register
2. Read a memory location
3. Write a register
4. Write a memory location
It would so nice if you could help me!
thanks,
mudassir.
I don't know about registers, but you can probably read a memory address by converting a numerical value (the address) to whatever type you want to print. For example:
print ((int*)1234)
should print the integer stored at address 1234.
I'm not sure about writing, I've never tried it. I'm assuming the gdb documentation would give more information on this, if it's possible.
hello,
I don't know for sure but i think it is not working. This happens when i want to read location 0x01008844:
(gdb) print ((int*)0x01008844)
$3 = (int *) 0x1008844
thanks,
mudassir.
No, sorry i got that; i need to dereference it. thanks.
Can anyone tell me how to read/write registers??
regards,
mudassir.
Hi,
I got the answer of how to read/write registers. i am writing it here for anyone else's use. it is as follows
to read:
gdb> print $<register name>
e.g:
gdb> print $PC
and to write
gdb> print $<register name>=<value>
e.g:
gdb> print $PC=0x01000ffc4
But i am still interesting in knowing, how to read a chunk of memory say 100 bytes. I should specify a range with address somewhere.
thanks,
mudassir shabbir.
See my post on using gdb, the last entry (at present) is about examining memory:
http://www.gammon.com.au/forum/?id=3653