mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-04 16:26:46 +00:00
SymbolVendor: Remove the object file member variable
Summary: The last responsibility of the SymbolVendor was to hold an owning reference to the object file (in case symbols are being read from a different file than the main module). As SymbolFile classes already hold a non-owning reference to the object file, we can easily remove this responsibility of the SymbolVendor by making the SymbolFile reference owning. Reviewers: JDevlieghere, clayborg, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D65401 llvm-svn: 367392
This commit is contained in:
parent
d65c166e35
commit
d2deeb4490
@ -50,11 +50,12 @@ public:
|
||||
kAllAbilities = ((1u << 7) - 1u)
|
||||
};
|
||||
|
||||
static SymbolFile *FindPlugin(ObjectFile *obj_file);
|
||||
static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFile(ObjectFile *obj_file)
|
||||
: m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
|
||||
SymbolFile(lldb::ObjectFileSP objfile_sp)
|
||||
: m_objfile_sp(std::move(objfile_sp)), m_abilities(0),
|
||||
m_calculated_abilities(false) {}
|
||||
|
||||
~SymbolFile() override {}
|
||||
|
||||
@ -210,8 +211,8 @@ public:
|
||||
return CompilerDeclContext();
|
||||
}
|
||||
|
||||
ObjectFile *GetObjectFile() { return m_obj_file; }
|
||||
const ObjectFile *GetObjectFile() const { return m_obj_file; }
|
||||
ObjectFile *GetObjectFile() { return m_objfile_sp.get(); }
|
||||
const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); }
|
||||
ObjectFile *GetMainObjectFile();
|
||||
|
||||
virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
|
||||
@ -246,7 +247,10 @@ protected:
|
||||
|
||||
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
|
||||
|
||||
ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
|
||||
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
|
||||
// file)
|
||||
llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
|
||||
TypeList m_type_list;
|
||||
Symtab *m_symtab = nullptr;
|
||||
|
@ -131,10 +131,6 @@ public:
|
||||
uint32_t GetPluginVersion() override;
|
||||
|
||||
protected:
|
||||
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
|
||||
// file)
|
||||
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
|
||||
// can add more of these if needed.
|
||||
|
||||
|
@ -70,7 +70,7 @@ typedef lldb::ProcessSP (*ProcessCreateInstance)(
|
||||
const FileSpec *crash_file_path);
|
||||
typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
|
||||
Debugger &debugger);
|
||||
typedef SymbolFile *(*SymbolFileCreateInstance)(ObjectFile *obj_file);
|
||||
typedef SymbolFile *(*SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp);
|
||||
typedef SymbolVendor *(*SymbolVendorCreateInstance)(
|
||||
const lldb::ModuleSP &module_sp,
|
||||
lldb_private::Stream
|
||||
|
@ -126,8 +126,8 @@ SymbolFileBreakpad::LineIterator::operator++() {
|
||||
|
||||
llvm::iterator_range<SymbolFileBreakpad::LineIterator>
|
||||
SymbolFileBreakpad::lines(Record::Kind section_type) {
|
||||
return llvm::make_range(LineIterator(*m_obj_file, section_type),
|
||||
LineIterator(*m_obj_file));
|
||||
return llvm::make_range(LineIterator(*m_objfile_sp, section_type),
|
||||
LineIterator(*m_objfile_sp));
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -179,9 +179,10 @@ ConstString SymbolFileBreakpad::GetPluginNameStatic() {
|
||||
}
|
||||
|
||||
uint32_t SymbolFileBreakpad::CalculateAbilities() {
|
||||
if (!m_obj_file)
|
||||
if (!m_objfile_sp)
|
||||
return 0;
|
||||
if (m_obj_file->GetPluginName() != ObjectFileBreakpad::GetPluginNameStatic())
|
||||
if (m_objfile_sp->GetPluginName() !=
|
||||
ObjectFileBreakpad::GetPluginNameStatic())
|
||||
return 0;
|
||||
|
||||
return CompileUnits | Functions | LineTables;
|
||||
@ -204,7 +205,8 @@ CompUnitSP SymbolFileBreakpad::ParseCompileUnitAtIndex(uint32_t index) {
|
||||
|
||||
// The FileSpec of the compile unit will be the file corresponding to the
|
||||
// first LINE record.
|
||||
LineIterator It(*m_obj_file, Record::Func, data.bookmark), End(*m_obj_file);
|
||||
LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
|
||||
End(*m_objfile_sp);
|
||||
assert(Record::classify(*It) == Record::Func);
|
||||
++It; // Skip FUNC record.
|
||||
if (It != End) {
|
||||
@ -213,7 +215,7 @@ CompUnitSP SymbolFileBreakpad::ParseCompileUnitAtIndex(uint32_t index) {
|
||||
spec = (*m_files)[record->FileNum];
|
||||
}
|
||||
|
||||
auto cu_sp = std::make_shared<CompileUnit>(m_obj_file->GetModule(),
|
||||
auto cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(),
|
||||
/*user_data*/ nullptr, spec, index,
|
||||
eLanguageTypeUnknown,
|
||||
/*is_optimized*/ eLazyBoolNo);
|
||||
@ -329,7 +331,7 @@ SymbolFileBreakpad::FindTypes(const std::vector<CompilerContext> &context,
|
||||
|
||||
void SymbolFileBreakpad::AddSymbols(Symtab &symtab) {
|
||||
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS);
|
||||
Module &module = *m_obj_file->GetModule();
|
||||
Module &module = *m_objfile_sp->GetModule();
|
||||
addr_t base = GetBaseFileAddress();
|
||||
if (base == LLDB_INVALID_ADDRESS) {
|
||||
LLDB_LOG(log, "Unable to fetch the base address of object file. Skipping "
|
||||
@ -455,7 +457,7 @@ bool SymbolFileBreakpad::ParseUnwindRow(llvm::StringRef unwind_rules,
|
||||
return false;
|
||||
}
|
||||
|
||||
ArchSpec arch = m_obj_file->GetArchitecture();
|
||||
ArchSpec arch = m_objfile_sp->GetArchitecture();
|
||||
StreamString dwarf(Stream::eBinary, arch.GetAddressByteSize(),
|
||||
arch.GetByteOrder());
|
||||
ToDWARF(*rhs, dwarf);
|
||||
@ -491,7 +493,8 @@ SymbolFileBreakpad::GetUnwindPlan(const Address &address,
|
||||
if (base == LLDB_INVALID_ADDRESS)
|
||||
return nullptr;
|
||||
|
||||
LineIterator It(*m_obj_file, Record::StackCFI, entry->data), End(*m_obj_file);
|
||||
LineIterator It(*m_objfile_sp, Record::StackCFI, entry->data),
|
||||
End(*m_objfile_sp);
|
||||
llvm::Optional<StackCFIRecord> init_record = StackCFIRecord::parse(*It);
|
||||
assert(init_record.hasValue());
|
||||
assert(init_record->Size.hasValue());
|
||||
@ -503,7 +506,7 @@ SymbolFileBreakpad::GetUnwindPlan(const Address &address,
|
||||
plan_sp->SetSourcedFromCompiler(eLazyBoolYes);
|
||||
plan_sp->SetPlanValidAddressRange(
|
||||
AddressRange(base + init_record->Address, *init_record->Size,
|
||||
m_obj_file->GetModule()->GetSectionList()));
|
||||
m_objfile_sp->GetModule()->GetSectionList()));
|
||||
|
||||
auto row_sp = std::make_shared<UnwindPlan::Row>();
|
||||
row_sp->SetOffset(0);
|
||||
@ -527,7 +530,7 @@ SymbolFileBreakpad::GetUnwindPlan(const Address &address,
|
||||
}
|
||||
|
||||
addr_t SymbolFileBreakpad::GetBaseFileAddress() {
|
||||
return m_obj_file->GetModule()
|
||||
return m_objfile_sp->GetModule()
|
||||
->GetObjectFile()
|
||||
->GetBaseAddress()
|
||||
.GetFileAddress();
|
||||
@ -570,8 +573,8 @@ void SymbolFileBreakpad::ParseCUData() {
|
||||
|
||||
// We shall create one compile unit for each FUNC record. So, count the number
|
||||
// of FUNC records, and store them in m_cu_data, together with their ranges.
|
||||
for (LineIterator It(*m_obj_file, Record::Func), End(*m_obj_file); It != End;
|
||||
++It) {
|
||||
for (LineIterator It(*m_objfile_sp, Record::Func), End(*m_objfile_sp);
|
||||
It != End; ++It) {
|
||||
if (auto record = FuncRecord::parse(*It)) {
|
||||
m_cu_data->Append(CompUnitMap::Entry(base + record->Address, record->Size,
|
||||
CompUnitData(It.GetBookmark())));
|
||||
@ -604,7 +607,8 @@ void SymbolFileBreakpad::ParseLineTableAndSupportFiles(CompileUnit &cu,
|
||||
line_seq_up->Clear();
|
||||
};
|
||||
|
||||
LineIterator It(*m_obj_file, Record::Func, data.bookmark), End(*m_obj_file);
|
||||
LineIterator It(*m_objfile_sp, Record::Func, data.bookmark),
|
||||
End(*m_objfile_sp);
|
||||
assert(Record::classify(*It) == Record::Func);
|
||||
for (++It; It != End; ++It) {
|
||||
auto record = LineRecord::parse(*It);
|
||||
@ -641,7 +645,7 @@ void SymbolFileBreakpad::ParseUnwindData() {
|
||||
"of object file.");
|
||||
}
|
||||
|
||||
for (LineIterator It(*m_obj_file, Record::StackCFI), End(*m_obj_file);
|
||||
for (LineIterator It(*m_objfile_sp, Record::StackCFI), End(*m_objfile_sp);
|
||||
It != End; ++It) {
|
||||
if (auto record = StackCFIRecord::parse(*It)) {
|
||||
if (record->Size)
|
||||
|
@ -31,12 +31,13 @@ public:
|
||||
return "Breakpad debug symbol file reader.";
|
||||
}
|
||||
|
||||
static SymbolFile *CreateInstance(ObjectFile *obj_file) {
|
||||
return new SymbolFileBreakpad(obj_file);
|
||||
static SymbolFile *CreateInstance(lldb::ObjectFileSP objfile_sp) {
|
||||
return new SymbolFileBreakpad(std::move(objfile_sp));
|
||||
}
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFileBreakpad(ObjectFile *object_file) : SymbolFile(object_file) {}
|
||||
SymbolFileBreakpad(lldb::ObjectFileSP objfile_sp)
|
||||
: SymbolFile(std::move(objfile_sp)) {}
|
||||
|
||||
~SymbolFileBreakpad() override {}
|
||||
|
||||
|
@ -191,8 +191,8 @@ const char *SymbolFileDWARF::GetPluginDescriptionStatic() {
|
||||
return "DWARF and DWARF3 debug symbol file reader.";
|
||||
}
|
||||
|
||||
SymbolFile *SymbolFileDWARF::CreateInstance(ObjectFile *obj_file) {
|
||||
return new SymbolFileDWARF(obj_file,
|
||||
SymbolFile *SymbolFileDWARF::CreateInstance(ObjectFileSP objfile_sp) {
|
||||
return new SymbolFileDWARF(std::move(objfile_sp),
|
||||
/*dwo_section_list*/ nullptr);
|
||||
}
|
||||
|
||||
@ -337,14 +337,14 @@ SymbolFileDWARF::GetParentSymbolContextDIE(const DWARFDIE &child_die) {
|
||||
return DWARFDIE();
|
||||
}
|
||||
|
||||
SymbolFileDWARF::SymbolFileDWARF(ObjectFile *objfile,
|
||||
SymbolFileDWARF::SymbolFileDWARF(ObjectFileSP objfile_sp,
|
||||
SectionList *dwo_section_list)
|
||||
: SymbolFile(objfile),
|
||||
: SymbolFile(std::move(objfile_sp)),
|
||||
UserID(0x7fffffff00000000), // Used by SymbolFileDWARFDebugMap to
|
||||
// when this class parses .o files to
|
||||
// contain the .o file index/ID
|
||||
m_debug_map_module_wp(), m_debug_map_symfile(nullptr),
|
||||
m_context(objfile->GetModule()->GetSectionList(), dwo_section_list),
|
||||
m_context(m_objfile_sp->GetModule()->GetSectionList(), dwo_section_list),
|
||||
m_data_debug_loc(), m_abbr(), m_info(), m_fetched_external_modules(false),
|
||||
m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate),
|
||||
m_unique_ast_type_map() {}
|
||||
@ -370,7 +370,7 @@ SymbolFileDWARF::GetTypeSystemForLanguage(LanguageType language) {
|
||||
return debug_map_symfile->GetTypeSystemForLanguage(language);
|
||||
|
||||
auto type_system_or_err =
|
||||
m_obj_file->GetModule()->GetTypeSystemForLanguage(language);
|
||||
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
|
||||
if (type_system_or_err) {
|
||||
type_system_or_err->SetSymbolFile(this);
|
||||
}
|
||||
@ -420,9 +420,9 @@ bool SymbolFileDWARF::SupportedVersion(uint16_t version) {
|
||||
|
||||
uint32_t SymbolFileDWARF::CalculateAbilities() {
|
||||
uint32_t abilities = 0;
|
||||
if (m_obj_file != nullptr) {
|
||||
if (m_objfile_sp != nullptr) {
|
||||
const Section *section = nullptr;
|
||||
const SectionList *section_list = m_obj_file->GetSectionList();
|
||||
const SectionList *section_list = m_objfile_sp->GetSectionList();
|
||||
if (section_list == nullptr)
|
||||
return 0;
|
||||
|
||||
@ -455,7 +455,8 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
|
||||
error.Printf("unsupported DW_FORM value%s:", invalid_forms.size() > 1 ? "s" : "");
|
||||
for (auto form : invalid_forms)
|
||||
error.Printf(" %#x", form);
|
||||
m_obj_file->GetModule()->ReportWarning("%s", error.GetString().str().c_str());
|
||||
m_objfile_sp->GetModule()->ReportWarning(
|
||||
"%s", error.GetString().str().c_str());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -467,10 +468,10 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
|
||||
debug_line_file_size = section->GetFileSize();
|
||||
} else {
|
||||
const char *symfile_dir_cstr =
|
||||
m_obj_file->GetFileSpec().GetDirectory().GetCString();
|
||||
m_objfile_sp->GetFileSpec().GetDirectory().GetCString();
|
||||
if (symfile_dir_cstr) {
|
||||
if (strcasestr(symfile_dir_cstr, ".dsym")) {
|
||||
if (m_obj_file->GetType() == ObjectFile::eTypeDebugInfo) {
|
||||
if (m_objfile_sp->GetType() == ObjectFile::eTypeDebugInfo) {
|
||||
// We have a dSYM file that didn't have a any debug info. If the
|
||||
// string table has a size of 1, then it was made from an
|
||||
// executable with no debug info, or from an executable that was
|
||||
@ -479,7 +480,7 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
|
||||
section_list->FindSectionByType(eSectionTypeDWARFDebugStr, true)
|
||||
.get();
|
||||
if (section && section->GetFileSize() == 1) {
|
||||
m_obj_file->GetModule()->ReportWarning(
|
||||
m_objfile_sp->GetModule()->ReportWarning(
|
||||
"empty dSYM file detected, dSYM was created with an "
|
||||
"executable with no debug info.");
|
||||
}
|
||||
@ -509,7 +510,7 @@ SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type,
|
||||
|
||||
void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type,
|
||||
DWARFDataExtractor &data) {
|
||||
ModuleSP module_sp(m_obj_file->GetModule());
|
||||
ModuleSP module_sp(m_objfile_sp->GetModule());
|
||||
const SectionList *section_list = module_sp->GetSectionList();
|
||||
if (!section_list)
|
||||
return;
|
||||
@ -519,7 +520,7 @@ void SymbolFileDWARF::LoadSectionData(lldb::SectionType sect_type,
|
||||
return;
|
||||
|
||||
data.Clear();
|
||||
m_obj_file->ReadSectionData(section_sp.get(), data);
|
||||
m_objfile_sp->ReadSectionData(section_sp.get(), data);
|
||||
}
|
||||
|
||||
const DWARFDataExtractor &SymbolFileDWARF::DebugLocData() {
|
||||
@ -638,7 +639,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFCompileUnit &dwarf_cu) {
|
||||
cu_sp = m_debug_map_symfile->GetCompileUnit(this);
|
||||
dwarf_cu.SetUserData(cu_sp.get());
|
||||
} else {
|
||||
ModuleSP module_sp(m_obj_file->GetModule());
|
||||
ModuleSP module_sp(m_objfile_sp->GetModule());
|
||||
if (module_sp) {
|
||||
const DWARFDIE cu_die = dwarf_cu.DIE();
|
||||
if (cu_die) {
|
||||
@ -1598,7 +1599,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
|
||||
}
|
||||
}
|
||||
dwo_module_spec.GetArchitecture() =
|
||||
m_obj_file->GetModule()->GetArchitecture();
|
||||
m_objfile_sp->GetModule()->GetArchitecture();
|
||||
|
||||
// When LLDB loads "external" modules it looks at the presence of
|
||||
// DW_AT_GNU_dwo_name. However, when the already created module
|
||||
@ -1612,8 +1613,8 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
|
||||
// printed. However, as one can notice in this case we don't
|
||||
// actually need to try to load the already loaded module
|
||||
// (corresponding to .dwo) so we simply skip it.
|
||||
if (m_obj_file->GetFileSpec().GetFileNameExtension() == ".dwo" &&
|
||||
llvm::StringRef(m_obj_file->GetFileSpec().GetPath())
|
||||
if (m_objfile_sp->GetFileSpec().GetFileNameExtension() == ".dwo" &&
|
||||
llvm::StringRef(m_objfile_sp->GetFileSpec().GetPath())
|
||||
.endswith(dwo_module_spec.GetFileSpec().GetPath())) {
|
||||
continue;
|
||||
}
|
||||
@ -1842,7 +1843,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec,
|
||||
bool file_spec_matches_cu_file_spec =
|
||||
FileSpec::Equal(file_spec, *dc_cu, full_match);
|
||||
if (check_inlines || file_spec_matches_cu_file_spec) {
|
||||
SymbolContext sc(m_obj_file->GetModule());
|
||||
SymbolContext sc(m_objfile_sp->GetModule());
|
||||
sc.comp_unit = dc_cu;
|
||||
uint32_t file_idx = UINT32_MAX;
|
||||
|
||||
@ -2013,7 +2014,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(
|
||||
const size_t num_die_matches = die_offsets.size();
|
||||
if (num_die_matches) {
|
||||
SymbolContext sc;
|
||||
sc.module_sp = m_obj_file->GetModule();
|
||||
sc.module_sp = m_objfile_sp->GetModule();
|
||||
assert(sc.module_sp);
|
||||
|
||||
// Loop invariant: Variables up to this index have been checked for context
|
||||
@ -2110,7 +2111,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex,
|
||||
m_index->GetGlobalVariables(regex, die_offsets);
|
||||
|
||||
SymbolContext sc;
|
||||
sc.module_sp = m_obj_file->GetModule();
|
||||
sc.module_sp = m_objfile_sp->GetModule();
|
||||
assert(sc.module_sp);
|
||||
|
||||
const size_t num_matches = die_offsets.size();
|
||||
@ -2642,8 +2643,8 @@ SymbolFileDWARF::GetDeclContextDIEContainingDIE(const DWARFDIE &orig_die) {
|
||||
Symbol *
|
||||
SymbolFileDWARF::GetObjCClassSymbol(ConstString objc_class_name) {
|
||||
Symbol *objc_class_symbol = nullptr;
|
||||
if (m_obj_file) {
|
||||
Symtab *symtab = m_obj_file->GetSymtab();
|
||||
if (m_objfile_sp) {
|
||||
Symtab *symtab = m_objfile_sp->GetSymtab();
|
||||
if (symtab) {
|
||||
objc_class_symbol = symtab->FindFirstSymbolWithNameAndType(
|
||||
objc_class_name, eSymbolTypeObjCClass, Symtab::eDebugNo,
|
||||
@ -2734,7 +2735,7 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE(
|
||||
DEBUG_PRINTF("resolved 0x%8.8" PRIx64 " from %s to 0x%8.8" PRIx64
|
||||
" (cu 0x%8.8" PRIx64 ")\n",
|
||||
die.GetID(),
|
||||
m_obj_file->GetFileSpec().GetFilename().AsCString(
|
||||
m_objfile_sp->GetFileSpec().GetFilename().AsCString(
|
||||
"<Unknown>"),
|
||||
type_die.GetID(), type_cu->GetID());
|
||||
|
||||
@ -3767,9 +3768,9 @@ SymbolFileDWARF::GetLocationListFormat() const {
|
||||
SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() {
|
||||
llvm::call_once(m_dwp_symfile_once_flag, [this]() {
|
||||
ModuleSpec module_spec;
|
||||
module_spec.GetFileSpec() = m_obj_file->GetFileSpec();
|
||||
module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec();
|
||||
module_spec.GetSymbolFileSpec() =
|
||||
FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp");
|
||||
FileSpec(m_objfile_sp->GetFileSpec().GetPath() + ".dwp");
|
||||
|
||||
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
|
||||
FileSpec dwp_filespec =
|
||||
|
@ -79,13 +79,13 @@ public:
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
static lldb_private::SymbolFile *
|
||||
CreateInstance(lldb_private::ObjectFile *obj_file);
|
||||
CreateInstance(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
static lldb_private::FileSpecList GetSymlinkPaths();
|
||||
|
||||
// Constructors and Destructors
|
||||
|
||||
SymbolFileDWARF(lldb_private::ObjectFile *ofile,
|
||||
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp,
|
||||
lldb_private::SectionList *dwo_section_list);
|
||||
|
||||
~SymbolFileDWARF() override;
|
||||
|
@ -239,13 +239,13 @@ const char *SymbolFileDWARFDebugMap::GetPluginDescriptionStatic() {
|
||||
return "DWARF and DWARF3 debug symbol file reader (debug map).";
|
||||
}
|
||||
|
||||
SymbolFile *SymbolFileDWARFDebugMap::CreateInstance(ObjectFile *obj_file) {
|
||||
return new SymbolFileDWARFDebugMap(obj_file);
|
||||
SymbolFile *SymbolFileDWARFDebugMap::CreateInstance(ObjectFileSP objfile_sp) {
|
||||
return new SymbolFileDWARFDebugMap(std::move(objfile_sp));
|
||||
}
|
||||
|
||||
SymbolFileDWARFDebugMap::SymbolFileDWARFDebugMap(ObjectFile *ofile)
|
||||
: SymbolFile(ofile), m_flags(), m_compile_unit_infos(), m_func_indexes(),
|
||||
m_glob_indexes(),
|
||||
SymbolFileDWARFDebugMap::SymbolFileDWARFDebugMap(ObjectFileSP objfile_sp)
|
||||
: SymbolFile(std::move(objfile_sp)), m_flags(), m_compile_unit_infos(),
|
||||
m_func_indexes(), m_glob_indexes(),
|
||||
m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate) {}
|
||||
|
||||
SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap() {}
|
||||
@ -260,12 +260,12 @@ void SymbolFileDWARFDebugMap::InitOSO() {
|
||||
|
||||
// If the object file has been stripped, there is no sense in looking further
|
||||
// as all of the debug symbols for the debug map will not be available
|
||||
if (m_obj_file->IsStripped())
|
||||
if (m_objfile_sp->IsStripped())
|
||||
return;
|
||||
|
||||
// Also make sure the file type is some sort of executable. Core files, debug
|
||||
// info files (dSYM), object files (.o files), and stub libraries all can
|
||||
switch (m_obj_file->GetType()) {
|
||||
switch (m_objfile_sp->GetType()) {
|
||||
case ObjectFile::eTypeInvalid:
|
||||
case ObjectFile::eTypeCoreFile:
|
||||
case ObjectFile::eTypeDebugInfo:
|
||||
@ -286,7 +286,7 @@ void SymbolFileDWARFDebugMap::InitOSO() {
|
||||
// these files exist and also contain valid DWARF. If we get any of that then
|
||||
// we return the abilities of the first N_OSO's DWARF.
|
||||
|
||||
Symtab *symtab = m_obj_file->GetSymtab();
|
||||
Symtab *symtab = m_objfile_sp->GetSymtab();
|
||||
if (symtab) {
|
||||
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
|
||||
|
||||
@ -352,7 +352,7 @@ void SymbolFileDWARFDebugMap::InitOSO() {
|
||||
// The sibling index can't be less that or equal to the current index
|
||||
// "i"
|
||||
if (sibling_idx == UINT32_MAX) {
|
||||
m_obj_file->GetModule()->ReportError(
|
||||
m_objfile_sp->GetModule()->ReportError(
|
||||
"N_SO in symbol with UID %u has invalid sibling in debug map, "
|
||||
"please file a bug and attach the binary listed in this error",
|
||||
so_symbol->GetID());
|
||||
@ -368,22 +368,22 @@ void SymbolFileDWARFDebugMap::InitOSO() {
|
||||
}
|
||||
} else {
|
||||
if (oso_symbol == nullptr)
|
||||
m_obj_file->GetModule()->ReportError(
|
||||
m_objfile_sp->GetModule()->ReportError(
|
||||
"N_OSO symbol[%u] can't be found, please file a bug and attach "
|
||||
"the binary listed in this error",
|
||||
oso_idx);
|
||||
else if (so_symbol == nullptr)
|
||||
m_obj_file->GetModule()->ReportError(
|
||||
m_objfile_sp->GetModule()->ReportError(
|
||||
"N_SO not found for N_OSO symbol[%u], please file a bug and "
|
||||
"attach the binary listed in this error",
|
||||
oso_idx);
|
||||
else if (so_symbol->GetType() != eSymbolTypeSourceFile)
|
||||
m_obj_file->GetModule()->ReportError(
|
||||
m_objfile_sp->GetModule()->ReportError(
|
||||
"N_SO has incorrect symbol type (%u) for N_OSO symbol[%u], "
|
||||
"please file a bug and attach the binary listed in this error",
|
||||
so_symbol->GetType(), oso_idx);
|
||||
else if (oso_symbol->GetType() != eSymbolTypeSourceFile)
|
||||
m_obj_file->GetModule()->ReportError(
|
||||
m_objfile_sp->GetModule()->ReportError(
|
||||
"N_OSO has incorrect symbol type (%u) for N_OSO symbol[%u], "
|
||||
"please file a bug and attach the binary listed in this error",
|
||||
oso_symbol->GetType(), oso_idx);
|
||||
@ -447,7 +447,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
|
||||
// since .o files for "i386-apple-ios" will historically show up as "i386
|
||||
// -apple-macosx" due to the lack of a LC_VERSION_MIN_MACOSX or
|
||||
// LC_VERSION_MIN_IPHONEOS load command...
|
||||
oso_arch.SetTriple(m_obj_file->GetModule()
|
||||
oso_arch.SetTriple(m_objfile_sp->GetModule()
|
||||
->GetArchitecture()
|
||||
.GetTriple()
|
||||
.getArchName()
|
||||
@ -580,7 +580,7 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) {
|
||||
lldb::user_id_t cu_id = 0;
|
||||
m_compile_unit_infos[cu_idx].compile_unit_sp =
|
||||
std::make_shared<CompileUnit>(
|
||||
m_obj_file->GetModule(), nullptr, so_file_spec, cu_id,
|
||||
m_objfile_sp->GetModule(), nullptr, so_file_spec, cu_id,
|
||||
eLanguageTypeUnknown, eLazyBoolCalculate);
|
||||
|
||||
if (m_compile_unit_infos[cu_idx].compile_unit_sp) {
|
||||
@ -749,7 +749,7 @@ SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr,
|
||||
SymbolContext &sc) {
|
||||
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
||||
uint32_t resolved_flags = 0;
|
||||
Symtab *symtab = m_obj_file->GetSymtab();
|
||||
Symtab *symtab = m_objfile_sp->GetSymtab();
|
||||
if (symtab) {
|
||||
const addr_t exe_file_addr = exe_so_addr.GetFileAddress();
|
||||
|
||||
@ -1026,7 +1026,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(
|
||||
uint32_t sc_idx = sc_list.GetSize();
|
||||
if (oso_dwarf->FindFunctions(name, parent_decl_ctx, name_type_mask,
|
||||
include_inlines, true, sc_list)) {
|
||||
RemoveFunctionsWithModuleNotEqualTo(m_obj_file->GetModule(), sc_list,
|
||||
RemoveFunctionsWithModuleNotEqualTo(m_objfile_sp->GetModule(), sc_list,
|
||||
sc_idx);
|
||||
}
|
||||
return false;
|
||||
@ -1055,7 +1055,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex,
|
||||
uint32_t sc_idx = sc_list.GetSize();
|
||||
|
||||
if (oso_dwarf->FindFunctions(regex, include_inlines, true, sc_list)) {
|
||||
RemoveFunctionsWithModuleNotEqualTo(m_obj_file->GetModule(), sc_list,
|
||||
RemoveFunctionsWithModuleNotEqualTo(m_objfile_sp->GetModule(), sc_list,
|
||||
sc_idx);
|
||||
}
|
||||
return false;
|
||||
@ -1140,7 +1140,7 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(
|
||||
// N_SO.
|
||||
SymbolFileDWARF *oso_dwarf = nullptr;
|
||||
TypeSP type_sp;
|
||||
ObjectFile *module_objfile = m_obj_file->GetModule()->GetObjectFile();
|
||||
ObjectFile *module_objfile = m_objfile_sp->GetModule()->GetObjectFile();
|
||||
if (module_objfile) {
|
||||
Symtab *symtab = module_objfile->GetSymtab();
|
||||
if (symtab) {
|
||||
|
@ -34,10 +34,10 @@ public:
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
static lldb_private::SymbolFile *
|
||||
CreateInstance(lldb_private::ObjectFile *obj_file);
|
||||
CreateInstance(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFileDWARFDebugMap(lldb_private::ObjectFile *ofile);
|
||||
SymbolFileDWARFDebugMap(lldb::ObjectFileSP objfile_sp);
|
||||
~SymbolFileDWARFDebugMap() override;
|
||||
|
||||
uint32_t CalculateAbilities() override;
|
||||
|
@ -23,21 +23,21 @@ using namespace lldb_private;
|
||||
|
||||
SymbolFileDWARFDwo::SymbolFileDWARFDwo(ObjectFileSP objfile,
|
||||
DWARFCompileUnit &dwarf_cu)
|
||||
: SymbolFileDWARF(objfile.get(), objfile->GetSectionList(
|
||||
/*update_module_section_list*/ false)),
|
||||
m_obj_file_sp(objfile), m_base_dwarf_cu(dwarf_cu) {
|
||||
: SymbolFileDWARF(objfile, objfile->GetSectionList(
|
||||
/*update_module_section_list*/ false)),
|
||||
m_base_dwarf_cu(dwarf_cu) {
|
||||
SetID(((lldb::user_id_t)dwarf_cu.GetID()) << 32);
|
||||
}
|
||||
|
||||
void SymbolFileDWARFDwo::LoadSectionData(lldb::SectionType sect_type,
|
||||
DWARFDataExtractor &data) {
|
||||
const SectionList *section_list =
|
||||
m_obj_file->GetSectionList(false /* update_module_section_list */);
|
||||
m_objfile_sp->GetSectionList(false /* update_module_section_list */);
|
||||
if (section_list) {
|
||||
SectionSP section_sp(section_list->FindSectionByType(sect_type, true));
|
||||
if (section_sp) {
|
||||
|
||||
if (m_obj_file->ReadSectionData(section_sp.get(), data) != 0)
|
||||
if (m_objfile_sp->ReadSectionData(section_sp.get(), data) != 0)
|
||||
return;
|
||||
|
||||
data.Clear();
|
||||
|
@ -71,7 +71,6 @@ protected:
|
||||
|
||||
DWARFCompileUnit *ComputeCompileUnit();
|
||||
|
||||
lldb::ObjectFileSP m_obj_file_sp;
|
||||
DWARFCompileUnit &m_base_dwarf_cu;
|
||||
DWARFCompileUnit *m_cu = nullptr;
|
||||
};
|
||||
|
@ -265,27 +265,27 @@ const char *SymbolFileNativePDB::GetPluginDescriptionStatic() {
|
||||
return "Microsoft PDB debug symbol cross-platform file reader.";
|
||||
}
|
||||
|
||||
SymbolFile *SymbolFileNativePDB::CreateInstance(ObjectFile *obj_file) {
|
||||
return new SymbolFileNativePDB(obj_file);
|
||||
SymbolFile *SymbolFileNativePDB::CreateInstance(ObjectFileSP objfile_sp) {
|
||||
return new SymbolFileNativePDB(std::move(objfile_sp));
|
||||
}
|
||||
|
||||
SymbolFileNativePDB::SymbolFileNativePDB(ObjectFile *object_file)
|
||||
: SymbolFile(object_file) {}
|
||||
SymbolFileNativePDB::SymbolFileNativePDB(ObjectFileSP objfile_sp)
|
||||
: SymbolFile(std::move(objfile_sp)) {}
|
||||
|
||||
SymbolFileNativePDB::~SymbolFileNativePDB() {}
|
||||
|
||||
uint32_t SymbolFileNativePDB::CalculateAbilities() {
|
||||
uint32_t abilities = 0;
|
||||
if (!m_obj_file)
|
||||
if (!m_objfile_sp)
|
||||
return 0;
|
||||
|
||||
if (!m_index) {
|
||||
// Lazily load and match the PDB file, but only do this once.
|
||||
std::unique_ptr<PDBFile> file_up =
|
||||
loadMatchingPDBFile(m_obj_file->GetFileSpec().GetPath(), m_allocator);
|
||||
loadMatchingPDBFile(m_objfile_sp->GetFileSpec().GetPath(), m_allocator);
|
||||
|
||||
if (!file_up) {
|
||||
auto module_sp = m_obj_file->GetModule();
|
||||
auto module_sp = m_objfile_sp->GetModule();
|
||||
if (!module_sp)
|
||||
return 0;
|
||||
// See if any symbol file is specified through `--symfile` option.
|
||||
@ -318,11 +318,11 @@ uint32_t SymbolFileNativePDB::CalculateAbilities() {
|
||||
}
|
||||
|
||||
void SymbolFileNativePDB::InitializeObject() {
|
||||
m_obj_load_address = m_obj_file->GetBaseAddress().GetFileAddress();
|
||||
m_obj_load_address = m_objfile_sp->GetBaseAddress().GetFileAddress();
|
||||
m_index->SetLoadAddress(m_obj_load_address);
|
||||
m_index->ParseSectionContribs();
|
||||
|
||||
auto ts_or_err = m_obj_file->GetModule()->GetTypeSystemForLanguage(
|
||||
auto ts_or_err = m_objfile_sp->GetModule()->GetTypeSystemForLanguage(
|
||||
lldb::eLanguageTypeC_plus_plus);
|
||||
if (auto err = ts_or_err.takeError()) {
|
||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
|
||||
@ -331,7 +331,7 @@ void SymbolFileNativePDB::InitializeObject() {
|
||||
ts_or_err->SetSymbolFile(this);
|
||||
auto *clang = llvm::cast_or_null<ClangASTContext>(&ts_or_err.get());
|
||||
lldbassert(clang);
|
||||
m_ast = llvm::make_unique<PdbAstBuilder>(*m_obj_file, *m_index, *clang);
|
||||
m_ast = llvm::make_unique<PdbAstBuilder>(*m_objfile_sp, *m_index, *clang);
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ SymbolFileNativePDB::CreateCompileUnit(const CompilandIndexItem &cci) {
|
||||
FileSpec fs(source_file_name);
|
||||
|
||||
CompUnitSP cu_sp =
|
||||
std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr, fs,
|
||||
std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr, fs,
|
||||
toOpaqueUid(cci.m_id), lang, optimized);
|
||||
|
||||
SetCompileUnitAtIndex(cci.m_id.modi, cu_sp);
|
||||
@ -1594,7 +1594,7 @@ SymbolFileNativePDB::FindNamespace(ConstString name,
|
||||
llvm::Expected<TypeSystem &>
|
||||
SymbolFileNativePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
|
||||
auto type_system_or_err =
|
||||
m_obj_file->GetModule()->GetTypeSystemForLanguage(language);
|
||||
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
|
||||
if (type_system_or_err) {
|
||||
type_system_or_err->SetSymbolFile(this);
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
static SymbolFile *CreateInstance(ObjectFile *obj_file);
|
||||
static SymbolFile *CreateInstance(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFileNativePDB(ObjectFile *ofile);
|
||||
SymbolFileNativePDB(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
~SymbolFileNativePDB() override;
|
||||
|
||||
|
@ -119,28 +119,28 @@ const char *SymbolFilePDB::GetPluginDescriptionStatic() {
|
||||
}
|
||||
|
||||
lldb_private::SymbolFile *
|
||||
SymbolFilePDB::CreateInstance(lldb_private::ObjectFile *obj_file) {
|
||||
return new SymbolFilePDB(obj_file);
|
||||
SymbolFilePDB::CreateInstance(ObjectFileSP objfile_sp) {
|
||||
return new SymbolFilePDB(std::move(objfile_sp));
|
||||
}
|
||||
|
||||
SymbolFilePDB::SymbolFilePDB(lldb_private::ObjectFile *object_file)
|
||||
: SymbolFile(object_file), m_session_up(), m_global_scope_up() {}
|
||||
SymbolFilePDB::SymbolFilePDB(lldb::ObjectFileSP objfile_sp)
|
||||
: SymbolFile(std::move(objfile_sp)), m_session_up(), m_global_scope_up() {}
|
||||
|
||||
SymbolFilePDB::~SymbolFilePDB() {}
|
||||
|
||||
uint32_t SymbolFilePDB::CalculateAbilities() {
|
||||
uint32_t abilities = 0;
|
||||
if (!m_obj_file)
|
||||
if (!m_objfile_sp)
|
||||
return 0;
|
||||
|
||||
if (!m_session_up) {
|
||||
// Lazily load and match the PDB file, but only do this once.
|
||||
std::string exePath = m_obj_file->GetFileSpec().GetPath();
|
||||
std::string exePath = m_objfile_sp->GetFileSpec().GetPath();
|
||||
auto error = loadDataForEXE(PDB_ReaderType::DIA, llvm::StringRef(exePath),
|
||||
m_session_up);
|
||||
if (error) {
|
||||
llvm::consumeError(std::move(error));
|
||||
auto module_sp = m_obj_file->GetModule();
|
||||
auto module_sp = m_objfile_sp->GetModule();
|
||||
if (!module_sp)
|
||||
return 0;
|
||||
// See if any symbol file is specified through `--symfile` option.
|
||||
@ -183,7 +183,8 @@ uint32_t SymbolFilePDB::CalculateAbilities() {
|
||||
}
|
||||
|
||||
void SymbolFilePDB::InitializeObject() {
|
||||
lldb::addr_t obj_load_address = m_obj_file->GetBaseAddress().GetFileAddress();
|
||||
lldb::addr_t obj_load_address =
|
||||
m_objfile_sp->GetBaseAddress().GetFileAddress();
|
||||
lldbassert(obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS);
|
||||
m_session_up->setLoadAddress(obj_load_address);
|
||||
if (!m_global_scope_up)
|
||||
@ -1118,7 +1119,7 @@ uint32_t SymbolFilePDB::FindGlobalVariables(
|
||||
break;
|
||||
|
||||
SymbolContext sc;
|
||||
sc.module_sp = m_obj_file->GetModule();
|
||||
sc.module_sp = m_objfile_sp->GetModule();
|
||||
lldbassert(sc.module_sp.get());
|
||||
|
||||
if (!name.GetStringRef().equals(
|
||||
@ -1164,7 +1165,7 @@ SymbolFilePDB::FindGlobalVariables(const lldb_private::RegularExpression ®ex,
|
||||
if (!regex.Execute(var_name))
|
||||
continue;
|
||||
SymbolContext sc;
|
||||
sc.module_sp = m_obj_file->GetModule();
|
||||
sc.module_sp = m_objfile_sp->GetModule();
|
||||
lldbassert(sc.module_sp.get());
|
||||
|
||||
sc.comp_unit = ParseCompileUnitForUID(GetCompilandId(*pdb_data)).get();
|
||||
@ -1399,7 +1400,7 @@ void SymbolFilePDB::AddSymbols(lldb_private::Symtab &symtab) {
|
||||
if (!results)
|
||||
return;
|
||||
|
||||
auto section_list = m_obj_file->GetSectionList();
|
||||
auto section_list = m_objfile_sp->GetSectionList();
|
||||
if (!section_list)
|
||||
return;
|
||||
|
||||
@ -1672,7 +1673,7 @@ size_t SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
||||
llvm::Expected<lldb_private::TypeSystem &>
|
||||
SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
|
||||
auto type_system_or_err =
|
||||
m_obj_file->GetModule()->GetTypeSystemForLanguage(language);
|
||||
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
|
||||
if (type_system_or_err) {
|
||||
type_system_or_err->SetSymbolFile(this);
|
||||
}
|
||||
@ -1773,7 +1774,7 @@ lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitForUID(uint32_t id,
|
||||
// Don't support optimized code for now, DebugInfoPDB does not return this
|
||||
// information.
|
||||
LazyBool optimized = eLazyBoolNo;
|
||||
auto cu_sp = std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr,
|
||||
auto cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
|
||||
path.c_str(), id, lang, optimized);
|
||||
|
||||
if (!cu_sp)
|
||||
|
@ -35,10 +35,10 @@ public:
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
static lldb_private::SymbolFile *
|
||||
CreateInstance(lldb_private::ObjectFile *obj_file);
|
||||
CreateInstance(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFilePDB(lldb_private::ObjectFile *ofile);
|
||||
SymbolFilePDB(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
~SymbolFilePDB() override;
|
||||
|
||||
|
@ -43,8 +43,8 @@ const char *SymbolFileSymtab::GetPluginDescriptionStatic() {
|
||||
return "Reads debug symbols from an object file's symbol table.";
|
||||
}
|
||||
|
||||
SymbolFile *SymbolFileSymtab::CreateInstance(ObjectFile *obj_file) {
|
||||
return new SymbolFileSymtab(obj_file);
|
||||
SymbolFile *SymbolFileSymtab::CreateInstance(ObjectFileSP objfile_sp) {
|
||||
return new SymbolFileSymtab(std::move(objfile_sp));
|
||||
}
|
||||
|
||||
size_t SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope,
|
||||
@ -53,16 +53,16 @@ size_t SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope,
|
||||
return 0;
|
||||
}
|
||||
|
||||
SymbolFileSymtab::SymbolFileSymtab(ObjectFile *obj_file)
|
||||
: SymbolFile(obj_file), m_source_indexes(), m_func_indexes(),
|
||||
SymbolFileSymtab::SymbolFileSymtab(ObjectFileSP objfile_sp)
|
||||
: SymbolFile(std::move(objfile_sp)), m_source_indexes(), m_func_indexes(),
|
||||
m_code_indexes(), m_objc_class_name_to_index() {}
|
||||
|
||||
SymbolFileSymtab::~SymbolFileSymtab() {}
|
||||
|
||||
uint32_t SymbolFileSymtab::CalculateAbilities() {
|
||||
uint32_t abilities = 0;
|
||||
if (m_obj_file) {
|
||||
const Symtab *symtab = m_obj_file->GetSymtab();
|
||||
if (m_objfile_sp) {
|
||||
const Symtab *symtab = m_objfile_sp->GetSymtab();
|
||||
if (symtab) {
|
||||
// The snippet of code below will get the indexes the module symbol table
|
||||
// entries that are code, data, or function related (debug info), sort
|
||||
@ -122,10 +122,10 @@ CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) {
|
||||
// unit for the entire object file
|
||||
if (idx < m_source_indexes.size()) {
|
||||
const Symbol *cu_symbol =
|
||||
m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
|
||||
m_objfile_sp->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
|
||||
if (cu_symbol)
|
||||
cu_sp = std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr,
|
||||
cu_symbol->GetName().AsCString(), 0,
|
||||
cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
|
||||
cu_symbol->GetName().AsCString(), 0,
|
||||
eLanguageTypeUnknown, eLazyBoolNo);
|
||||
}
|
||||
return cu_sp;
|
||||
@ -139,10 +139,10 @@ size_t SymbolFileSymtab::ParseFunctions(CompileUnit &comp_unit) {
|
||||
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
||||
size_t num_added = 0;
|
||||
// We must at least have a valid compile unit
|
||||
const Symtab *symtab = m_obj_file->GetSymtab();
|
||||
const Symtab *symtab = m_objfile_sp->GetSymtab();
|
||||
const Symbol *curr_symbol = nullptr;
|
||||
const Symbol *next_symbol = nullptr;
|
||||
// const char *prefix = m_obj_file->SymbolPrefix();
|
||||
// const char *prefix = m_objfile_sp->SymbolPrefix();
|
||||
// if (prefix == NULL)
|
||||
// prefix == "";
|
||||
//
|
||||
@ -248,12 +248,12 @@ uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr,
|
||||
SymbolContextItem resolve_scope,
|
||||
SymbolContext &sc) {
|
||||
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
||||
if (m_obj_file->GetSymtab() == nullptr)
|
||||
if (m_objfile_sp->GetSymtab() == nullptr)
|
||||
return 0;
|
||||
|
||||
uint32_t resolved_flags = 0;
|
||||
if (resolve_scope & eSymbolContextSymbol) {
|
||||
sc.symbol = m_obj_file->GetSymtab()->FindSymbolContainingFileAddress(
|
||||
sc.symbol = m_objfile_sp->GetSymtab()->FindSymbolContainingFileAddress(
|
||||
so_addr.GetFileAddress());
|
||||
if (sc.symbol)
|
||||
resolved_flags |= eSymbolContextSymbol;
|
||||
|
@ -18,7 +18,7 @@
|
||||
class SymbolFileSymtab : public lldb_private::SymbolFile {
|
||||
public:
|
||||
// Constructors and Destructors
|
||||
SymbolFileSymtab(lldb_private::ObjectFile *obj_file);
|
||||
SymbolFileSymtab(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
~SymbolFileSymtab() override;
|
||||
|
||||
@ -32,7 +32,7 @@ public:
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
static lldb_private::SymbolFile *
|
||||
CreateInstance(lldb_private::ObjectFile *obj_file);
|
||||
CreateInstance(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
uint32_t CalculateAbilities() override;
|
||||
|
||||
|
@ -32,23 +32,23 @@ std::recursive_mutex &SymbolFile::GetModuleMutex() const {
|
||||
return GetObjectFile()->GetModule()->GetMutex();
|
||||
}
|
||||
ObjectFile *SymbolFile::GetMainObjectFile() {
|
||||
return m_obj_file->GetModule()->GetObjectFile();
|
||||
return m_objfile_sp->GetModule()->GetObjectFile();
|
||||
}
|
||||
|
||||
SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
|
||||
SymbolFile *SymbolFile::FindPlugin(ObjectFileSP objfile_sp) {
|
||||
std::unique_ptr<SymbolFile> best_symfile_up;
|
||||
if (obj_file != nullptr) {
|
||||
if (objfile_sp != nullptr) {
|
||||
|
||||
// We need to test the abilities of this section list. So create what it
|
||||
// would be with this new obj_file.
|
||||
lldb::ModuleSP module_sp(obj_file->GetModule());
|
||||
// would be with this new objfile_sp.
|
||||
lldb::ModuleSP module_sp(objfile_sp->GetModule());
|
||||
if (module_sp) {
|
||||
// Default to the main module section list.
|
||||
ObjectFile *module_obj_file = module_sp->GetObjectFile();
|
||||
if (module_obj_file != obj_file) {
|
||||
if (module_obj_file != objfile_sp.get()) {
|
||||
// Make sure the main object file's sections are created
|
||||
module_obj_file->GetSectionList();
|
||||
obj_file->CreateSections(*module_sp->GetUnifiedSectionList());
|
||||
objfile_sp->CreateSections(*module_sp->GetUnifiedSectionList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
|
||||
(create_callback = PluginManager::GetSymbolFileCreateCallbackAtIndex(
|
||||
idx)) != nullptr;
|
||||
++idx) {
|
||||
std::unique_ptr<SymbolFile> curr_symfile_up(create_callback(obj_file));
|
||||
std::unique_ptr<SymbolFile> curr_symfile_up(create_callback(objfile_sp));
|
||||
|
||||
if (curr_symfile_up) {
|
||||
const uint32_t sym_file_abilities = curr_symfile_up->GetAbilities();
|
||||
@ -88,7 +88,7 @@ SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
|
||||
llvm::Expected<TypeSystem &>
|
||||
SymbolFile::GetTypeSystemForLanguage(lldb::LanguageType language) {
|
||||
auto type_system_or_err =
|
||||
m_obj_file->GetModule()->GetTypeSystemForLanguage(language);
|
||||
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
|
||||
if (type_system_or_err) {
|
||||
type_system_or_err->SetSymbolFile(this);
|
||||
}
|
||||
|
@ -68,10 +68,8 @@ void SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp) {
|
||||
ModuleSP module_sp(GetModule());
|
||||
if (module_sp) {
|
||||
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
|
||||
if (objfile_sp) {
|
||||
m_objfile_sp = objfile_sp;
|
||||
m_sym_file_up.reset(SymbolFile::FindPlugin(objfile_sp.get()));
|
||||
}
|
||||
if (objfile_sp)
|
||||
m_sym_file_up.reset(SymbolFile::FindPlugin(objfile_sp));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user