SymbolVendor: Move compile unit handling into the SymbolFile class

Summary:
SymbolFile classes are responsible for creating CompileUnit instances
and they already need to have a notion of the id<->CompileUnit mapping
(because of APIs like ParseCompileUnitAtIndex). However, the
SymbolVendor has remained as the thing responsible for caching created
units (which the SymbolFiles were calling via convoluted constructs like
"m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(...)").

This patch moves the responsibility of caching the units into the
SymbolFile class. It does this by moving the implementation of
SymbolVendor::{GetNumCompileUnits,GetCompileUnitAtIndex} into the
equivalent SymbolFile functions. The SymbolVendor functions become just
a passthrough much like the rest of SymbolVendor.

The original implementations of SymbolFile::GetNumCompileUnits is moved
to "CalculateNumCompileUnits", and are made protected, as the "Get"
function is the external api of the class.
SymbolFile::ParseCompileUnitAtIndex is made protected for the same
reason.

This is the first step in removing the SymbolVendor indirection, as
proposed in
<http://lists.llvm.org/pipermail/lldb-dev/2019-June/015071.html>. After
removing all interesting logic from the SymbolVendor class, I'll proceed
with removing the indirection itself.

Reviewers: clayborg, jingham, JDevlieghere

Subscribers: jdoerfert, lldb-commits

Differential Revision: https://reviews.llvm.org/D65089

llvm-svn: 366791
This commit is contained in:
Pavel Labath 2019-07-23 09:24:02 +00:00
parent fdedf240f8
commit e0119909a6
17 changed files with 126 additions and 142 deletions

View File

@ -110,8 +110,8 @@ public:
// Compile Unit function calls
// Approach 1 - iterator
virtual uint32_t GetNumCompileUnits() = 0;
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
uint32_t GetNumCompileUnits();
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
@ -235,12 +235,17 @@ public:
return nullptr;
}
virtual void Dump(Stream &s) {}
virtual void Dump(Stream &s);
protected:
void AssertModuleLock();
virtual uint32_t CalculateNumCompileUnits() = 0;
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0;
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
uint32_t m_abilities;
bool m_calculated_abilities;

View File

@ -110,9 +110,6 @@ public:
virtual size_t GetNumCompileUnits();
virtual bool SetCompileUnitAtIndex(size_t cu_idx,
const lldb::CompUnitSP &cu_sp);
virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
TypeList &GetTypeList() { return m_type_list; }
@ -142,13 +139,7 @@ public:
uint32_t GetPluginVersion() override;
protected:
// Classes that inherit from SymbolVendor can see and modify these
typedef std::vector<lldb::CompUnitSP> CompileUnits;
typedef CompileUnits::iterator CompileUnitIter;
typedef CompileUnits::const_iterator CompileUnitConstIter;
TypeList m_type_list; // Uniqued types for all parsers owned by this module
CompileUnits m_compile_units; // The current compile units
lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
// case it isn't the same as the module
// object file (debug symbols in a separate

View File

