[llvm-bugs] [Bug 43599] New: lldb can not print anonymous structs anymore

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 7 17:01:25 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43599

            Bug ID: 43599
           Summary: lldb can not print anonymous structs anymore
           Product: lldb
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: nat-llvmbugs at mulle-kybernetik.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

Created attachment 22641
  --> https://bugs.llvm.org/attachment.cgi?id=22641&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191008/3c53f5c9/attachment-0001.html>


More information about the llvm-bugs mailing list