[llvm-dev] llvm-objdump: failed to parse debug information

Fangrui Song via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 28 11:17:48 PDT 2020


On 2020-04-28, Peter Smith via llvm-dev wrote:
>> Hi,
>>
>> In a 32-bit ARM build, I am seeing the following warning (edited for
>> simplicity, I can provide full logs if necessary):
>>
>> > llvm-objdump -l -d -x file.elf
>> > llvm-objdump: warning: 'file.elf': failed to parse debug information for file.elf
>>
>>
>> All object files and static libraries seem to have debug info (i.e.,
>> llvm-objdump does not complain when run on each file individually and
>> the disassembly output shows file/line information).
>>
>> In order to identify where the ELF file is lacking debug info, I added
>> some debug traces to llvm-objdump and it seems the following symbol is
>> the culprit: __ThumbV7PILongThunk_<my_func>
>>
>> Is this expected behavior? How to fix it?
>
>It is expected that __ThumbV7PILongThunk_<my_func> has no debug information. A thunk is a linker generated code-sequence to extend the range of a branch. Usually we would want a debugger to step over these bits of code as they are largely there to bridge between functions the user wrote and are not interesting in their own right. There is also the practical consideration that there is no source code for these code-sequences; and as they are called between procedures they are limited in what state they can modify. For example a Thunk in Arm is only permitted to change the inter-procedural scratch register r12.
>
>I would be surprised if missing debug information for a thunk would cause llvm-objdump to give an error message.

The behavior was added by https://reviews.llvm.org/D62462 which intended to address https://bugs.llvm.org/show_bug.cgi?id=41905

I checked some arbitrary ARM/AArch64 programs (lld/test/ELF/*.s) with llvm-objdump -S,
`failed to parse debug information for file.elf` is very easy to trigger (when debug information is not available),
even with programs without thunks.

This seems to me that this particular needs improvement. I will look into this.

>
>> Thanks,
>> --
>>Jerome
>
>________________________________________
>From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Jerome Forissier via llvm-dev <llvm-dev at lists.llvm.org>
>Sent: 28 April 2020 15:23
>To: llvm-dev at lists.llvm.org
>Subject: [llvm-dev] llvm-objdump: failed to parse debug information
>
>Hi,
>
>In a 32-bit ARM build, I am seeing the following warning (edited for
>simplicity, I can provide full logs if necessary):
>
>> llvm-objdump -l -d -x file.elf
>> llvm-objdump: warning: 'file.elf': failed to parse debug information for file.elf
>
>
>All object files and static libraries seem to have debug info (i.e.,
>llvm-objdump does not complain when run on each file individually and
>the disassembly output shows file/line information).
>
>In order to identify where the ELF file is lacking debug info, I added
>some debug traces to llvm-objdump and it seems the following symbol is
>the culprit: __ThumbV7PILongThunk_<my_func>
>
>Is this expected behavior? How to fix it?
>
>LLVM version is llvmorg-11-init-12683-g54b3f91d205 but AFAICT anything
>above 10.0 behaves the same.
>
>Thanks,
>--
>Jerome
>_______________________________________________
>LLVM Developers mailing list
>llvm-dev at lists.llvm.org
>https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>_______________________________________________
>LLVM Developers mailing list
>llvm-dev at lists.llvm.org
>https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list