[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:21:12 PDT 2019

so I can crash LLDB now with:

$ clang -c main.s
$ lldb main.o
(lldb) target create "main.o"
Current executable set to 'main.o' (x86_64).
(lldb) image lookup --verbose --address 0x0000000000000008

I can make a python test that can easily do this. Is there a better way that people would prefer?

We need something that will get the function for the address and get the function's type. Doing this will cause the function type to be realized. This is the only way to get the "ByValue" type to be created since looking up the type will fail because it is a declaration, but if it is used as a parameter, it will be made.

I attached my mach-o .s files below in case anyone wants it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.s
Type: application/octet-stream
Size: 15040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190805/1d0e9e0b/attachment.obj>
-------------- next part --------------

> 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.
> pl

More information about the lldb-commits mailing list