[Lldb-commits] [lldb] r367441 - Don't crash when pass by value struct has no definition.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 5 13:11:45 PDT 2019



> On Aug 5, 2019, at 11:54 AM, Pavel Labath <pavel at labath.sk> wrote:
> 
> On 05/08/2019 20:20, Greg Clayton via lldb-commits wrote:
>>> On Aug 5, 2019, at 11:11 AM, <paul.robinson at sony.com> <paul.robinson at sony.com> wrote:
>>> 
>>>> I also tried to obj2yaml the good DWARF and change it, but once you
>>>> add bytes all of the section sizes and offsets are off so that was
>>>> not very fruitful, so I ran into errors when trying to convert the
>>>> yaml back to and ELF file.
>>>> 
>>>> Greg
>>> 
>>> Yet another case where a "DWARF assembler" would be useful.
>> Yeah, that is why I made the DWARFGenerator class in llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp so I can hand craft DWARF where I can change offsets and move stuff around. It doesn't create an ELF file with section contents for .text or anything though.
> 
> While it definitely leaves a lot to be desired, I have found it relatively easy to take the output of "clang -S", and then tweak the generated dwarf assembly to produce the kind of output I need for testing various edge cases.
> 
> This case also does not sound particularly hard. I'd probably do it by taking one of the existing DWARF .s test files and modify it to trigger this situation. My first candidate would be lit/SymbolFile/DWARF/forward-declarations.s -- it already has a struct with a DW_AT_declaration attribute, so probably all that's needed is to add a DW_AT_calling_convention to it. The assembly is already updated to use symbolic addresses, so no manual fixups of offsets should be needed.


Great idea... I always forget about .s files. I was a able to make one from my example code when compiled with -flimit-debug-info and then add in the DW_AT_calling_convention attribute with a value of DW_CC_pass_by_value. I can crash things now so I should be able to make a test case.

Greg


More information about the lldb-commits mailing list