Examine C pointers with GDB
Examine C pointers with GDB
I am readying a book currently, and I am learning to examine pointers in C with GDB. In the book, when you examine the pointer, the output is as follow:
(gdb) x/xw pointer
0xbffff7e0: 0x6c6c6548
(gdb) x/s pointer
0xbffff7e0: "Hello, world!n"
(gdb)
But when I do it myself I get the following output:
(gdb) x/xw pointer
0x7ffff7de59a0 <_dl_fini>: 0xe5894855
(gdb) x/s pointer
0x7ffff7de59a0 <_dl_fini>: "UH211345AWAVAUATSH203354(L213%250177!"
My question is: Why do I get such a different output.
I know I am doing something wrong, but, what is it?
Thanks everyone.
why is this downvoted? it's a genuine question, sure, it's lacking the source code, but that's a minor edit. You could at least comment with why you downvoted
– CoffeeTableEspresso
7 hours ago
The different output is because the pointer isn't pointing where I suspect you think it should be. Without the source, this will be impossible to diagnose.
– dgnuff
7 hours ago
@CoffeeTableEspresso Yes, it's a minor edit, but could still be quite important to answer the question. I'll remove the downvote when that is fixed, since I think this question is not useful in its current state. I guess you can call it a idownvotedbecau.se/beingunresponsive
– klutt
7 hours ago
probably not initialised pointer
– P__J__
5 hours ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please add the source code.
– klutt
8 hours ago