mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-29 03:04:39 +00:00
DWARFIndex: s/ReportInvalidDIEOffset/ReportInvalidDIERef
In a dwo/debug_types world, the die offset is not enough to uniquely idendify a debug info entry. Pass the the entire DIERef object instead. This is technically NFC, because only AppleIndex implemented this method (and there, the die offset *is* enough for unique identification). However, this makes the code simpler, and simplifies some of the follow-up patches. llvm-svn: 363373
This commit is contained in:
parent
30557ace0f
commit
78b2cf71f5
@ -155,12 +155,12 @@ void AppleDWARFIndex::GetFunctions(const RegularExpression ®ex,
|
||||
DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
|
||||
}
|
||||
|
||||
void AppleDWARFIndex::ReportInvalidDIEOffset(dw_offset_t offset,
|
||||
llvm::StringRef name) {
|
||||
void AppleDWARFIndex::ReportInvalidDIERef(const DIERef &ref,
|
||||
llvm::StringRef name) {
|
||||
m_module.ReportErrorIfModifyDetected(
|
||||
"the DWARF debug information has been modified (accelerator table had "
|
||||
"bad die 0x%8.8x for '%s')\n",
|
||||
offset, name.str().c_str());
|
||||
ref.die_offset, name.str().c_str());
|
||||
}
|
||||
|
||||
void AppleDWARFIndex::Dump(Stream &s) {
|
||||
|
@ -48,8 +48,7 @@ public:
|
||||
std::vector<DWARFDIE> &dies) override;
|
||||
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
||||
|
||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
||||
llvm::StringRef name) override;
|
||||
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override;
|
||||
void Dump(Stream &s) override;
|
||||
|
||||
private:
|
||||
|
@ -24,7 +24,7 @@ void DWARFIndex::ProcessFunctionDIE(llvm::StringRef name, DIERef ref,
|
||||
std::vector<DWARFDIE> &dies) {
|
||||
DWARFDIE die = info.GetDIE(ref);
|
||||
if (!die) {
|
||||
ReportInvalidDIEOffset(ref.die_offset, name);
|
||||
ReportInvalidDIERef(ref, name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,7 @@ public:
|
||||
virtual void GetFunctions(const RegularExpression ®ex,
|
||||
DIEArray &offsets) = 0;
|
||||
|
||||
virtual void ReportInvalidDIEOffset(dw_offset_t offset,
|
||||
llvm::StringRef name) = 0;
|
||||
virtual void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) = 0;
|
||||
virtual void Dump(Stream &s) = 0;
|
||||
|
||||
protected:
|
||||
|
@ -41,8 +41,7 @@ public:
|
||||
void GetFunctions(const RegularExpression ®ex,
|
||||
DIEArray &offsets) override;
|
||||
|
||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
||||
llvm::StringRef name) override {}
|
||||
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
|
||||
void Dump(Stream &s) override;
|
||||
|
||||
private:
|
||||
|
@ -39,8 +39,7 @@ public:
|
||||
std::vector<DWARFDIE> &dies) override;
|
||||
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
||||
|
||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
||||
llvm::StringRef name) override {}
|
||||
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
|
||||
void Dump(Stream &s) override;
|
||||
|
||||
private:
|
||||
|
@ -2064,8 +2064,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(
|
||||
} break;
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2128,7 +2127,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex,
|
||||
if (variables.GetSize() - original_size >= max_matches)
|
||||
break;
|
||||
} else
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset, regex.GetText());
|
||||
m_index->ReportInvalidDIERef(die_ref, regex.GetText());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2312,7 +2311,7 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression ®ex,
|
||||
for (DIERef ref : offsets) {
|
||||
DWARFDIE die = info->GetDIE(ref);
|
||||
if (!die) {
|
||||
m_index->ReportInvalidDIEOffset(ref.die_offset, regex.GetText());
|
||||
m_index->ReportInvalidDIERef(ref, regex.GetText());
|
||||
continue;
|
||||
}
|
||||
if (resolved_dies.insert(die.GetDIE()).second)
|
||||
@ -2415,8 +2414,7 @@ uint32_t SymbolFileDWARF::FindTypes(
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||
}
|
||||
}
|
||||
const uint32_t num_matches = types.GetSize() - initial_types_size;
|
||||
@ -2494,8 +2492,7 @@ size_t SymbolFileDWARF::FindTypes(const std::vector<CompilerContext> &context,
|
||||
++num_matches;
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||
}
|
||||
}
|
||||
return num_matches;
|
||||
@ -2540,8 +2537,7 @@ SymbolFileDWARF::FindNamespace(ConstString name,
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2751,8 +2747,7 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
type_name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2959,8 +2954,7 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
||||
type_name.GetStringRef());
|
||||
m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3127,7 +3121,7 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) {
|
||||
++vars_added;
|
||||
}
|
||||
} else
|
||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset, "");
|
||||
m_index->ReportInvalidDIERef(die_ref, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user