34#include "llvm/ADT/STLExtras.h"
35#include "llvm/ADT/StringRef.h"
36#include "llvm/Support/ErrorExtras.h"
37#include "llvm/Support/ScopedPrinter.h"
77 "%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')",
78 static_cast<void *
>(
this),
81 std::vector<SymbolFileDWARFDebugMap::CompileUnitInfo *> cu_infos;
83 for (
auto comp_unit_info : cu_infos) {
94 assert(comp_unit_info->first_symbol_index !=
UINT32_MAX);
96 const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
97 for (uint32_t idx = comp_unit_info->first_symbol_index +
99 idx < oso_end_idx; ++idx) {
105 switch (exe_symbol->
GetType()) {
120 const Symbol *oso_fun_symbol =
124 if (oso_fun_symbol) {
150 const Symbol *oso_gsym_symbol =
154 if (exe_symbol && oso_gsym_symbol && exe_symbol->
ValueIsAddress() &&
183 const llvm::sys::TimePoint<> object_mod_time)
184 :
Module(file_spec, arch, object_name, object_offset, object_mod_time),
201 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
213 ObjectFile *exe_objfile = exe_module_sp->GetObjectFile();
214 SymbolFile *exe_symfile = exe_module_sp->GetSymbolFile();
216 if (exe_objfile && exe_symfile) {
247 return "DWARF and DWARF3 debug symbol file reader (debug map).";
302 std::vector<uint32_t> oso_indexes;
310 const uint32_t k_oso_symbol_flags_value = 0x660001u;
312 const uint32_t oso_index_count =
316 if (oso_index_count == 0)
327 for (uint32_t sym_idx :
340 for (uint32_t i = 0; i < oso_index_count; ++i) {
341 const uint32_t so_idx = oso_indexes[i] - 1;
342 const uint32_t oso_idx = oso_indexes[i];
345 if (so_symbol && oso_symbol &&
349 FileSpec::Style::native);
356 if (sibling_idx <= i || sibling_idx ==
UINT32_MAX) {
358 "N_SO in symbol with UID {0} has invalid sibling in debug "
360 "please file a bug and attach the binary listed in this error",
369 LLDB_LOGF(log,
"Initialized OSO 0x%8.8x: file=%s", i,
373 if (oso_symbol ==
nullptr)
375 "N_OSO symbol[{0}] can't be found, please file a bug and "
377 "the binary listed in this error",
379 else if (so_symbol ==
nullptr)
381 "N_SO not found for N_OSO symbol[{0}], please file a bug and "
382 "attach the binary listed in this error",
386 "N_SO has incorrect symbol type ({0}) for N_OSO "
388 "please file a bug and attach the binary listed in this error",
389 so_symbol->
GetType(), oso_idx);
392 "N_OSO has incorrect symbol type ({0}) for N_OSO "
394 "please file a bug and attach the binary listed in this error",
395 oso_symbol->
GetType(), oso_idx);
402 if (oso_idx < cu_count)
409 if (!comp_unit_info->
oso_sp) {
413 comp_unit_info->
oso_sp = pos->second;
416 comp_unit_info->
oso_sp = std::make_shared<OSOInfo>();
425 auto oso_mod_time = std::chrono::time_point_cast<std::chrono::seconds>(
430 if (comp_unit_info->
oso_mod_time != llvm::sys::TimePoint<>() &&
433 "debug map object file \"%s\" changed (actual: 0x%8.8x, debug "
434 "map: 0x%8.8x) since this executable was linked, debug info "
435 "will not be loaded",
437 (uint32_t)llvm::sys::toTimeT(oso_mod_time),
438 (uint32_t)llvm::sys::toTimeT(comp_unit_info->
oso_mod_time));
445 const bool must_exist =
true;
448 oso_object, must_exist)) {
450 "debug map object file \"%s\" containing debug info does not "
451 "exist, debug info will not be loaded",
471 comp_unit_info->
oso_sp->module_sp = std::make_shared<DebugMapModule>(
473 oso_arch, oso_object, 0,
474 oso_object ? comp_unit_info->
oso_mod_time : llvm::sys::TimePoint<>());
476 if (oso_object && !comp_unit_info->
oso_sp->module_sp->GetObjectFile() &&
482 "\"%s\" object from the \"%s\" archive: "
483 "either the .o file doesn't exist in the archive or the "
484 "modification time (0x%8.8x) of the .o file doesn't match",
486 (uint32_t)llvm::sys::toTimeT(comp_unit_info->
oso_mod_time));
490 if (comp_unit_info->
oso_sp)
491 return comp_unit_info->
oso_sp->module_sp.get();
539 if (first_comp_unit_info <= comp_unit_info &&
540 comp_unit_info <= last_comp_unit_info)
541 return comp_unit_info - first_comp_unit_info;
576 if (oso_index_count > 0) {
597 if (cu_idx < cu_count) {
606 cu_info.compile_units_sps.push_back(std::make_shared<CompileUnit>(
608 std::make_shared<SupportFile>(so_file_spec), cu_id,
610 cu_info.id_to_index_map.insert({0, 0});
615 auto num_dwarf_units = oso_symfile->DebugInfo().GetNumUnits();
616 for (
size_t i = 0; i < num_dwarf_units; ++i) {
617 auto *dwarf_unit = oso_symfile->DebugInfo().GetUnitAtIndex(i);
618 if (
auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(dwarf_unit)) {
620 if (dwarf_cu->GetID() == 0)
622 cu_info.compile_units_sps.push_back(std::make_shared<CompileUnit>(
624 std::make_shared<SupportFile>(so_file_spec),
626 cu_info.id_to_index_map.insert(
627 {dwarf_cu->GetID(), cu_info.compile_units_sps.size() - 1});
633 if (!cu_info.compile_units_sps.empty())
634 comp_unit_sp = cu_info.compile_units_sps[0];
648 for (uint32_t i = 0; i < cu_count; ++i) {
651 auto it = id_to_index_map.find(comp_unit.
GetID());
652 if (it != id_to_index_map.end() &&
662 std::vector<CompileUnitInfo *> &cu_infos) {
664 for (uint32_t i = 0; i < cu_count; ++i) {
668 return cu_infos.size();
688llvm::SmallSet<lldb::LanguageType, 4>
691 llvm::SmallSet<lldb::LanguageType, 4> langs;
693 for (
auto &comp_unit : info->compile_units_sps) {
724 std::string description,
727 Progress progress(std::move(description),
"", num_oso_idxs,
730 for (uint32_t oso_idx = 0; oso_idx < num_oso_idxs; ++oso_idx) {
732 progress.
Increment(oso_idx, oso_dwarf->GetObjectName());
741 llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
742 llvm::function_ref<
bool(
Module &)> f) {
768 const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
814std::optional<SymbolFile::ArrayInfo>
825 bool success =
false;
841 SymbolContextItem resolve_scope,
844 uint32_t resolved_flags = 0;
851 if (debug_map_entry) {
854 symtab->
SymbolAtIndex(debug_map_entry->data.GetExeSymbolIndex());
856 if (sc.
symbol !=
nullptr) {
857 resolved_flags |= eSymbolContextSymbol;
859 uint32_t oso_idx = 0;
860 CompileUnitInfo *comp_unit_info =
862 if (comp_unit_info) {
863 comp_unit_info->GetFileRangeMap(
this);
867 exe_file_addr - debug_map_entry->GetRangeBase() +
868 debug_map_entry->data.GetOSOFileAddress();
872 resolved_flags |= sym_file->ResolveSymbolContext(
873 oso_so_addr, resolve_scope, sc);
877 "Failed to get symfile for OSO: {0} in module: {1}",
888 return resolved_flags;
892 const SourceLocationSpec &src_location_spec,
893 SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
895 const uint32_t initial = sc_list.
GetSize();
898 for (uint32_t i = 0; i < cu_count; ++i) {
904 FileSpec so_file_spec;
916 return sc_list.
GetSize() - initial;
921 const std::vector<uint32_t>
924 const size_t match_count = indexes.size();
925 for (
size_t i = 0; i < match_count; ++i) {
929 if (comp_unit_info) {
934 if (variables.
GetSize() > max_matches)
945 uint32_t total_matches = 0;
949 const uint32_t old_size = variables.
GetSize();
952 const uint32_t oso_matches = variables.
GetSize() - old_size;
953 if (oso_matches > 0) {
954 total_matches += oso_matches;
961 if (max_matches >= total_matches)
966 max_matches -= oso_matches;
977 uint32_t total_matches = 0;
980 const uint32_t old_size = variables.
GetSize();
983 const uint32_t oso_matches = variables.
GetSize() - old_size;
984 if (oso_matches > 0) {
985 total_matches += oso_matches;
992 if (max_matches >= total_matches)
997 max_matches -= oso_matches;
1006 const uint32_t symbol_idx = *symbol_idx_ptr;
1008 if (symbol_idx < comp_unit_info->first_symbol_index)
1011 if (symbol_idx <= comp_unit_info->last_symbol_index)
1019 const user_id_t symbol_id = *symbol_idx_ptr;
1021 if (symbol_id < comp_unit_info->first_symbol_id)
1024 if (symbol_id <= comp_unit_info->last_symbol_id)
1032 uint32_t symbol_idx, uint32_t *oso_idx_ptr) {
1035 if (oso_index_count) {
1043 if (comp_unit_info !=
nullptr)
1048 return comp_unit_info;
1053 user_id_t symbol_id, uint32_t *oso_idx_ptr) {
1056 if (oso_index_count) {
1064 if (comp_unit_info !=
nullptr)
1069 return comp_unit_info;
1074 uint32_t start_idx) {
1081 uint32_t i = start_idx;
1082 while (i < sc_list.
GetSize()) {
1087 if (section_sp->GetModule() != module_sp) {
1105 uint32_t sc_idx = sc_list.
GetSize();
1106 oso_dwarf.
FindFunctions(lookup_info, parent_decl_ctx, include_inlines,
1117 bool include_inlines,
1121 regex.
GetText().str().c_str());
1124 uint32_t sc_idx = sc_list.
GetSize();
1136 lldb::TypeClass type_mask,
1151 oso_dwarf->
GetTypes(sc_scope, type_mask, type_list);
1155 oso_dwarf.
GetTypes(sc_scope, type_mask, type_list);
1161std::vector<std::unique_ptr<lldb_private::CallEdge>>
1192 if (module_objfile) {
1198 if (objc_class_symbol) {
1201 const Symbol *source_file_symbol = symtab->
GetParent(objc_class_symbol);
1203 if (source_file_symbol &&
1205 const uint32_t source_file_symbol_idx =
1211 if (compile_unit_info) {
1215 die, type_name, must_be_implementation));
1230 if (!must_be_implementation) {
1234 "Looking up Objective-C definition", [&](
SymbolFileDWARF &oso_dwarf) {
1236 die, type_name, must_be_implementation);
1257 bool only_root_namespaces) {
1262 matching_namespace =
1263 oso_dwarf.
FindNamespace(name, parent_decl_ctx, only_root_namespaces);
1269 return matching_namespace;
1285 bool load_all_debug_info) {
1288 for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1291 std::make_shared<StructuredData::Dictionary>();
1292 oso_data->AddStringItem(
"so_file", info.so_file.GetPath());
1293 oso_data->AddStringItem(
"oso_path", info.oso_path);
1294 oso_data->AddIntegerItem(
"oso_mod_time",
1295 (uint32_t)llvm::sys::toTimeT(info.oso_mod_time));
1297 bool loaded_successfully =
false;
1301 if (!info.oso_load_error.Fail()) {
1302 loaded_successfully =
true;
1305 if (!loaded_successfully) {
1306 oso_data->AddStringItem(
"error", info.oso_load_error.AsCString());
1308 oso_data->AddBooleanItem(
"loaded", loaded_successfully);
1309 if (!errors_only || oso_data->HasKey(
"error"))
1310 separate_debug_info_files.
AddItem(oso_data);
1315 d.
AddItem(
"separate-debug-info-files",
1316 std::make_shared<StructuredData::Array>(
1317 std::move(separate_debug_info_files)));
1326 for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1329 if (oso_symfile == oso_dwarf) {
1334 auto it = id_to_index_map.find(dwarf_cu.
GetID());
1335 if (it != id_to_index_map.end())
1337 .compile_units_sps[it->getSecond()];
1341 llvm_unreachable(
"this shouldn't happen");
1348 for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1351 if (oso_symfile == oso_dwarf) {
1363 for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1366 if (oso_symfile == oso_dwarf) {
1371 assert(cu_sp->GetID() == 0 &&
1372 "Setting first compile unit but with id different than 0!");
1373 auto &compile_units_sps =
1375 compile_units_sps.push_back(cu_sp);
1377 {cu_sp->GetID(), compile_units_sps.size() - 1});
1402std::vector<CompilerContext>
1423 const uint32_t debug_map_idx =
1424 m_debug_map.FindEntryIndexThatContains(exe_file_addr);
1428 debug_map_entry->
data.SetOSOFileAddress(oso_file_addr);
1429 addr_t range_size = std::min<addr_t>(exe_byte_size, oso_byte_size);
1430 if (range_size == 0) {
1431 range_size = std::max<addr_t>(exe_byte_size, oso_byte_size);
1432 if (range_size == 0)
1444#if defined(DEBUG_OSO_DMAP)
1446 const size_t n = oso_file_range_map.
GetSize();
1447 printf(
"SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s\n",
1448 cu_info, cu_info->
oso_sp->module_sp->GetFileSpec().GetPath().c_str());
1449 for (
size_t i = 0; i < n; ++i) {
1451 printf(
"oso [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
1452 ") ==> exe [0x%16.16" PRIx64
" - 0x%16.16" PRIx64
")\n",
1466 if (oso_range_entry) {
1469 if (debug_map_entry) {
1474 return exe_file_addr;
1485 if (addr_module == exe_module)
1494 if (oso_range_entry) {
1497 if (debug_map_entry) {
1520 size_t num_line_entries_added = 0;
1521 if (debug_aranges && dwarf2Data) {
1523 if (compile_unit_info) {
1526 for (
size_t idx = 0; idx < file_range_map.
GetSize(); idx++) {
1532 num_line_entries_added++;
1537 return num_line_entries_added;
1547 oso_modules.
Append(module_sp);
1566 if (debug_map_entry) {
1570 uint32_t oso_idx = 0;
1573 if (comp_unit_info) {
1589 "unable to load debug map object file \"%s\" "
1590 "exist, debug info will not be loaded",
1601 std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
1609llvm::Expected<SymbolContext>
1614 return llvm::createStringErrorV(
1615 "couldn't find symbol file for {0} in debug-map.", label);
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp, SymbolContextList &sc_list, uint32_t start_idx)
#define LLDB_SCOPED_TIMERF(...)
A section + offset based address class.
lldb::SectionSP GetSection() const
Get const accessor for the section.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetFileAddress() const
Get the file address.
An architecture specification class.
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
A class that describes a compilation unit.
lldb::LanguageType GetLanguage()
Represents a generic declaration context in a program.
Generic representation of a type in a programming language.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
static FileSystem & Instance()
A class that describes a function.
const Address & GetAddress() const
Return the address of the function (its entry point).
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
LineTable * LinkLineTable(const FileRangeMap &file_range_map)
ConstString GetName(NamePreference preference=ePreferDemangled) const
Best name get accessor.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A collection class for Module objects.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
A class that encapsulates name lookup information.
ConstString GetLookupName() const
A class that describes an executable image and its associated object and symbol files.
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
virtual SymbolFile * GetSymbolFile(bool can_create=true, Stream *feedback_strm=nullptr)
Get the module's symbol file.
std::recursive_mutex m_mutex
A mutex to keep this object happy in multi-threaded environments.
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
lldb::SymbolVendorUP m_symfile_up
A pointer to the symbol vendor for this module.
Module(const FileSpec &file_spec, const ArchSpec &arch, ConstString object_name=ConstString(), lldb::offset_t object_offset=0, const llvm::sys::TimePoint<> &object_mod_time=llvm::sys::TimePoint<>())
Construct with file specification and architecture.
std::string GetSpecificationDescription() const
Get the module path and object name.
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
A plug-in interface definition class for object file parsers.
Symtab * GetSymtab(bool can_create=true)
Gets the symbol table for the currently selected architecture (and object for archives).
@ eTypeExecutable
A normal executable.
@ eTypeDebugInfo
An object file that contains only debug information.
@ eTypeStubLibrary
A library that can be linked against but not used for execution.
@ eTypeObjectFile
An intermediate object file.
@ eTypeDynamicLinker
The platform's dynamic linker executable.
@ eTypeCoreFile
A core file that has a checkpoint of a program's execution state.
@ eTypeSharedLibrary
A shared library that can be used during execution.
@ eTypeJIT
JIT code that has symbols, sections and possibly debug info.
virtual void ClearSymtab()
Frees the symbol table.
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
static bool SplitArchivePathWithObject(llvm::StringRef path_with_object, lldb_private::FileSpec &archive_file, lldb_private::ConstString &archive_object, bool must_exist)
Split a path into a file path with object name.
virtual llvm::StringRef GetPluginName()=0
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A Progress indicator helper class.
void Increment(uint64_t amount=1, std::optional< std::string > updated_detail={})
Increment the progress and send a notification to the installed callback.
static constexpr std::chrono::milliseconds kDefaultHighFrequencyReportTime
The default report time for high frequency progress reports.
Entry & GetEntryRef(size_t i)
const Entry * GetEntryAtIndex(size_t i) const
RangeData< lldb::addr_t, lldb::addr_t, OSOEntry > Entry
void Append(const Entry &entry)
Entry * FindEntryThatContains(B addr)
llvm::StringRef GetText() const
Access the regular expression text.
bool GetCheckInlines() const
FileSpec GetFileSpec() const
This base class provides an interface to stack frames.
virtual const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
Status Clone() const
Don't call this function in new code.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
A stream class that can stream formatted output to a file.
void AddItem(const ObjectSP &item)
void AddStringItem(llvm::StringRef key, llvm::StringRef value)
void AddItem(llvm::StringRef key, ObjectSP value_sp)
std::shared_ptr< Dictionary > DictionarySP
A list of support files for a CompileUnit.
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
uint32_t GetSize() const
Get accessor for a symbol context list size.
bool RemoveContextAtIndex(size_t idx)
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
virtual void CalculateSymbolContext(SymbolContext *sc)=0
Reconstruct the object's symbol context into sc.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
Symbol * symbol
The Symbol for a given query.
ObjectFile * GetObjectFile() override
lldb::ObjectFileSP m_objfile_sp
ObjectFile * GetMainObjectFile() override
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
uint32_t GetNumCompileUnits() override
Provides public interface for all SymbolFiles.
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
Status GetFrameVariableError(StackFrame &frame)
Get an error that describes why variables might be missing for a given symbol context.
std::unordered_map< lldb::CompUnitSP, Args > GetCompileOptions()
Returns a map of compilation unit to the compile option arguments associated with that compilation un...
uint32_t GetSiblingIndex() const
uint64_t GetIntegerValue(uint64_t fail_value=0) const
bool ValueIsAddress() const
Address & GetAddressRef()
lldb::addr_t GetByteSize() const
ConstString GetName() const
lldb::SymbolType GetType() const
Symbol * SymbolAtIndex(size_t idx)
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
void SortSymbolIndexesByValue(std::vector< uint32_t > &indexes, bool remove_duplicates) const
uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
uint32_t GetIndexForSymbol(const Symbol *symbol) const
uint32_t AppendSymbolIndexesWithTypeAndFlagsValue(lldb::SymbolType symbol_type, uint32_t flags_value, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
const Symbol * GetParent(Symbol *symbol) const
Get the parent symbol for the given symbol.
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
An abstraction for Xcode-style SDKs that works like ArchSpec.
void AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc)
~DebugMapModule() override=default
DebugMapModule(const ModuleSP &exe_module_sp, uint32_t cu_idx, const FileSpec &file_spec, const ArchSpec &arch, ConstString object_name, off_t object_offset, const llvm::sys::TimePoint<> object_mod_time)
SymbolFile * GetSymbolFile(bool can_create=true, lldb_private::Stream *feedback_strm=nullptr) override
Get the module's symbol file.
void ForEachSymbolFile(std::string description, std::function< IterationAction(SymbolFileDWARF &)> closure)
If closure returns IterationAction::Continue, iteration continues.
SymbolFileDWARF * GetSymbolFileByOSOIndex(uint32_t oso_idx)
static SymbolFileDWARF * GetSymbolFileAsSymbolFileDWARF(SymbolFile *sym_file)
static llvm::StringRef GetPluginDescriptionStatic()
RangeDataVector< lldb::addr_t, lldb::addr_t, lldb::addr_t > FileRangeMap
Status CalculateFrameVariableError(StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
CompileUnitInfo * GetCompUnitInfo(const SymbolContext &sc)
ObjectFile * GetObjectFileByOSOIndex(uint32_t oso_idx)
std::map< std::pair< ConstString, llvm::sys::TimePoint<> >, OSOInfoSP > m_oso_map
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
void DumpClangAST(Stream &s, llvm::StringRef filter, bool show_color) override
void ParseDeclsForContext(CompilerDeclContext decl_ctx) override
bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only, bool load_all_debug_info=false) override
List separate oso files.
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
bool ParseDebugMacros(CompileUnit &comp_unit) override
SymbolFileDWARF * GetSymbolFileByCompUnitInfo(CompileUnitInfo *comp_unit_info)
lldb::CompUnitSP GetCompileUnit(SymbolFileDWARF *oso_dwarf, DWARFCompileUnit &dwarf_cu)
Returns the compile unit associated with the dwarf compile unit.
bool ForEachExternalModule(CompileUnit &, llvm::DenseSet< SymbolFile * > &, llvm::function_ref< bool(Module &)>) override
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
CompileUnitInfo * GetCompileUnitInfoForSymbolWithIndex(uint32_t symbol_idx, uint32_t *oso_idx_ptr)
bool CompleteType(CompilerType &compiler_type) override
bool ParseLineTable(CompileUnit &comp_unit) override
ModuleList GetDebugInfoModules() override
Get the additional modules that this symbol file uses to parse debug info.
std::vector< uint32_t > m_glob_indexes
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
This function actually returns the first compile unit the object file at the given index contains.
friend class SymbolFileDWARF
friend class DWARFCompileUnit
std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid) override
lldb::addr_t LinkOSOFileAddress(SymbolFileDWARF *oso_symfile, lldb::addr_t oso_file_addr)
Convert a .o file "file address" to an executable "file address".
SymbolFileDWARF * GetSymbolFile(const SymbolContext &sc)
bool ParseIsOptimized(CompileUnit &comp_unit) override
void PrivateFindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, const std::vector< uint32_t > &name_symbol_indexes, uint32_t max_matches, VariableList &variables)
void FindTypes(const lldb_private::TypeQuery &match, lldb_private::TypeResults &results) override
Find types using a type-matching object that contains all search parameters.
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
CompileUnitInfo * GetCompileUnitInfo(SymbolFileDWARF *oso_dwarf)
size_t ParseBlocksRecursive(Function &func) override
bool GetFileSpecForSO(uint32_t oso_idx, FileSpec &file_spec)
ObjectFile * GetObjectFileByCompUnitInfo(CompileUnitInfo *comp_unit_info)
static SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override
static llvm::StringRef GetPluginNameStatic()
size_t ParseVariablesForContext(const SymbolContext &sc) override
llvm::SmallSet< lldb::LanguageType, 4 > ParseAllLanguages(CompileUnit &comp_unit) override
This function exists because SymbolFileDWARFDebugMap may extra compile units which aren't exposed as ...
static char ID
LLVM RTTI support.
Module * GetModuleByOSOIndex(uint32_t oso_idx)
uint32_t GetCompUnitInfoIndex(const CompileUnitInfo *comp_unit_info)
Module * GetModuleByCompUnitInfo(CompileUnitInfo *comp_unit_info)
size_t ParseFunctions(CompileUnit &comp_unit) override
XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
size_t AddOSOARanges(SymbolFileDWARF *dwarf2Data, DWARFDebugAranges *debug_aranges)
~SymbolFileDWARFDebugMap() override
uint32_t CalculateAbilities() override
static uint32_t GetOSOIndexFromUserID(lldb::user_id_t uid)
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
SymbolFileDWARFDebugMap(lldb::ObjectFileSP objfile_sp)
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
llvm::Expected< SymbolContext > ResolveFunctionCallLabel(FunctionCallLabel &label) override
Resolves the function corresponding to the specified LLDB function call label.
bool AddOSOFileRange(CompileUnitInfo *cu_info, lldb::addr_t exe_file_addr, lldb::addr_t exe_byte_size, lldb::addr_t oso_file_addr, lldb::addr_t oso_byte_size)
bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files) override
void SetCompileUnit(SymbolFileDWARF *oso_dwarf, const lldb::CompUnitSP &cu_sp)
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static int SymbolContainsSymbolWithID(lldb::user_id_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info)
static int SymbolContainsSymbolWithIndex(uint32_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info)
uint32_t CalculateNumCompileUnits() override
This function actually returns the number of object files, which may be less than the actual number o...
void FinalizeOSOFileRanges(CompileUnitInfo *cu_info)
bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules) override
std::vector< uint32_t > m_func_indexes
std::bitset< kNumFlags > m_flags
size_t ParseTypes(CompileUnit &comp_unit) override
size_t GetCompUnitInfosForModule(const Module *oso_module, std::vector< CompileUnitInfo * > &cu_infos)
bool LinkOSOAddress(Address &addr)
Convert addr from a .o file address, to an executable address.
void InitializeObject() override
Initialize the SymbolFile object.
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
CompileUnitInfo * GetCompileUnitInfoForSymbolWithID(lldb::user_id_t symbol_id, uint32_t *oso_idx_ptr)
std::vector< CompileUnitInfo > m_compile_unit_infos
LineTable * LinkOSOLineTable(SymbolFileDWARF *oso_symfile, LineTable *line_table)
Given a line table full of lines with "file addresses" that are for a .o file represented by oso_symf...
DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
virtual DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
bool ForEachExternalModule(CompileUnit &, llvm::DenseSet< SymbolFile * > &, llvm::function_ref< bool(Module &)>) override
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
llvm::Expected< SymbolContext > ResolveFunctionCallLabel(FunctionCallLabel &label) override
Resolves the function corresponding to the specified LLDB function call label.
void SetDebugMapModule(const lldb::ModuleSP &module_sp)
void DumpClangAST(Stream &s, llvm::StringRef filter, bool show_colors) override
std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid) override
static llvm::StringRef GetPluginNameStatic()
void FindTypes(const lldb_private::TypeQuery &match, lldb_private::TypeResults &results) override
Find types using a type-matching object that contains all search parameters.
size_t ParseVariablesForContext(const SymbolContext &sc) override
void GetCompileOptions(std::unordered_map< lldb::CompUnitSP, Args > &args) override
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
size_t ParseBlocksRecursive(Function &func) override
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
size_t ParseFunctions(CompileUnit &comp_unit) override
bool ParseDebugMacros(CompileUnit &comp_unit) override
bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files) override
XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules) override
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
void ParseDeclsForContext(CompilerDeclContext decl_ctx) override
size_t ParseTypes(CompileUnit &comp_unit) override
bool CompleteType(CompilerType &compiler_type) override
bool ParseLineTable(CompileUnit &comp_unit) override
bool ParseIsOptimized(CompileUnit &comp_unit) override
void SetFileIndex(std::optional< uint64_t > file_index)
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
bool HasForwardDeclForCompilerType(const CompilerType &compiler_type)
CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
std::optional< uint64_t > GetFileIndex() const
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
int(* ComparisonFunction)(const void *, const void *)
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
std::weak_ptr< lldb_private::Module > ModuleWP
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
Holds parsed information about a function call label that LLDB attaches as an AsmLabel to function AS...
lldb::user_id_t symbol_id
Unique identifier of the function symbol on which to perform the function call.
BaseType GetRangeBase() const
SizeType GetByteSize() const
BaseType GetRangeEnd() const
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.
const FileRangeMap & GetFileRangeMap(SymbolFileDWARFDebugMap *exe_symfile)
bool file_range_map_valid
llvm::sys::TimePoint oso_mod_time
FileRangeMap file_range_map