GDB doesn't find rust-src files

Hey there,
I am currently working through the Embedded Rust Discovery book and today I encountered a rather mysterious error:
When launching GDB, after trying to connect to remote target (when gdb tries to read the current location), sometimes I get an error as follows:

0x080006c4 in core::ptr::write (dst=0x1, src=268443520)
    at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ptr/
/rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/libcore/ptr/ No such file or directory.

I had a similar error earlier where libcore/iter/ couldn't be found after introducing a for _ in 0..n. What confuses me the most is that before this addition, it compiled and worked perfectly fine, despite there being a for _ in 0..8 loop already.

I checked that the elf is generated with debug info. Then I tried updating rust via rustup and afterwards it compiled again, so I thought it was just a bug and hopefully fixed now, but here I am again with it.

To me it seems like sometimes gdb doesn't know where rust-src is located, while on seemingly unrelated other occasions it knows.

Does any of you have any idea what could cause this error / what can be done to avoid it?

Thanks in advance, Anton

Edit: Versions

arm-none-eabi-gdb: 9.1
rust toolchain: stable-x86_64-unknown-linux-gnu
rust target: thumbv7em-none-eabihf

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.