chuanqi.xcq via llvm-dev
2021-May-27 11:11 UTC
[llvm-dev] How to handle DWARF Missing due to function elimination?
Hi, Recently I met a problem incurred by DWARF Missing. Simply, if a function gets inlined to a call site, the dwarf infomation for the call site maybe: ``` DW_TAG_inlined_subroutine: DW_AT_abstract_origin (0x0123456) ``` The gdb would blame when it finds 0x0123456 doesn't refer to any functions in dwarf format. From my point of view, the reason there is unexist DW_AT_abstract_origin is due to function elimination. For example, ``` static void foo() { ... } // only used by bar void bar() { foo(); } ``` After foo gets inlined to bar, there is no user of foo. So the compiler could and should remove foo. However, the compiler removes the debug info of foo, so the callsite in bar can't find definition of foo in the current module. There is a brief introduction. I met this problem in ThinLTO. But I believe the function elimination should be the root cause. I am not sure if this is a bug about compiler or about the debugger. For example, the debugger should emit a warning instead of crashing. It affects how should solve this problem. I made a copy to some people who are familiar with debug info to my knowledge. If this is not polite and disturbing, just inform me. Thanks, Chuanqi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210527/8f8634ca/attachment.html>
Jeremy Morse via llvm-dev
2021-May-27 11:47 UTC
[llvm-dev] How to handle DWARF Missing due to function elimination?
Hi Chuanqi, On Thu, May 27, 2021 at 12:11 PM chuanqi.xcq <yedeng.yd at linux.alibaba.com> wrote:> The gdb would blame when it finds 0x0123456 doesn't refer to any functions in dwarf format.This is really interesting -- if you run "llvm-dwarfdump -verify" on the output file, does it too complain about an invalid DIE reference? There's a known issue with very complicated LTO builds that causes something similar: https://bugs.llvm.org/show_bug.cgi?id=48790 Reverting 93592b726c7 locally will tell you whether it's that or not. -- Thanks, Jeremy