@ -187,7 +187,7 @@ uint32_t SymbolFileBreakpad::CalculateAbilities() {
return CompileUnits | Functions | LineTables;
}
uint32_t SymbolFileBreakpad::GetNumCompileUnits() {
uint32_t SymbolFileBreakpad::CalculateNumCompileUnits() {
ParseCUData();
return m_cu_data->GetSize();
}
@ -218,7 +218,7 @@ CompUnitSP SymbolFileBreakpad::ParseCompileUnitAtIndex(uint32_t index) {
eLanguageTypeUnknown,
/*is_optimized*/ eLazyBoolNo);
GetSymbolVendor().SetCompileUnitAtIndex(index, cu_sp);
SetCompileUnitAtIndex(index, cu_sp);
return cu_sp;
}
@ -260,7 +260,7 @@ SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr,
if (idx == UINT32_MAX)
return 0;
sc.comp_unit = GetSymbolVendor().GetCompileUnitAtIndex(idx).get();
sc.comp_unit = GetCompileUnitAtIndex(idx).get();
SymbolContextItem result = eSymbolContextCompUnit;
if (resolve_scope & eSymbolContextLineEntry) {
if (sc.comp_unit->GetLineTable()->FindLineEntryByAddress(so_addr,
@ -280,7 +280,7 @@ uint32_t SymbolFileBreakpad::ResolveSymbolContext(
uint32_t old_size = sc_list.GetSize();
for (size_t i = 0, size = GetNumCompileUnits(); i < size; ++i) {
CompileUnit &cu = *GetSymbolVendor().GetCompileUnitAtIndex(i);
CompileUnit &cu = *GetCompileUnitAtIndex(i);
cu.ResolveSymbolContext(file_spec, line, check_inlines,
/*exact*/ false, resolve_scope, sc_list);
}
@ -522,10 +522,6 @@ SymbolFileBreakpad::GetUnwindPlan(const Address &address,
return plan_sp;
}
SymbolVendor &SymbolFileBreakpad::GetSymbolVendor() {
return *m_obj_file->GetModule()->GetSymbolVendor();
}
addr_t SymbolFileBreakpad::GetBaseFileAddress() {
return m_obj_file->GetModule()
->GetObjectFile()

View File

@ -46,10 +46,6 @@ public:
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override {
return lldb::eLanguageTypeUnknown;
}
@ -196,7 +192,9 @@ private:
};
SymbolVendor &GetSymbolVendor();
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::addr_t GetBaseFileAddress();
void ParseFileRecords();
void ParseCUData();

View File

@ -677,8 +677,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
dwarf_cu.SetUserData(cu_sp.get());
m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
dwarf_cu.GetID(), cu_sp);
SetCompileUnitAtIndex(dwarf_cu.GetID(), cu_sp);
}
}
}
@ -715,7 +714,7 @@ llvm::Optional<uint32_t> SymbolFileDWARF::GetDWARFUnitIndex(uint32_t cu_idx) {
return m_lldb_cu_to_dwarf_unit[cu_idx];
}
uint32_t SymbolFileDWARF::GetNumCompileUnits() {
uint32_t SymbolFileDWARF::CalculateNumCompileUnits() {
DWARFDebugInfo *info = DebugInfo();
if (!info)
return 0;
@ -3713,7 +3712,10 @@ ConstString SymbolFileDWARF::GetPluginName() { return GetPluginNameStatic(); }
uint32_t SymbolFileDWARF::GetPluginVersion() { return 1; }
void SymbolFileDWARF::Dump(lldb_private::Stream &s) { m_index->Dump(s); }
void SymbolFileDWARF::Dump(lldb_private::Stream &s) {
SymbolFile::Dump(s);
m_index->Dump(s);
}
void SymbolFileDWARF::DumpClangAST(Stream &s) {
TypeSystem *ts = GetTypeSystemForLanguage(eLanguageTypeC_plus_plus);

View File

@ -95,10 +95,6 @@ public:
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
@ -331,6 +327,10 @@ protected:
bool DeclContextMatchesThisSymbolFile(
const lldb_private::CompilerDeclContext *decl_ctx);
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
virtual DWARFUnit *
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit);

View File

@ -562,7 +562,7 @@ uint32_t SymbolFileDWARFDebugMap::CalculateAbilities() {
return 0;
}
uint32_t SymbolFileDWARFDebugMap::GetNumCompileUnits() {
uint32_t SymbolFileDWARFDebugMap::CalculateNumCompileUnits() {
InitOSO();
return m_compile_unit_infos.size();
}
@ -585,9 +585,8 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) {
eLanguageTypeUnknown, eLazyBoolCalculate);
if (m_compile_unit_infos[cu_idx].compile_unit_sp) {
// Let our symbol vendor know about this compile unit
m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
cu_idx, m_compile_unit_infos[cu_idx].compile_unit_sp);
SetCompileUnitAtIndex(cu_idx,
m_compile_unit_infos[cu_idx].compile_unit_sp);
}
}
}
@ -1284,8 +1283,7 @@ void SymbolFileDWARFDebugMap::SetCompileUnit(SymbolFileDWARF *oso_dwarf,
cu_sp.get());
} else {
m_compile_unit_infos[cu_idx].compile_unit_sp = cu_sp;
m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
cu_idx, cu_sp);
SetCompileUnitAtIndex(cu_idx, cu_sp);
}
}
}

