On Jun 3, 2013, at 9:02 AM, "Malea, Daniel" <[email protected]> wrote:

> Hi Greg, indeed I checked the DWARF and it looks like the definition for that 
> struct is missing from the binary built with newer clang. In the non-working 
> case, the DWARF contains only a declaration:
> 
> < 1><0x00000026>    DW_TAG_structure_type
>                      DW_AT_name                  "Summarize"
>                      DW_AT_declaration           yes(1)
> 
> As opposed to the full definition in the working case (clang 3.3.1):
> 
> < 1><0x0000002d>    DW_TAG_structure_type
>                      DW_AT_name                  "Summarize"
>                      DW_AT_byte_size             0x00000008
>                      DW_AT_decl_file             0x00000001 
> /home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/rdar-9973865/main.cpp
>                      DW_AT_decl_line             0x0000000b
> < 2><0x00000035>      DW_TAG_member
>                        DW_AT_name                  "first"
>                        DW_AT_type                  <0x00000026>
>                        DW_AT_decl_file             0x00000001 
> /home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/rdar-9973865/main.cpp
>                        DW_AT_decl_line             0x0000000d
>                        DW_AT_data_member_location  DW_OP_plus_uconst 0
>                        DW_AT_accessibility         DW_ACCESS_public
> < 2><0x00000044>      DW_TAG_member
>                        DW_AT_name                  "second"
>                        DW_AT_type                  <0x00000026>
>                        DW_AT_decl_file             0x00000001 
> /home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/rdar-9973865/main.cpp
>                        DW_AT_decl_line             0x0000000e
>                        DW_AT_data_member_location  DW_OP_plus_uconst 4
>                        DW_AT_accessibility         DW_ACCESS_public
> 
> 
> So it definitely looks like a clang bug.. Do you know if there's a PR open 
> that I can cross-reference?
> 

No, this is probably a new bug. There is a lot of code in clang to limit the 
amount of debug info that gets emitted. If only a forward declaration to a 
structure is required, the debug info will often try to only emit a forward 
declaration. There are of course bugs in this. You will want to look at your 
code and seek if the structure was actually used. If the contents are used in 
functions that got compiled into the .o file, then there should be full debug 
info for it and you should file a bug. If the structure doesn't get used, you 
can't expect it to be around.

If you just want to make sure the type is there because this is for a test, you 
can force clang to include it by adding extra CFLAGS: -fno-limit-debug-info

Greg

> Thanks,
> Dan
> 
> From: Greg Clayton <[email protected]<mailto:[email protected]>>
> Date: Friday, 31 May, 2013 5:40 PM
> To: Daniel Malea <[email protected]<mailto:[email protected]>>
> Subject: Fwd: [lldb-dev] [Bug 16191] New: LLDB fails to evaluate expressions 
> that dereference a struct when inferior is built with recent Clang
> 
> Check the debug info and see if "summarize_t" or "Summarize" has a full 
> definition available in the debug info. Feel free to send me the elf file and 
> I will take a look.
> 
> Greg
> 
> 
> Begin forwarded message:
> 
> From: [email protected]<mailto:[email protected]>
> Subject: [lldb-dev] [Bug 16191] New: LLDB fails to evaluate expressions that 
> dereference a struct when inferior is built with recent Clang
> Date: May 31, 2013 1:59:32 PM PDT
> To: [email protected]<mailto:[email protected]>
> 
> Bug ID  16191<http://llvm.org/bugs/show_bug.cgi?id=16191>
> Summary LLDB fails to evaluate expressions that dereference a struct when 
> inferior is built with recent Clang
> Product lldb
> Version unspecified
> Hardware        PC
> OS      All
> Status  NEW
> Severity        normal
> Priority        P
> Component       All Bugs
> Assignee        [email protected]<mailto:[email protected]>
> Reporter        [email protected]<mailto:[email protected]>
> Classification  Unclassified
> 
> 
> Created attachment 10606<x-msg://153/attachment.cgi?id=10606> 
> [details]<x-msg://153/attachment.cgi?id=10606&action=edit>
> expression evaluation log (failing) missing struct declaration
> 
> This issue appears when using ToT Clang to build the LLDB test suite. The
> failure is reproducible in Test-rdar-9973865, either with the harness or
> manually. To reproduce with the test, do:
> 
> python dotest --executable <path-to-lldb> -p Test-rdar-9973865
> 
> To reproduce manually:
> 
> cd <lldb-dir>/test/functionalities/data-formatter/rdar-9973865
> make CC=/path/to/recent/clang
> lldb ./a.out
> (lldb) b 27
> (lldb) run
> (lldb) print *mine_ptr
> 
> Expected result: lldb prints contents of the struct.
> 
> Actual result:
> 
> error: incomplete type 'summarize_t' (aka 'Summarize') where a complete type 
> is
> required
> note: forward declaration of 'Summarize'
> error: 1 errors parsing expression
> 
> 
> However, the 'summarize_t' type is declared in the main.cpp file, but LLDB
> doesn't seem to pass this declaration on to Clang. Not sure if this is really
> an LLDB bug, or an Clang bug.
> 
> ________________________________
> You are receiving this mail because:
> 
>  *   You are the assignee for the bug.
> 
> _______________________________________________
> lldb-dev mailing list
> [email protected]<mailto:[email protected]>
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 

_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to