diff options
author | Chris Bieneman <beanz@apple.com> | 2017-03-07 21:34:35 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2017-03-07 21:34:35 +0000 |
commit | a03cbcc6a6030e29437543871fb78520e31cfd02 (patch) | |
tree | 2347454f2bcfb74d98aed752f7df582ea833aa82 /llvm/lib/ObjectYAML/DWARFVisitor.cpp | |
parent | 9accea6febaedb4b6c4083c7fbe96ea62b4467f2 (diff) | |
download | bcm5719-llvm-a03cbcc6a6030e29437543871fb78520e31cfd02.tar.gz bcm5719-llvm-a03cbcc6a6030e29437543871fb78520e31cfd02.zip |
[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.
llvm-svn: 297230
Diffstat (limited to 'llvm/lib/ObjectYAML/DWARFVisitor.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/DWARFVisitor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/ObjectYAML/DWARFVisitor.cpp b/llvm/lib/ObjectYAML/DWARFVisitor.cpp index cb9ad7a4cb8..36a9f7638bd 100644 --- a/llvm/lib/ObjectYAML/DWARFVisitor.cpp +++ b/llvm/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); |