View File

@ -44,9 +44,6 @@ public:
void InitializeObject() override;
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
@ -174,6 +171,9 @@ protected:
// Protected Member Functions
void InitOSO();
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
static uint32_t GetOSOIndexFromUserID(lldb::user_id_t uid) {
return (uint32_t)((uid >> 32ull) - 1ull);
}

View File

@ -329,7 +329,7 @@ void SymbolFileNativePDB::InitializeObject() {
m_ast = llvm::make_unique<PdbAstBuilder>(*m_obj_file, *m_index);
}
uint32_t SymbolFileNativePDB::GetNumCompileUnits() {
uint32_t SymbolFileNativePDB::CalculateNumCompileUnits() {
const DbiModuleList &modules = m_index->dbi().modules();
uint32_t count = modules.getModuleCount();
if (count == 0)
@ -433,8 +433,7 @@ SymbolFileNativePDB::CreateCompileUnit(const CompilandIndexItem &cci) {
std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr, fs,
toOpaqueUid(cci.m_id), lang, optimized);
m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
cci.m_id.modi, cu_sp);
SetCompileUnitAtIndex(cci.m_id.modi, cu_sp);
return cu_sp;
}

View File

@ -68,13 +68,9 @@ public:
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
void
ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
@ -157,6 +153,9 @@ public:
void DumpClangAST(Stream &s) override;
private:
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
size_t FindTypesByName(llvm::StringRef name, uint32_t max_matches,
TypeMap &types);

View File

