Commit eca99293 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Facebook GitHub Bot

fbcode: symbolizer: clang-12 DWARF5 emits Split DWARF inlining as...

fbcode: symbolizer: clang-12 DWARF5 emits Split DWARF inlining as DW_TAG_skeleton_unit instead of DW_TAG_compile_unit

Summary:
```name=clang-9
$ llvm-dwarfdump --show-form buck-out/gen/aab7ed39/folly/experimental/symbolizer/test/symbolizer_test_utils_dwarf5_split_dwarf_inlining#compile-SymbolizerTestUtils.cpp.o1ef1b890\,platform009-clang/SymbolizerTestUtils.cpp.o
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000127, format = DWARF32, version = 0x0005, unit_type = DW_UT_skeleton, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0x7d3c88943756aebb (next unit at 0x0000012b)

0x00000014: DW_TAG_compile_unit
              DW_AT_stmt_list   (0x00000000)
              DW_AT_str_offsets_base    (0x00000008)
              DW_AT_comp_dir    (".")
              DW_AT_GNU_pubnames        (true)
              DW_AT_GNU_dwo_name        ("buck-out/dbg/gen/aab7ed39/folly/experimental/symbolizer/test/symbolizer_test_utils_dwarf5_split_dwarf_inlining#compile-SymbolizerTestUtils.cpp.o1ef1b890,platform009-clang/SymbolizerTestUtils.cpp.o")
              DW_AT_low_pc      (0x0000000000000000)
              DW_AT_ranges      (indexed (0x0) rangelist = 0x00000010
                 [0x0000000000000000, 0x000000000000005b)
                 [0x0000000000000000, 0x0000000000000065)
                 [0x0000000000000000, 0x000000000000005a)
                 [0x0000000000000000, 0x0000000000000065)
                 [0x0000000000000000, 0x000000000000000b)
                 [0x0000000000000000, 0x0000000000000076)
                 [0x0000000000000000, 0x0000000000000014)
                 [0x0000000000000000, 0x0000000000000065)
                 [0x0000000000000000, 0x0000000000000076)
                 [0x0000000000000000, 0x0000000000000014)
                 [0x0000000000000000, 0x0000000000000065)
                 [0x0000000000000000, 0x0000000000000085)
                 [0x0000000000000000, 0x000000000000000b))
              DW_AT_addr_base   (0x00000008)
              DW_AT_rnglists_base       (0x0000000c)

```
```name=clang-12
$ llvm-dwarfdump --show-form buck-out/gen/aab7ed39/folly/experimental/symbolizer/test/symbolizer_test_utils_dwarf5_split_dwarf_inlining#compile-SymbolizerTestUtils.cpp.o1ef1b890\,platform009-clang-12/SymbolizerTestUtils.cpp.o
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000127, format = DWARF32, version = 0x0005, unit_type = DW_UT_skeleton, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0xb881aa098abf71b5 (next unit at 0x0000012b)

0x00000014: DW_TAG_skeleton_unit
              DW_AT_stmt_list [DW_FORM_sec_offset]	(0x00000000)
              DW_AT_str_offsets_base [DW_FORM_sec_offset]	(0x00000008)
              DW_AT_comp_dir [DW_FORM_strx1]	(".")
              DW_AT_GNU_pubnames [DW_FORM_flag_present]	(true)
              DW_AT_dwo_name [DW_FORM_strx1]	("buck-out/dbg/gen/aab7ed39/folly/experimental/symbolizer/test/symbolizer_test_utils_dwarf5_split_dwarf_inlining#compile-SymbolizerTestUtils.cpp.o1ef1b890,platform009-clang-12/SymbolizerTestUtils.cpp.o")
              DW_AT_low_pc [DW_FORM_addr]	(0x0000000000000000)
              DW_AT_ranges [DW_FORM_rnglistx]	(indexed (0x0) rangelist = 0x00000010
                 [0x0000000000000000, 0x000000000000004c)
                 [0x0000000000000000, 0x000000000000005f)
                 [0x0000000000000000, 0x0000000000000054)
                 [0x0000000000000000, 0x000000000000005f)
                 [0x0000000000000000, 0x000000000000000b)
                 [0x0000000000000000, 0x0000000000000070)
                 [0x0000000000000000, 0x0000000000000014)
                 [0x0000000000000000, 0x000000000000005f)
                 [0x0000000000000000, 0x0000000000000070)
                 [0x0000000000000000, 0x0000000000000014)
                 [0x0000000000000000, 0x000000000000005f)
                 [0x0000000000000000, 0x0000000000000086)
                 [0x0000000000000000, 0x000000000000000b))
              DW_AT_addr_base [DW_FORM_sec_offset]	(0x00000008)
              DW_AT_rnglists_base [DW_FORM_sec_offset]	(0x0000000c)
```

Differential Revision: D30755400

