Debugging rust code

SOLVED:
Im using arm-none-eabi-gdb for debugging a microcontroller,
Without debugging symbols or file i can write to any address but with it im getting attempt to take content of non pointer value. How can write to any address? I tried to search for docs but got overwhelmed by either rust-gdb or arm-none-eabi-gdb without rust

You need to cast the address to a pointer first. If gdb detects that you are using rust, that will be something like p *(0xdeadbeef as *const u16) to read a 16bit unsigned integer at 0xdeadbeef. And p *(0xdeadbeef as *mut u64) = 42 to write the 64bit unsigned integer 42 to 0xdeadbeef.

2 Likes