<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - lldb can not print anonymous structs anymore"
   href="https://bugs.llvm.org/show_bug.cgi?id=43599">43599</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb can not print anonymous structs anymore
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nat-llvmbugs@mulle-kybernetik.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22641" name="attach_22641" title="Sourcecode">attachment 22641</a> <a href="attachment.cgi?id=22641&action=edit" title="Sourcecode">[details]</a></span>
Sourcecode

Build with `clang -o foo -g -O0 foo.c.`
Then load foo into lldb and set a breakpoint on main.
Execute until printf. Now say `p x`.

You'll get ((anonymous struct)) $0 = {}

Here's some log output

lldb             FindExternalLexicalDecls[2] on (ASTContext*)0x13f1120 in ''
(CXXRecordDecl*)0x1430e48
lldb               FELD[2] Original decl (ASTContext*)0x7f9b98005b20
(Decl*)0x7f9b98047638:
lldb                 struct {
lldb                     int x;
lldb                     int y;
lldb                 }
lldb               FELD[2] Adding [to CXXRecordDecl ] lexical FieldDecl int x
lldb               FELD[2] Adding [to CXXRecordDecl ] lexical FieldDecl int y
lldb             LayoutRecordType[3] on (ASTContext*)0x13f1120 for
(RecordDecl*)0x1430e48 [name = '']
lldb             LRT[3] returned:
lldb             LRT[3]   Original = (RecordDecl*)0x7f9b98047638
lldb             LRT[3]   Size = 64
lldb             LRT[3]   Alignment = 32
lldb             LRT[3]   Fields:
lldb             LRT[3]   Bases:
lldb             EntityVariable::Dematerialize [address = 0x7ffff7fcc008,
m_variable_sp = x]
lldb             == [UserExpression::Evaluate] Execution completed normally
with result (null) ==
lldb             IRMemoryMap::Free (0x7ffff7d17000) freed
[0x7ffff7d17000..0x7ffff7d97007)
lldb             IRMemoryMap::Free (0x7ffff7fcc000) freed
[0x7ffff7fcc000..0x7ffff7fcc017)
((anonymous struct)) $1 = {}

Its puzzling, because you can see the expr is actually completing the
record_decl correctly. Bbut then llvm throws the result away in
IRForTarget::CreateResultVariable I believe, by asking the Parser, who returns
an incomplete RecordDecl ?


   304    } else {
   305      m_result_type = lldb_private::TypeFromParser(
   306          result_var->getType().getAsOpaquePtr(),
   307          lldb_private::ClangASTContext::GetASTContext(
   308              &result_decl->getASTContext()));
   309    }

The same procedure works fine with 8.0.0.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>