Advanced

GDB READ WRITE

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

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

Post a reply to this thread:

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post