mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-16 21:21:06 +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);
|
DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppleDWARFIndex::ReportInvalidDIEOffset(dw_offset_t offset,
|
void AppleDWARFIndex::ReportInvalidDIERef(const DIERef &ref,
|
||||||
llvm::StringRef name) {
|
llvm::StringRef name) {
|
||||||
m_module.ReportErrorIfModifyDetected(
|
m_module.ReportErrorIfModifyDetected(
|
||||||
"the DWARF debug information has been modified (accelerator table had "
|
"the DWARF debug information has been modified (accelerator table had "
|
||||||
"bad die 0x%8.8x for '%s')\n",
|
"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) {
|
void AppleDWARFIndex::Dump(Stream &s) {
|
||||||
|
@ -48,8 +48,7 @@ public:
|
|||||||
std::vector<DWARFDIE> &dies) override;
|
std::vector<DWARFDIE> &dies) override;
|
||||||
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
||||||
|
|
||||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override;
|
||||||
llvm::StringRef name) override;
|
|
||||||
void Dump(Stream &s) override;
|
void Dump(Stream &s) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -24,7 +24,7 @@ void DWARFIndex::ProcessFunctionDIE(llvm::StringRef name, DIERef ref,
|
|||||||
std::vector<DWARFDIE> &dies) {
|
std::vector<DWARFDIE> &dies) {
|
||||||
DWARFDIE die = info.GetDIE(ref);
|
DWARFDIE die = info.GetDIE(ref);
|
||||||
if (!die) {
|
if (!die) {
|
||||||
ReportInvalidDIEOffset(ref.die_offset, name);
|
ReportInvalidDIERef(ref, name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,7 @@ public:
|
|||||||
virtual void GetFunctions(const RegularExpression ®ex,
|
virtual void GetFunctions(const RegularExpression ®ex,
|
||||||
DIEArray &offsets) = 0;
|
DIEArray &offsets) = 0;
|
||||||
|
|
||||||
virtual void ReportInvalidDIEOffset(dw_offset_t offset,
|
virtual void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) = 0;
|
||||||
llvm::StringRef name) = 0;
|
|
||||||
virtual void Dump(Stream &s) = 0;
|
virtual void Dump(Stream &s) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -41,8 +41,7 @@ public:
|
|||||||
void GetFunctions(const RegularExpression ®ex,
|
void GetFunctions(const RegularExpression ®ex,
|
||||||
DIEArray &offsets) override;
|
DIEArray &offsets) override;
|
||||||
|
|
||||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
|
||||||
llvm::StringRef name) override {}
|
|
||||||
void Dump(Stream &s) override;
|
void Dump(Stream &s) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -39,8 +39,7 @@ public:
|
|||||||
std::vector<DWARFDIE> &dies) override;
|
std::vector<DWARFDIE> &dies) override;
|
||||||
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
void GetFunctions(const RegularExpression ®ex, DIEArray &offsets) override;
|
||||||
|
|
||||||
void ReportInvalidDIEOffset(dw_offset_t offset,
|
void ReportInvalidDIERef(const DIERef &ref, llvm::StringRef name) override {}
|
||||||
llvm::StringRef name) override {}
|
|
||||||
void Dump(Stream &s) override;
|
void Dump(Stream &s) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -2064,8 +2064,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||||
name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2128,7 +2127,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex,
|
|||||||
if (variables.GetSize() - original_size >= max_matches)
|
if (variables.GetSize() - original_size >= max_matches)
|
||||||
break;
|
break;
|
||||||
} else
|
} 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) {
|
for (DIERef ref : offsets) {
|
||||||
DWARFDIE die = info->GetDIE(ref);
|
DWARFDIE die = info->GetDIE(ref);
|
||||||
if (!die) {
|
if (!die) {
|
||||||
m_index->ReportInvalidDIEOffset(ref.die_offset, regex.GetText());
|
m_index->ReportInvalidDIERef(ref, regex.GetText());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (resolved_dies.insert(die.GetDIE()).second)
|
if (resolved_dies.insert(die.GetDIE()).second)
|
||||||
@ -2415,8 +2414,7 @@ uint32_t SymbolFileDWARF::FindTypes(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||||
name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const uint32_t num_matches = types.GetSize() - initial_types_size;
|
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;
|
++num_matches;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||||
name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return num_matches;
|
return num_matches;
|
||||||
@ -2540,8 +2537,7 @@ SymbolFileDWARF::FindNamespace(ConstString name,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
|
||||||
name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2751,8 +2747,7 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
|
||||||
type_name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2959,8 +2954,7 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset,
|
m_index->ReportInvalidDIERef(die_ref, type_name.GetStringRef());
|
||||||
type_name.GetStringRef());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3127,7 +3121,7 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) {
|
|||||||
++vars_added;
|
++vars_added;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
m_index->ReportInvalidDIEOffset(die_ref.die_offset, "");
|
m_index->ReportInvalidDIERef(die_ref, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user