Why are debugging symbols lost during LLVM compilation / linking?

I wrote an LLVM transformation that basically replaces mallocs with the kind of protected mallocs and some other things.

I use clang (or llvm-gcc) to compile from a file to get a bitcode file (using the -emit-llvm option) that contains debugging information. They also contain method names, line numbers, etc.

Subsequently, I use the option to work with this bitcode file. The result is a tool bit code file containing all the relevant debugging information.

In the third and final step, since we need some runtime libraries, we link the bitcode to some other bitcode files using llvm-gcc to get the final binary.

I can’t debug this binary, because it does not contain debugging information, although all related bitcode files contained them. The only thing gdb can tell me is a function in which we are not line numbers, etc ...

I would be grateful for any tips.

+7
debugging llvm
source share
1 answer

As I understand it, you are using optimization (opt tool also optimizes code and debugging information). Maybe the missing part that you want to see when debugging is the result of optimized debugging information?

PS I would add this to the comment, but, unfortunately, I do not have 50 reputations that are necessary to add a comment.

+1
source share

All Articles