[lldb-dev] one more bug in evaluation

dawn at burble.org dawn at burble.org
Mon Oct 17 16:01:04 PDT 2011


Looks like I might have to eat my words - the narrowed test case
(attached) compiles in Bcc and Comeau, so now it's looking like a bug
in Gcc!

Gcc complains about ClangNamespaceDecl being an incomplete type, which
it is.  I'll submit a patch which includes ClangNamespaceDecl.h to work
around this.

-Dawn

On Fri, Oct 14, 2011 at 08:27:57PM -0700, dawn at burble.org wrote:
> I've narrowed the breakage down to svn rev 141748 of 
> include/lldb/Symbol/ClangASTImporter.h
> and these lines which I've ifdef'ed out in my local copy:
> 
> Index: include/lldb/Symbol/ClangASTImporter.h
> ===================================================================
> --- include/lldb/Symbol/ClangASTImporter.h      (revision 142029)
> +++ include/lldb/Symbol/ClangASTImporter.h      (working copy)
> @@ -159,9 +159,12 @@
>              return DeclOrigin();
>      }
> 
> +#define LLDB_NO_NAMESPACE_META_MAP
> +#ifndef LLDB_NO_NAMESPACE_META_MAP
>      typedef std::map <const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap;
> 
>      NamespaceMetaMap    m_namespace_maps;
> +#endif
>      clang::FileManager  m_file_manager;
>      clang::ASTContext  *m_target_ctx;
>      MinionMap           m_minions;
> 
> I'm assuming you folks are building with the clang-based FE shipped with XCode
> 4.* yes?  I haven't determined for a fact that clang (or its associated header
> files) is at fault here, but given the choice between believing clang (+lib) or
> gcc 4.5.1, I'd tend to bet on gcc (and I'll happily eat those words if I'm
> wrong!).  Just what standard library are you folks using anyway?
> 
> Sorry I haven't had time to track this down any further... 
> 
> -Dawn
> 
> 
> On Fri, Oct 14, 2011 at 11:12:07AM -0700, dawn at burble.org wrote:
> > With these fixes to source/Expression, I'm now getting this error
> > when building with gcc 4.5.1:
> > 
> > make[4]: Entering directory `/home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression'
> > llvm[4]: Compiling ClangASTSource.cpp for Debug+Asserts build
> > In file included from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/utility:71:0,
> >                  from /home/dawn/dev/llvm_svnRlldb/include/llvm/ADT/StringRef.h:15,
> >                  from /home/dawn/dev/llvm_svnRlldb/include/llvm/ADT/StringMap.h:17,
> >                  from /home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression/../../../clang/include/clang/Basic/IdentifierTable.h:21,
> >                  from /home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression/../../../clang/include/clang/AST/ASTContext.h:18,
> >                  from ClangASTSource.cpp:11:
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_pair.h: In instantiation of 'std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl>':
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_tree.h:383:2:   instantiated from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_destroy_node(std::_Rb_tree_node<_Val>*) [with _Key = const clang::NamespaceDecl*, _Val = std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > >, _KeyOfValue = std::_Select1st<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >, _Compare = std::less<const clang::NamespaceDecl*>, _Alloc = std::allocator<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >, std::_Rb_tree_node<_Val>* = std::_Rb_tree_!
>  no!
> >  de<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >*]'
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_tree.h:990:4:   instantiated from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree_node<_Val>*) [with _Key = const clang::NamespaceDecl*, _Val = std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > >, _KeyOfValue = std::_Select1st<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >, _Compare = std::less<const clang::NamespaceDecl*>, _Alloc = std::allocator<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >, std::_Rb_tree_node<_Val>* = std::_Rb_tree_node<st!
>  d:!
> >  :pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >*]'
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_tree.h:614:9:   instantiated from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = const clang::NamespaceDecl*, _Val = std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > >, _KeyOfValue = std::_Select1st<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >, _Compare = std::less<const clang::NamespaceDecl*>, _Alloc = std::allocator<std::pair<const clang::NamespaceDecl* const, lldb_private::SharingPtr<std::vector<std::pair<lldb_private::IntrusiveSharingPtr<lldb_private::Module>, lldb_private::ClangNamespaceDecl> > > > >]'
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_map.h:87:5:   instantiated from here
> > /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/stl_pair.h:77:11: error: 'std::pair<_T1, _T2>::second' has incomplete type
> > /home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression/../../include/lldb/lldb-forward.h:45:9: error: forward declaration of 'struct lldb_private::ClangNamespaceDecl'
> > /bin/rm: cannot remove `/home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression/Debug+Asserts/ClangASTSource.d.tmp': No such file or directory
> > make[4]: *** [/home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression/Debug+Asserts/ClangASTSource.o] Error 1
> > make[4]: Leaving directory `/home/dawn/dev/llvm_svnRlldb/tools/lldb/source/Expression'
> > make[3]: *** [all] Error 1
> > make[3]: Leaving directory `/home/dawn/dev/llvm_svnRlldb/tools/lldb/source'
> > make[2]: *** [all] Error 1
> > make[2]: Leaving directory `/home/dawn/dev/llvm_svnRlldb/tools/lldb'
> > make[1]: *** [all] Error 1
> > make[1]: Leaving directory `/home/dawn/dev/llvm_svnRlldb/tools'
> > make: *** [all] Error 1
> > 
> > I guess clang didn't catch this?
> > 
> > -Dawn
> > 
> > On Fri, Oct 14, 2011 at 12:05:17PM +0400, Zajac wrote:
> > > Greg, it is a regular ivar. There is no even property defined for this. It's declared in @interface section.
> > > How can I help you to localize the issue? Today I'll try to reproduce the problem with latest source and let you know if it still happen.
> > > 
> > > 14.10.2011, ? 10:03, Greg Clayton ???????(?):
> > > 
> > > > Until recently we didn't get any information about properties in the debug info, so we were unable to show those at all. Is the ivar you are missing a property? Normal ivars that are declared in the header file (not in the nameless category in the .m file) should show up as expected. 
> > > > 
> > > > Newer clang compilers now emit enough debug information for us to support properties but we haven't gotten the support added for those yet.
> > > > 
> > > > If you just have a normal ivar, then be sure to check in your "object" is valid.
> > > > 
> > > > On Oct 13, 2011, at 8:09 PM, Andrey Zaytsev wrote:
> > > > 
> > > >> Hello everyone. Maybe it's fixed already but here is what i found:
> > > >> I have some objective C object with ivars. But expression "object->myIVar" can't be evaluated. It says "MyObject doesn't a member named 'myIVar'; did you mean myIVar?".
> > > >> Thank you for consideration.
> > > >> 
> > > >> lldb-76
> > > >> Xcode 4.2
> > > >> OSX 10.6 
> > > >> _______________________________________________
> > > >> lldb-dev mailing list
> > > >> lldb-dev at cs.uiuc.edu
> > > >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> > > > 
> > > 
> > > 
> > > _______________________________________________
> > > lldb-dev mailing list
> > > lldb-dev at cs.uiuc.edu
> > > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> > 
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
-------------- next part --------------
// narrowed from ClangASTImporter.h
namespace std __attribute__ ((__visibility__ ("default"))) {
  template<class _T1, class _T2>
    struct pair
    {
      _T1 first;
      _T2 second;
    };
}
namespace std __attribute__ ((__visibility__ ("default"))) {
  template <typename _Tp> class allocator;
}
namespace std __attribute__ ((__visibility__ ("default"))) {
  template<typename _Tp>
    struct less 
    {
    };
}
namespace std __attribute__ ((__visibility__ ("default"))) {
  template<typename _Tp >
    class vector 
    {
    };
}
namespace clang {
class NamespaceDecl;
}
namespace lldb_private {
class ClangNamespaceDecl;
class Module;
}
namespace lldb_private {
template<class T>
class SharingPtr
{
};
template <typename T>
class IntrusiveSharingPtr
{
};
}
namespace lldb {
        template<typename _Tp>
        struct SharedPtr
        {
            typedef lldb_private::SharingPtr<_Tp> Type;
        };
        template <typename _Tp>
        struct IntrusiveSharedPtr
        {
            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
        };
}
namespace lldb {
    typedef IntrusiveSharedPtr<lldb_private::Module>::Type ModuleSP;
}
namespace std __attribute__ ((__visibility__ ("default"))) {
  template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
            typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
    class map
    {
    public:
      typedef _Key key_type;
      typedef _Tp mapped_type;
      map();
      mapped_type&
      operator[](const key_type& __k);
    };
}
namespace lldb_private {
class ClangASTImporter
{
public:
    typedef std::vector < std::pair<lldb::ModuleSP, ClangNamespaceDecl> > NamespaceMap;
    typedef lldb::SharedPtr<NamespaceMap>::Type NamespaceMapSP;
    void RegisterNamespaceMap( // 1st param removed
	    NamespaceMapSP &namespace_map);
    typedef std::map <const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap;
    NamespaceMetaMap m_namespace_maps;
};
}

// narrowed from ClangASTImporter.cpp
using namespace lldb_private;
using namespace clang;
void
ClangASTImporter::RegisterNamespaceMap( // 1st param removed
                                       NamespaceMapSP &namespace_map)
{
    m_namespace_maps[0] = namespace_map;
}


More information about the lldb-dev mailing list