mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
llvm-dwarfdump: Make the "is debug info section" heuristic stricter so it doesn't accidentaly picks up the wrong section.
Also add some validation code to the aranges section parser. Fixes PR10926. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139701 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -72,6 +72,13 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
|
|||||||
Header.AddrSize = data.getU8(offset_ptr);
|
Header.AddrSize = data.getU8(offset_ptr);
|
||||||
Header.SegSize = data.getU8(offset_ptr);
|
Header.SegSize = data.getU8(offset_ptr);
|
||||||
|
|
||||||
|
// Perform basic validation of the header fields.
|
||||||
|
if (!data.isValidOffsetForDataOfSize(Offset, Header.Length) ||
|
||||||
|
(Header.AddrSize != 4 && Header.AddrSize != 8)) {
|
||||||
|
clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// The first tuple following the header in each set begins at an offset
|
// The first tuple following the header in each set begins at an offset
|
||||||
// that is a multiple of the size of a single tuple (that is, twice the
|
// that is a multiple of the size of a single tuple (that is, twice the
|
||||||
// size of an address). The header is padded, if necessary, to the
|
// size of an address). The header is padded, if necessary, to the
|
||||||
|
@ -62,13 +62,17 @@ static void DumpInput(const StringRef &Filename) {
|
|||||||
i->getName(name);
|
i->getName(name);
|
||||||
StringRef data;
|
StringRef data;
|
||||||
i->getContents(data);
|
i->getContents(data);
|
||||||
if (name.endswith("debug_info"))
|
|
||||||
|
if (name.startswith("__DWARF,"))
|
||||||
|
name = name.substr(8); // Skip "__DWARF," prefix.
|
||||||
|
name = name.substr(name.find_first_not_of("._")); // Skip . and _ prefixes.
|
||||||
|
if (name == "debug_info")
|
||||||
DebugInfoSection = data;
|
DebugInfoSection = data;
|
||||||
else if (name.endswith("debug_abbrev"))
|
else if (name == "debug_abbrev")
|
||||||
DebugAbbrevSection = data;
|
DebugAbbrevSection = data;
|
||||||
else if (name.endswith("debug_line"))
|
else if (name == "debug_line")
|
||||||
DebugLineSection = data;
|
DebugLineSection = data;
|
||||||
else if (name.endswith("debug_aranges"))
|
else if (name == "debug_aranges")
|
||||||
DebugArangesSection = data;
|
DebugArangesSection = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user