Thank you very much for the pointer! I tried to build the custom zig-specific LLDB and I hit some issues. Here is what I did:
git clone --depth=1 git@github.com:jacobly0/llvm-project.git zig-llvm-project
git checkout lldb-zig
mkdir ~/projects/zig-llvm-project-build/
cd ~/projects/zig-llvm-project-build/
cmake -B ~/projects/zig-llvm-project/llvm-build -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ~/projects/zig-llvm-project/llvm
cd ~/projects/zig-llvm-project/llvm-build
make -j4
Now, I got the following error. I’m not sure if you have ever seen the issue before?
EDIT: it seems someone else hit the same issue. I was wondering which branch and commit you get a successful compilation? I would like to have those to try again. Thank you!
In file included from /usr/include/c++/9/utility:70,
from /usr/include/c++/9/tuple:38,
from /home/zeyuanhu/projects/zig-llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:20,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/include/lldb/Utility/ConstString.h:12,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/ZigValue.h:12,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.h:12,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:9:
/usr/include/c++/9/bits/stl_pair.h: In instantiation of ‘struct std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE>’:
/usr/include/c++/9/ext/aligned_buffer.h:91:28: required from ‘struct __gnu_cxx::__aligned_buffer<std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE> >’
/usr/include/c++/9/bits/hashtable_policy.h:233:43: required from ‘struct std::__detail::_Hash_node_value_base<std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE> >’
/usr/include/c++/9/bits/hashtable_policy.h:279:12: required from ‘struct std::__detail::_Hash_node<std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE>, false>’
/usr/include/c++/9/bits/hashtable_policy.h:2027:13: required from ‘struct std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE>, false> > >’
/usr/include/c++/9/bits/hashtable.h:173:11: required from ‘class std::_Hashtable<lldb_private::ZigScope*, std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE>, std::allocator<std::pair<lldb_private::ZigScope* const, lldb_private::plugin::dwarf::DWARFDIE> >, std::__detail::_Select1st, std::equal_to<lldb_private::ZigScope*>, std::hash<lldb_private::ZigScope*>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, false> >’
/usr/include/c++/9/bits/unordered_map.h:1254:18: required from ‘class std::unordered_multimap<lldb_private::ZigScope*, lldb_private::plugin::dwarf::DWARFDIE>’
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserZig.h:102:7: required from here
/usr/include/c++/9/bits/stl_pair.h:215:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
215 | _T2 second; /// @c second is a copy of the second object
| ^~~~~~
In file included from /home/zeyuanhu/projects/zig-llvm-project/lldb/include/lldb/Core/Module.h:17,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.h:14,
from /home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:9:
/home/zeyuanhu/projects/zig-llvm-project/lldb/include/lldb/Symbol/TypeSystem.h:41:7: note: forward declaration of ‘class lldb_private::plugin::dwarf::DWARFDIE’
41 | class DWARFDIE;
| ^~~~~~~~
[ 82%] Building CXX object lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/GISel/X86LegalizerInfo.cpp.o
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In function ‘llvm::Align MaxIntAlignment(lldb_private::ArchSpec)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:1030:1: warning: control reaches end of non-void function [-Wreturn-type]
1030 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual bool lldb_private::TypeSystemZig::IsAggregateType(lldb::opaque_compiler_type_t)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2256:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
2256 | switch (llvm::cast<ZigPointerType>(zig_type)->GetSize()) {
| ^~~~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2264:3: note: here
2264 | case ZigValue::Kind::OptionalType:
| ^~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2276:1: warning: control reaches end of non-void function [-Wreturn-type]
2276 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual bool lldb_private::TypeSystemZig::IsScalarType(lldb::opaque_compiler_type_t)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2509:1: warning: control reaches end of non-void function [-Wreturn-type]
2509 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual uint32_t lldb_private::TypeSystemZig::GetTypeInfo(lldb::opaque_compiler_type_t, lldb_private::CompilerType*)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2616:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
2616 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2618:3: note: here
2618 | case ZigValue::Kind::ArrayType:
| ^~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2636:1: warning: control reaches end of non-void function [-Wreturn-type]
2636 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual lldb::TypeClass lldb_private::TypeSystemZig::GetTypeClass(lldb::opaque_compiler_type_t)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2683:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
2683 | switch (llvm::cast<ZigPointerType>(zig_type)->GetSize()) {
| ^~~~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2691:3: note: here
2691 | case ZigValue::Kind::ArrayType:
| ^~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:2710:1: warning: control reaches end of non-void function [-Wreturn-type]
2710 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual lldb::Encoding lldb_private::TypeSystemZig::GetEncoding(lldb::opaque_compiler_type_t, uint64_t&)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:3064:1: warning: control reaches end of non-void function [-Wreturn-type]
3064 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘virtual lldb::Format lldb_private::TypeSystemZig::GetFormat(lldb::opaque_compiler_type_t)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:3136:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
3136 | switch (llvm::cast<ZigPointerType>(zig_type)->GetSize()) {
| ^~~~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:3144:3: note: here
3144 | case ZigValue::Kind::ErrorSetType:
| ^~~~
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:3149:1: warning: control reaches end of non-void function [-Wreturn-type]
3149 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘bool lldb_private::TypeSystemZig::DumpValue(lldb_private::ZigValue*, lldb_private::Stream&)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:4135:1: warning: control reaches end of non-void function [-Wreturn-type]
4135 | }
| ^
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp: In member function ‘bool lldb_private::TypeSystemZig::DumpTypeDecl(lldb::opaque_compiler_type_t, lldb_private::Stream&)’:
/home/zeyuanhu/projects/zig-llvm-project/lldb/source/Plugins/TypeSystem/Zig/TypeSystemZig.cpp:4395:1: warning: control reaches end of non-void function [-Wreturn-type]
4395 | }
| ^
make[2]: *** [tools/lldb/source/Plugins/TypeSystem/Zig/CMakeFiles/lldbPluginTypeSystemZig.dir/build.make:79: tools/lldb/source/Plugins/TypeSystem/Zig/CMakeFiles/lldbPluginTypeSystemZig.dir/TypeSystemZig.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:153611: tools/lldb/source/Plugins/TypeSystem/Zig/CMakeFiles/lldbPluginTypeSystemZig.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 82%] Building CXX object lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/GISel/X86RegisterBankInfo.cpp.o
[ 82%] Linking CXX static library ../../libLLVMX86CodeGen.a
[ 82%] Built target LLVMX86CodeGen
make: *** [Makefile:156: all] Error 2