summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-09-14 17:28:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-09-14 17:28:13 +0000
commit973b5cde7ec3c4882002381ecb02747e8fe5c69b (patch)
tree84da2f36e42dbb50cd134c97a3f626992d49d2d8 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
parentf0bbc1c8fd5f87078a05c013dee3df93d14844af (diff)
downloadbcm5719-llvm-973b5cde7ec3c4882002381ecb02747e8fe5c69b.tar.gz
bcm5719-llvm-973b5cde7ec3c4882002381ecb02747e8fe5c69b.zip
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. llvm-svn: 139701
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r--llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 076dcd10fb0..ef9a47b9594 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -62,13 +62,17 @@ static void DumpInput(const StringRef &Filename) {
i->getName(name);
StringRef 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;
- else if (name.endswith("debug_abbrev"))
+ else if (name == "debug_abbrev")
DebugAbbrevSection = data;
- else if (name.endswith("debug_line"))
+ else if (name == "debug_line")
DebugLineSection = data;
- else if (name.endswith("debug_aranges"))
+ else if (name == "debug_aranges")
DebugArangesSection = data;
}
OpenPOWER on IntegriCloud