GDB READ WRITE

Story: Fun with strace and the GDB DebuggerTotal Replies: 1
Author Content
mudassir

Nov 07, 2006
10:16 PM EDT
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.
mudassir

Nov 07, 2006
11:07 PM EDT
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 $ e.g: gdb> print $PC

and to write gdb> print $= e.g: gdb> print $PC=0x01000ffc4

And to read write memory contents:

to read: gdb> print (*(int*)) e.g: gdb> print (*(int*)0x01000ffc4)

and to write

gdb> print (*(int*))= e.g: gdb> print (*(int*)0x01000ffc4=0x01014433 Note: memory region should be readable/writable for the purpose ofcourse!

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.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!