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 {}
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) {
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;
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.
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
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 {
}
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;
// 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) {
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);
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 "
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);
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());
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);
}
addr_t SymbolFileBreakpad::GetBaseFileAddress() {
- return m_obj_file->GetModule()
+ return m_objfile_sp->GetModule()
->GetObjectFile()
->GetBaseAddress()
.GetFileAddress();
// 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())));
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);
"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)
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 {}
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);
}
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() {}
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);
}
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;
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;
}
}
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
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.");
}
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;
return;
data.Clear();
- m_obj_file->ReadSectionData(section_sp.get(), data);
+ m_objfile_sp->ReadSectionData(section_sp.get(), data);
}
const DWARFDataExtractor &SymbolFileDWARF::DebugLocData() {
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) {
}
}
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
// 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;
}
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;
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
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();
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,
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());
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 =
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;
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() {}
// 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:
// 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));
// 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());
}
} 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);
// 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()
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) {
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();
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;
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;
// 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) {
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;
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();
DWARFCompileUnit *ComputeCompileUnit();
- lldb::ObjectFileSP m_obj_file_sp;
DWARFCompileUnit &m_base_dwarf_cu;
DWARFCompileUnit *m_cu = nullptr;
};
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.
}
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),
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);
}
}
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);
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);
}
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;
}
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.
}
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)
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(
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();
if (!results)
return;
- auto section_list = m_obj_file->GetSectionList();
+ auto section_list = m_objfile_sp->GetSectionList();
if (!section_list)
return;
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);
}
// 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)
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;
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,
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
// 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;
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 == "";
//
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;
class SymbolFileSymtab : public lldb_private::SymbolFile {
public:
// Constructors and Destructors
- SymbolFileSymtab(lldb_private::ObjectFile *obj_file);
+ SymbolFileSymtab(lldb::ObjectFileSP objfile_sp);
~SymbolFileSymtab() override;
static const char *GetPluginDescriptionStatic();
static lldb_private::SymbolFile *
- CreateInstance(lldb_private::ObjectFile *obj_file);
+ CreateInstance(lldb::ObjectFileSP objfile_sp);
uint32_t CalculateAbilities() override;
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());
}
}
(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();
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);
}
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));
}
}