fbshipit-source-id: 6e7fd8bc9d3bef90a5195dc30dff60c489c4df35
parent 91b962e3
......@@ -364,7 +364,8 @@ detail::CompilationUnit Dwarf::getCompilationUnit(uint64_t offset) const {
}
detail::Die die = getDieAtOffset(cu, cu.firstDie);
if (die.abbr.tag != DW_TAG_compile_unit) {
if (die.abbr.tag != DW_TAG_compile_unit &&
die.abbr.tag != DW_TAG_skeleton_unit) {
return cu;
}
......@@ -492,7 +493,10 @@ bool Dwarf::findLocation(
bool checkAddress) const {
detail::Die die = getDieAtOffset(cu, cu.firstDie);
// Partial compilation unit (DW_TAG_partial_unit) is not supported.
FOLLY_SAFE_CHECK(die.abbr.tag == DW_TAG_compile_unit, "");
FOLLY_SAFE_CHECK(
die.abbr.tag == DW_TAG_compile_unit ||
die.abbr.tag == DW_TAG_skeleton_unit,
die.abbr.tag);
// Offset in .debug_line for the line number VM program for this CU
folly::Optional<uint64_t> lineOffset;
......@@ -1013,10 +1017,11 @@ detail::Attribute Dwarf::readAttribute(
case DW_FORM_ref_sup4:
case DW_FORM_ref_sup8:
case DW_FORM_strp_sup:
FOLLY_SAFE_CHECK(false, "Unexpected DWARF5 supplimentary object files");
FOLLY_SAFE_CHECK(
false, "Unexpected DWARF5 supplimentary object files: ", spec.form);
default:
FOLLY_SAFE_CHECK(false, "invalid attribute form");
FOLLY_SAFE_CHECK(false, "invalid attribute form: ", spec.form);
}
return {spec, die, 0};
}
......@@ -1064,7 +1069,8 @@ bool Dwarf::isAddrInRangeList(
folly::Optional<uint64_t> baseAddr,
size_t offset,
uint8_t addrSize) const {
FOLLY_SAFE_CHECK(addrSize == 4 || addrSize == 8, "wrong address size");
FOLLY_SAFE_CHECK(
addrSize == 4 || addrSize == 8, "wrong address size: ", int(addrSize));
if (cu.version <= 4 && !debugRanges_.empty()) {
const bool is64BitAddr = addrSize == 8;
folly::StringPiece sp = debugRanges_;
......@@ -1173,7 +1179,10 @@ bool Dwarf::isAddrInRangeList(
} break;
default:
FOLLY_SAFE_CHECK(false, "Unexpected debug_rnglists entry kind");
FOLLY_SAFE_CHECK(
false,
"Unexpected debug_rnglists entry kind: ",
static_cast<int>(kind));
}
}
}
......@@ -1470,7 +1479,8 @@ LineNumberAttribute readLineNumberAttribute(
FOLLY_SAFE_CHECK(false, "Unexpected DW_FORM_strp_sup");
break;
default:
FOLLY_SAFE_CHECK(false, "Unexpected form for DW_LNCT_path");
FOLLY_SAFE_CHECK(
false, "Unexpected form for DW_LNCT_path: ", formCode);
break;
}
} break;
......@@ -1488,7 +1498,7 @@ LineNumberAttribute readLineNumberAttribute(
break;
default:
FOLLY_SAFE_CHECK(
false, "Unexpected form for DW_LNCT_directory_index");
false, "Unexpected form for DW_LNCT_directory_index: ", formCode);
break;
}
} break;
......@@ -1508,7 +1518,8 @@ LineNumberAttribute readLineNumberAttribute(
attrValue = readBytes(entries, readULEB(entries));
break;
default:
FOLLY_SAFE_CHECK(false, "Unexpected form for DW_LNCT_timestamp");
FOLLY_SAFE_CHECK(
false, "Unexpected form for DW_LNCT_timestamp: ", formCode);
}
} break;
......@@ -1530,7 +1541,8 @@ LineNumberAttribute readLineNumberAttribute(
attrValue = read<uint64_t>(entries);
break;
default:
FOLLY_SAFE_CHECK(false, "Unexpected form for DW_LNCT_size");
FOLLY_SAFE_CHECK(
false, "Unexpected form for DW_LNCT_size: ", formCode);
break;
}
} break;
......@@ -1541,14 +1553,16 @@ LineNumberAttribute readLineNumberAttribute(
attrValue = readBytes(entries, 16);
break;
default:
FOLLY_SAFE_CHECK(false, "Unexpected form for DW_LNCT_MD5");
FOLLY_SAFE_CHECK(
false, "Unexpected form for DW_LNCT_MD5: ", formCode);
break;
}
} break;
default:
// TODO: skip over vendor data as specified by the form instead.
FOLLY_SAFE_CHECK(false, "Unexpected vendor content type code");
FOLLY_SAFE_CHECK(
false, "Unexpected vendor content type code: ", contentTypeCode);
break;
}
return {
......@@ -1561,18 +1575,25 @@ LineNumberAttribute readLineNumberAttribute(
void Dwarf::LineNumberVM::init() {
version_ = read<uint16_t>(data_);
FOLLY_SAFE_CHECK(
version_ >= 2 && version_ <= 5, "invalid version in line number VM");
version_ >= 2 && version_ <= 5,
"invalid version in line number VM: ",
version_);
if (version_ == 5) {
auto addressSize = read<uint8_t>(data_);
FOLLY_SAFE_CHECK(
addressSize == sizeof(uintptr_t),
"Unexpected Line Number Table address_size");
"Unexpected Line Number Table address_size: ",
addressSize);
auto segment_selector_size = read<uint8_t>(data_);
FOLLY_SAFE_CHECK(segment_selector_size == 0, "Segments not supported");
}
uint64_t headerLength = readOffset(data_, is64Bit_);
FOLLY_SAFE_CHECK(
headerLength <= data_.size(), "invalid line number VM header length");
headerLength <= data_.size(),
"invalid line number VM header length: headerLength: ",
headerLength,
" data_.size(): ",
data_.size());
folly::StringPiece header(data_.data(), headerLength);
data_.assign(header.end(), data_.end());
......
......@@ -403,7 +403,7 @@ TEST(SymbolizerTest, StaticInlineClassMemberFunctionInDifferentFile) {
}
// No inline frames should be filled because of no extra frames.
TEST(SymbolizerTest, InlineFunctionBasicNoExtraFrames) {
TEST(SymbolizerTest, InlineFunctionNoExtraFrames) {
SKIP_IF(!Symbolizer::isAvailable());
Symbolizer symbolizer(nullptr, LocationInfoMode::FULL_WITH_INLINE, 100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment