[Bug 37893] New: Unable to resolve std::vector type in gmodules build on android (linux)

Bug ID 37893
Summary Unable to resolve std::vector type in gmodules build on android (linux)
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter labath@google.com
CC llvm-bugs@lists.llvm.org

To reproduce this, create a simple c++ program with std::vector<int> (from
libc++), compile with -gmodules, and try to display the variable in the
debugger. The variable will show up as empty (no data members).

I've done a bit of digging, and it seems that the issue is that we are unable
to complete the forward-declaration of the "__vector_base" from the main file
with the full declaration in the module.

The interesting bits of dwarf are:

0x000022fd:     DW_TAG_variable
                  DW_AT_location        (DW_OP_breg13 SP+116)
                  DW_AT_name    ("numbers")
                  DW_AT_decl_file       ("main.cpp")
                  DW_AT_decl_line       (8)
                  DW_AT_type    (0x00000a1a "vector<int,
std::__ndk1::allocator<int> >")

0x00000a1a:           DW_TAG_class_type
                        DW_AT_name      ("vector<int,
std::__ndk1::allocator<int> >")
                        DW_AT_byte_size (0x0c)
                        DW_AT_decl_file ("llvm-libc++/include/vector")
                        DW_AT_decl_line (447)

0x00000a23:             DW_TAG_inheritance
                          DW_AT_type    (0x00000053 "__vector_base<int,
std::__ndk1::allocator<int> >")
                          DW_AT_data_member_location    (0x00)

0x00000053:           DW_TAG_class_type
                        DW_AT_name      ("__vector_base<int,
std::__ndk1::allocator<int> >")
                        DW_AT_declaration       (true)

The __vector_base type contains a bunch of DW_TAG_typedefs and
DW_TAG_subprograms, but no information on data members. If I open up the same
type in the std.pcm file, I can find the DW_TAG_member entries there. However,
AFAICT, lldb does not try to look for the information in that file.

I don't think this is a recent regression. It has probably been that way since
gmodules was introduced. I just ran into this now because I have started
building lldb tests with libc++, and that meant that gmodules tests actually
started to test something (libstdc++ had no module map file).

Until this and other problems (failure to resolve relocations in the pcm files)
are resolved, I am going to disable the gmodules tests on android.