Fun with strace and the GDB Debugger
|
|
|
Comments (3)
GDB READ WRITE
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.
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.
detect memory leaks with valgrind in a shared lib
hi,
I developed a shared libarary as the end result of a c++ project.Now I need to detect the memory leaks in that shared library using valgrind.Pls anybody tell me how to do this.when I try to check the memory leaks in the source file itself I get a permission defined message(yer I tried as the root too, but again permission defined) why is this ?
Thanks
-rajika
Post a comment
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: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

It would so nice if you could help me!
thanks, mudassir.