Ejemplo n.º 1
0
TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestResolveSymbolContextBasename)) {
    // Test that attempting to call ResolveSymbolContext with only a basename
    // finds all full paths
    // with the same basename
    FileSpec fspec(m_pdb_test_exe.c_str(), false);
    ArchSpec aspec("i686-pc-windows");
    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);

    SymbolVendor *plugin = module->GetSymbolVendor();
    EXPECT_NE(nullptr, plugin);
    SymbolFile *symfile = plugin->GetSymbolFile();

    FileSpec header_spec("test-pdb.cpp", false);
    SymbolContextList sc_list;
    uint32_t result_count = symfile->ResolveSymbolContext(
                                header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
    EXPECT_EQ(1u, result_count);
    EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
}
Ejemplo n.º 2
0
TEST_F(SymbolFilePDBTests, REQUIRES_DIA_SDK(TestClassInNamespace)) {
    FileSpec fspec(m_types_test_exe.c_str(), false);
    ArchSpec aspec("i686-pc-windows");
    lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);

    SymbolVendor *plugin = module->GetSymbolVendor();
    SymbolFilePDB *symfile =
        static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
    const llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
    SymbolContext sc;
    llvm::DenseSet<SymbolFile *> searched_files;
    TypeMap results;
    EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("NS::NSClass"), nullptr,
                                     false, 0, searched_files, results));
    EXPECT_EQ(1u, results.GetSize());
    lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
    EXPECT_EQ(ConstString("NS::NSClass"), udt_type->GetName());
    CompilerType compiler_type = udt_type->GetForwardCompilerType();
    EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
    EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NSClass"),
              udt_type->GetByteSize());
}
Ejemplo n.º 3
0
TEST_F(SymbolFilePDBTests,
       REQUIRES_DIA_SDK(TestLookupOfHeaderFileWithNoInlines)) {
  // Test that when looking up a header file via ResolveSymbolContext (i.e. a
  // file that was not by itself
  // compiled, but only contributes to the combined code of other source files),
  // that if check_inlines
  // is false, no SymbolContexts are returned.
  FileSpec fspec(m_pdb_test_exe.c_str(), false);
  ArchSpec aspec("i686-pc-windows");
  lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);

  SymbolVendor *plugin = module->GetSymbolVendor();
  EXPECT_NE(nullptr, plugin);
  SymbolFile *symfile = plugin->GetSymbolFile();

  FileSpec header_specs[] = {FileSpec("test-pdb.h", false),
                             FileSpec("test-pdb-nested.h", false)};
  for (const auto &hspec : header_specs) {
    SymbolContextList sc_list;
    uint32_t result_count = symfile->ResolveSymbolContext(
        hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list);
    EXPECT_EQ(0u, result_count);
  }
}