summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2017-04-20 19:16:51 +0000
committerPaul Robinson <paul.robinson@sony.com>2017-04-20 19:16:51 +0000
commit70b34533c22703b51a95598afceb58a0257d434b (patch)
tree9736c54d2e6d8f90923d10ba1c5a8b35661ed9d6 /llvm/unittests
parent8431e996d323bbafda2cad67a3d6672d69e2bef8 (diff)
downloadbcm5719-llvm-70b34533c22703b51a95598afceb58a0257d434b.tar.gz
bcm5719-llvm-70b34533c22703b51a95598afceb58a0257d434b.zip
[DWARF] Versioning for DWARF constants; verify FORMs
Associate the version-when-defined with definitions of standard DWARF constants. Identify the "vendor" for DWARF extensions. Use this information to verify FORMs in .debug_abbrev are defined as of the DWARF version specified in the associated unit. Removed two tests that had specified DWARF v1 (which essentially does not exist). Differential Revision: http://reviews.llvm.org/D30785 llvm-svn: 300875
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index a6c5b3a34cc..2078e3a96a8 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -170,7 +170,8 @@ void TestAllForms() {
CUDie.addAttribute(Attr_DW_FORM_ref8, DW_FORM_ref8, Data8);
const auto Attr_DW_FORM_ref_sig8 = static_cast<dwarf::Attribute>(Attr++);
- CUDie.addAttribute(Attr_DW_FORM_ref_sig8, DW_FORM_ref_sig8, Data8_2);
+ if (Version >= 4)
+ CUDie.addAttribute(Attr_DW_FORM_ref_sig8, DW_FORM_ref_sig8, Data8_2);
const auto Attr_DW_FORM_ref_udata = static_cast<dwarf::Attribute>(Attr++);
CUDie.addAttribute(Attr_DW_FORM_ref_udata, DW_FORM_ref_udata, UData[0]);
@@ -185,7 +186,8 @@ void TestAllForms() {
CUDie.addAttribute(Attr_DW_FORM_flag_false, DW_FORM_flag, false);
const auto Attr_DW_FORM_flag_present = static_cast<dwarf::Attribute>(Attr++);
- CUDie.addAttribute(Attr_DW_FORM_flag_present, DW_FORM_flag_present);
+ if (Version >= 4)
+ CUDie.addAttribute(Attr_DW_FORM_flag_present, DW_FORM_flag_present);
//----------------------------------------------------------------------
// Test SLEB128 based forms
@@ -213,8 +215,9 @@ void TestAllForms() {
Dwarf32Values[0]);
const auto Attr_DW_FORM_sec_offset = static_cast<dwarf::Attribute>(Attr++);
- CUDie.addAttribute(Attr_DW_FORM_sec_offset, DW_FORM_sec_offset,
- Dwarf32Values[1]);
+ if (Version >= 4)
+ CUDie.addAttribute(Attr_DW_FORM_sec_offset, DW_FORM_sec_offset,
+ Dwarf32Values[1]);
//----------------------------------------------------------------------
// Add an address at the end to make sure we can decode this value
@@ -307,7 +310,8 @@ void TestAllForms() {
EXPECT_EQ(Data2, toReference(DieDG.find(Attr_DW_FORM_ref2), 0));
EXPECT_EQ(Data4, toReference(DieDG.find(Attr_DW_FORM_ref4), 0));
EXPECT_EQ(Data8, toReference(DieDG.find(Attr_DW_FORM_ref8), 0));
- EXPECT_EQ(Data8_2, toReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
+ if (Version >= 4)
+ EXPECT_EQ(Data8_2, toReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
EXPECT_EQ(UData[0], toReference(DieDG.find(Attr_DW_FORM_ref_udata), 0));
//----------------------------------------------------------------------
@@ -315,7 +319,8 @@ void TestAllForms() {
//----------------------------------------------------------------------
EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_true), 0));
EXPECT_EQ(0ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_false), 1));
- EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_present), 0));
+ if (Version >= 4)
+ EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_present), 0));
//----------------------------------------------------------------------
// Test SLEB128 based forms
@@ -334,8 +339,9 @@ void TestAllForms() {
//----------------------------------------------------------------------
EXPECT_EQ(Dwarf32Values[0],
toReference(DieDG.find(Attr_DW_FORM_GNU_ref_alt), 0));
- EXPECT_EQ(Dwarf32Values[1],
- toSectionOffset(DieDG.find(Attr_DW_FORM_sec_offset), 0));
+ if (Version >= 4)
+ EXPECT_EQ(Dwarf32Values[1],
+ toSectionOffset(DieDG.find(Attr_DW_FORM_sec_offset), 0));
//----------------------------------------------------------------------
// Add an address at the end to make sure we can decode this value
OpenPOWER on IntegriCloud