Debugging a static library

I have a project, where I link a static library written in Rust to a C Porject. My target is an AURIX TC375 and I use the HighTec Rust Compiler.

I use cbindgen to generate a header file, which gets included in the C Project. It all works fine, and the project runs.

Now, I want to debug the Rust Code, but I don't have the symbols to see the code in the debugger. Right now, I'm only able to look into disassembly.

Is there any possibility to get an elf-File while building the static library, that I can include to my debugger?

A static library contains elf object files. They are not usable by a debugger though as debuggers don't know how to map back from the linked executable to the source object files. Except on macOS the linker simply doesn't provide this information.

In your case it sounds like you either didn't compile your rust static library with debuginfo enabled in the first place or the debuginfo got stripped out either during linking or afterwards. You will have to ensure that the debuginfo stays in the final executable for a debugger to be able to show source locations.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.