summaryrefslogtreecommitdiffstats
path: root/lib/ObjectYAML
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2017-03-07 21:34:35 +0000
committerChris Bieneman <beanz@apple.com>2017-03-07 21:34:35 +0000
commitf4f71cd77b30788f85c87b13934061d77eaa5b25 (patch)
treef5694ab42d5e614221a86a96dda18ae248e4008d /lib/ObjectYAML
parent908d8eeae9d8186890feb1c6da72af7327f43095 (diff)
[ObjectYAML] Fix issue with DWARF2 AddrSize 8
In my refactoring I introduced a bug where we were using the reference size instead of the offset size for DW_FORM_strp and similar forms. This patch resolves the error and adds a test case testing all the DWARF forms for DWARF2 AddrSize 8. There is similar coverage already in the DWARFDebugInfoTest sources that covers the parser. Once I migrate the DWARFGenerator APIs to be built on the YAML tools they will be fully covered under the same tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ObjectYAML')
-rw-r--r--lib/ObjectYAML/DWARFVisitor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ObjectYAML/DWARFVisitor.cpp b/lib/ObjectYAML/DWARFVisitor.cpp
index cb9ad7a4cb8c..36a9f7638bd4 100644
--- a/lib/ObjectYAML/DWARFVisitor.cpp
+++ b/lib/ObjectYAML/DWARFVisitor.cpp
@@ -34,10 +34,14 @@ void DWARFYAML::VisitorImpl<T>::onVariableSizeValue(uint64_t U, unsigned Size) {
}
}
+unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
+ return Unit.Length.isDWARF64() ? 8 : 4;
+}
+
unsigned getRefSize(const DWARFYAML::Unit &Unit) {
if (Unit.Version == 2)
return Unit.AddrSize;
- return Unit.Length.isDWARF64() ? 8 : 4;
+ return getOffsetSize(Unit);
}
template <typename T> void DWARFYAML::VisitorImpl<T>::traverseDebugInfo() {
@@ -149,7 +153,7 @@ template <typename T> void DWARFYAML::VisitorImpl<T>::traverseDebugInfo() {
case dwarf::DW_FORM_GNU_strp_alt:
case dwarf::DW_FORM_line_strp:
case dwarf::DW_FORM_strp_sup:
- onVariableSizeValue(FormVal->Value, getRefSize(Unit));
+ onVariableSizeValue(FormVal->Value, getOffsetSize(Unit));
break;
case dwarf::DW_FORM_ref_sig8:
onValue((uint64_t)FormVal->Value);