@ -123,8 +123,7 @@ SymbolFilePDB::CreateInstance(lldb_private::ObjectFile *obj_file) {
}
SymbolFilePDB::SymbolFilePDB(lldb_private::ObjectFile *object_file)
: SymbolFile(object_file), m_session_up(), m_global_scope_up(),
m_cached_compile_unit_count(0) {}
: SymbolFile(object_file), m_session_up(), m_global_scope_up() {}
SymbolFilePDB::~SymbolFilePDB() {}
@ -191,33 +190,30 @@ void SymbolFilePDB::InitializeObject() {
lldbassert(m_global_scope_up.get());
}
uint32_t SymbolFilePDB::GetNumCompileUnits() {
if (m_cached_compile_unit_count == 0) {
auto compilands = m_global_scope_up->findAllChildren<PDBSymbolCompiland>();
if (!compilands)
return 0;
uint32_t SymbolFilePDB::CalculateNumCompileUnits() {
auto compilands = m_global_scope_up->findAllChildren<PDBSymbolCompiland>();
if (!compilands)
return 0;
// The linker could link *.dll (compiland language = LINK), or import
// *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be
// found as a child of the global scope (PDB executable). Usually, such
// compilands contain `thunk` symbols in which we are not interested for
// now. However we still count them in the compiland list. If we perform
// any compiland related activity, like finding symbols through
// llvm::pdb::IPDBSession methods, such compilands will all be searched
// automatically no matter whether we include them or not.
m_cached_compile_unit_count = compilands->getChildCount();
// The linker could link *.dll (compiland language = LINK), or import
// *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be
// found as a child of the global scope (PDB executable). Usually, such
// compilands contain `thunk` symbols in which we are not interested for
// now. However we still count them in the compiland list. If we perform
// any compiland related activity, like finding symbols through
// llvm::pdb::IPDBSession methods, such compilands will all be searched
// automatically no matter whether we include them or not.
uint32_t compile_unit_count = compilands->getChildCount();
// The linker can inject an additional "dummy" compilation unit into the
// PDB. Ignore this special compile unit for our purposes, if it is there.
// It is always the last one.
auto last_compiland_up =
compilands->getChildAtIndex(m_cached_compile_unit_count - 1);
lldbassert(last_compiland_up.get());
std::string name = last_compiland_up->getName();
if (name == "* Linker *")
--m_cached_compile_unit_count;
}
return m_cached_compile_unit_count;
// The linker can inject an additional "dummy" compilation unit into the
// PDB. Ignore this special compile unit for our purposes, if it is there.
// It is always the last one.
auto last_compiland_up = compilands->getChildAtIndex(compile_unit_count - 1);
lldbassert(last_compiland_up.get());
std::string name = last_compiland_up->getName();
if (name == "* Linker *")
--compile_unit_count;
return compile_unit_count;
}
void SymbolFilePDB::GetCompileUnitIndex(
@ -1698,8 +1694,7 @@ lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitForUID(uint32_t id,
if (index == UINT32_MAX)
GetCompileUnitIndex(*compiland_up, index);
lldbassert(index != UINT32_MAX);
m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(index,
cu_sp);
SetCompileUnitAtIndex(index, cu_sp);
return cu_sp;
}

View File

@ -48,10 +48,6 @@ public:
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
@ -173,6 +169,10 @@ private:
};
using SecContribsMap = std::map<uint32_t, std::vector<SecContribInfo>>;
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::CompUnitSP ParseCompileUnitForUID(uint32_t id,
uint32_t index = UINT32_MAX);
@ -245,7 +245,6 @@ private:
std::vector<lldb::TypeSP> m_builtin_types;
std::unique_ptr<llvm::pdb::IPDBSession> m_session_up;
std::unique_ptr<llvm::pdb::PDBSymbolExe> m_global_scope_up;
uint32_t m_cached_compile_unit_count;
lldb_private::UniqueCStringMap<uint32_t> m_func_full_names;
lldb_private::UniqueCStringMap<uint32_t> m_func_base_names;

View File

@ -104,7 +104,7 @@ uint32_t SymbolFileSymtab::CalculateAbilities() {
return abilities;
}
uint32_t SymbolFileSymtab::GetNumCompileUnits() {
uint32_t SymbolFileSymtab::CalculateNumCompileUnits() {
// If we don't have any source file symbols we will just have one compile
// unit for the entire object file
if (m_source_indexes.empty())

View File

@ -37,10 +37,6 @@ public:
uint32_t CalculateAbilities() override;
// Compile Unit function calls
uint32_t GetNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
@ -85,6 +81,10 @@ public:
uint32_t GetPluginVersion() override;
protected:
uint32_t CalculateNumCompileUnits() override;
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
typedef std::map<lldb_private::ConstString, lldb::TypeSP> TypeMap;
lldb_private::Symtab::IndexCollection m_source_indexes;

View File

@ -10,6 +10,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/TypeSystem.h"
@ -21,6 +22,7 @@
#include <future>
using namespace lldb_private;
using namespace lldb;
void SymbolFile::PreloadSymbols() {
// No-op for most implementations.
@ -169,4 +171,50 @@ void SymbolFile::AssertModuleLock() {
#endif
}
uint32_t SymbolFile::GetNumCompileUnits() {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
if (!m_compile_units) {
// Create an array of compile unit shared pointers -- which will each
// remain NULL until someone asks for the actual compile unit information.
m_compile_units.emplace(CalculateNumCompileUnits());
}
return m_compile_units->size();
}
CompUnitSP SymbolFile::GetCompileUnitAtIndex(uint32_t idx) {
uint32_t num = GetNumCompileUnits();
if (idx >= num)
return nullptr;
lldb::CompUnitSP &cu_sp = (*m_compile_units)[idx];
if (!cu_sp)
cu_sp = ParseCompileUnitAtIndex(idx);
return cu_sp;
}
void SymbolFile::SetCompileUnitAtIndex(uint32_t idx, const CompUnitSP &cu_sp) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
const size_t num_compile_units = GetNumCompileUnits();
assert(idx < num_compile_units);
// Fire off an assertion if this compile unit already exists for now. The
// partial parsing should take care of only setting the compile unit
// once, so if this assertion fails, we need to make sure that we don't
// have a race condition, or have a second parse of the same compile
// unit.
assert((*m_compile_units)[idx] == nullptr);
(*m_compile_units)[idx] = cu_sp;
}
void SymbolFile::Dump(Stream &s) {
s.PutCString("Compile units:\n");
if (m_compile_units) {
for (const CompUnitSP &cu_sp : *m_compile_units) {
// We currently only dump the compile units that have been parsed
if (cu_sp)
cu_sp->Dump(&s, /*show_context*/ false);
}
}
s.PutChar('\n');
}
SymbolFile::RegisterInfoResolver::~RegisterInfoResolver() = default;

View File

@ -58,8 +58,7 @@ SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp,
// SymbolVendor constructor
SymbolVendor::SymbolVendor(const lldb::ModuleSP &module_sp)
: ModuleChild(module_sp), m_type_list(), m_compile_units(), m_sym_file_up(),
m_symtab() {}
: ModuleChild(module_sp), m_type_list(), m_sym_file_up(), m_symtab() {}
// Destructor
SymbolVendor::~SymbolVendor() {}
@ -76,44 +75,14 @@ void SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp) {
}
}
bool SymbolVendor::SetCompileUnitAtIndex(size_t idx, const CompUnitSP &cu_sp) {
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
const size_t num_compile_units = GetNumCompileUnits();
if (idx < num_compile_units) {
// Fire off an assertion if this compile unit already exists for now. The
// partial parsing should take care of only setting the compile unit
// once, so if this assertion fails, we need to make sure that we don't
// have a race condition, or have a second parse of the same compile
// unit.
assert(m_compile_units[idx].get() == nullptr);
m_compile_units[idx] = cu_sp;
return true;
} else {
// This should NOT happen, and if it does, we want to crash and know
// about it
assert(idx < num_compile_units);
}
}
return false;
}
size_t SymbolVendor::GetNumCompileUnits() {
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
if (m_compile_units.empty()) {
if (m_sym_file_up) {
// Resize our array of compile unit shared pointers -- which will each
// remain NULL until someone asks for the actual compile unit
// information. When this happens, the symbol file will be asked to
// parse this compile unit information.
m_compile_units.resize(m_sym_file_up->GetNumCompileUnits());
}
}
if (m_sym_file_up)
return m_sym_file_up->GetNumCompileUnits();
}
return m_compile_units.size();
return 0;
}
lldb::LanguageType SymbolVendor::ParseLanguage(CompileUnit &comp_unit) {
@ -390,14 +359,6 @@ void SymbolVendor::Dump(Stream *s) {
s->IndentMore();
m_type_list.Dump(s, show_context);
CompileUnitConstIter cu_pos, cu_end;
cu_end = m_compile_units.end();
for (cu_pos = m_compile_units.begin(); cu_pos != cu_end; ++cu_pos) {
// We currently only dump the compile units that have been parsed
if (*cu_pos)
(*cu_pos)->Dump(s, show_context);
}
if (Symtab *symtab = GetSymtab())
symtab->Dump(s, nullptr, eSortOrderNone);
@ -406,20 +367,13 @@ void SymbolVendor::Dump(Stream *s) {
}
CompUnitSP SymbolVendor::GetCompileUnitAtIndex(size_t idx) {
CompUnitSP cu_sp;
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
const size_t num_compile_units = GetNumCompileUnits();
if (idx < num_compile_units) {
cu_sp = m_compile_units[idx];
if (cu_sp.get() == nullptr) {
m_compile_units[idx] = m_sym_file_up->ParseCompileUnitAtIndex(idx);
cu_sp = m_compile_units[idx];
}
}
if (m_sym_file_up)
return m_sym_file_up->GetCompileUnitAtIndex(idx);
}
return cu_sp;
return nullptr;
}
FileSpec SymbolVendor::GetMainFileSpec() const {

View File

@ -558,7 +558,7 @@ Error opts::symbols::verify(lldb_private::Module &Module) {
outs() << "Found " << comp_units_count << " compile units.\n";
for (uint32_t i = 0; i < comp_units_count; i++) {
lldb::CompUnitSP comp_unit = symfile->ParseCompileUnitAtIndex(i);
lldb::CompUnitSP comp_unit = symfile->GetCompileUnitAtIndex(i);
if (!comp_unit)
return make_string_error("Connot parse compile unit {0}.", i);