Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
In my last question, I misunderstood how GDB interprets memory when using different formats like `x/d` and `x/1wd`. After some digging, I realized the issue was related to GDB displaying the same memory contents as both signed and unsigned integers. That cleared up the confusion about the “flipping” values.
Funny how I am facing a different issue with pointer manipulation and register inspection. Iβm debugging a simple `C` program where `$rbx` is pointing to dynamically allocated memory. Here’s the setup in my main.c file
When I inspect `$rbx` in GDB, I expect it to point to the buffer and show the correct values as `28` and `-5604` for `ptr[0]` and `ptr[1]`. When I execute these commands, I get some strange behavior which I logged in bash.txt
. Been making use of `x86-64`, `GDB version 10.1`
and `Ubuntu 20.04`as my environment
.
The values at the memory location are flipping between 28 and -5604, even though the program hasnβt modified the memory or stepped through any new instructions. Iβm not sure if this is like caching, memory alignment issues, or a problem with the heap?
main_2.cbash.txt
CONTRIBUTE TO THIS THREAD