开发者

Why are the debug symbols lost in the LLVM compile/link process?

开发者 https://www.devze.com 2022-12-21 17:35 出处:网络
I wrote an LLVM transformation that basically replaces mallocs by kind of guarded mallocs and some other stuff.

I wrote an LLVM transformation that basically replaces mallocs by kind of guarded mallocs and some other stuff.

I'm using clang (or llvm-gcc) for compiling a c file to get a bitcode file (using the -emit-llvm option) which contains debug information. These also contain method names, line numbers and so on.

Afterwards I'm using opt t开发者_StackOverflow中文版o instrument this bitcode file. The result is an instrumented bitcode file, still containing all relevant debug infos.

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

This binary I cannot debug since it doesn't contain any debug information although all linked bitcode files did contain them. The only thing gdb can tell me is in which function we are but no line numbers and so on...

I would be grateful for any hints.


As I understood you are running optimizations (opt tool optimizes the code and debug information also). So may be the missing part which you want to see when debugging is a result of optimized debug information ?

P.S. I would add this in the comment, but unfortunately I don't have 50 reputations which are needed to add a comment.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号