Lines Matching +full:form +full:- +full:data
1 //===- llvm/unittest/DebugInfo/GSYMTest.cpp -------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
72 EXPECT_EQ(R.first->second, Index1);
75 EXPECT_EQ(R.first->second, Index1);
78 EXPECT_EQ(R.first->second, Index2);
81 EXPECT_EQ(R.first->second, Index2);
91 const uint64_t Size = EndAddr - StartAddr;
102 FI.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
138 FIWithLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line));
147 FIWithInlines.Inline->Ranges.insert(
155 FIWithMoreInlines.Inline->Children.push_back(InlineInfo());
160 FIWithLinesAndInline.Inline->Ranges.insert(
169 FIWithMoreLines.OptLineTable->push(LineEntry(StartAddr,FileIdx,Line+5));
175 FIWithLinesWithHigherAddress.OptLineTable->get(0).Addr += 0x10;
184 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
185 llvm::Expected<FunctionInfo> Decoded = FunctionInfo::decode(Data, BaseAddr);
218 FW.writeU32(0); // LineTableInfo InfoType data length.
271 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
273 FunctionInfo::decode(Data, FI.Range.start());
285 FI.OptLineTable->push(Line0);
286 FI.OptLineTable->push(Line1);
287 FI.OptLineTable->push(Line2);
293 FI.Inline->Ranges.insert(AddressRange(FuncAddr, FuncAddr + FuncSize));
299 FI.Inline->Children.push_back(Inline1);
347 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
348 llvm::Expected<InlineInfo> Decoded = InlineInfo::decode(Data, BaseAddr);
359 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
360 llvm::Expected<InlineInfo> Decoded = InlineInfo::decode(Data, BaseAddr);
392 // Create an InlineInfo that contains the following data. The
398 // Root [0x100-0x200) (no name, file, or line)
399 // Inline1 [0x150-0x160) Name = 1, File = 1, Line = 11
400 // Inline1Sub1 [0x152-0x155) Name = 2, File = 2, Line = 22
401 // Inline1Sub2 [0x157-0x158) Name = 3, File = 3, Line = 33
426 // Verify that we get no inline stacks for addresses out of [0x100-0x200)
427 EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].start() - 1));
431 // [0x100-0x200) but not in [0x150-0x160)
432 EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].start() - 1));
436 // [[0x150-0x160)) but not in [0x152-0x155) or [0x157-0x158)
439 ASSERT_EQ(InlineInfos->size(), 1u);
440 ASSERT_EQ(*InlineInfos->at(0), Inline1);
441 InlineInfos = Root.getInlineStack(Inline1.Ranges[0].end() - 1);
443 ASSERT_EQ(InlineInfos->size(), 1u);
444 ASSERT_EQ(*InlineInfos->at(0), Inline1);
447 // [0x152-0x155)
450 ASSERT_EQ(InlineInfos->size(), 2u);
451 ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);
452 ASSERT_EQ(*InlineInfos->at(1), Inline1);
453 InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].end() - 1);
455 ASSERT_EQ(InlineInfos->size(), 2u);
456 ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);
457 ASSERT_EQ(*InlineInfos->at(1), Inline1);
460 // [0x157-0x158)
463 ASSERT_EQ(InlineInfos->size(), 2u);
464 ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);
465 ASSERT_EQ(*InlineInfos->at(1), Inline1);
466 InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].end() - 1);
468 ASSERT_EQ(InlineInfos->size(), 2u);
469 ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);
470 ASSERT_EQ(*InlineInfos->at(1), Inline1);
518 "0x00000000: missing InlineInfo address ranges data");
604 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
606 EXPECT_EQ(Data.getU8(&Offset), U8);
607 EXPECT_EQ(Data.getU16(&Offset), U16);
608 EXPECT_EQ(Data.getU32(&Offset), U32);
609 EXPECT_EQ(Data.getU64(&Offset), U64);
611 EXPECT_EQ(Data.getU32(&Offset), U32);
612 EXPECT_EQ(Data.getSLEB128(&Offset), MinSLEB);
613 EXPECT_EQ(Data.getSLEB128(&Offset), MaxSLEB);
614 EXPECT_EQ(Data.getULEB128(&Offset), MinULEB);
615 EXPECT_EQ(Data.getULEB128(&Offset), MaxULEB);
616 EXPECT_EQ(Data.getCStrRef(&Offset), StringRef(Hello));
640 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
644 DecodedRange1 = decodeRange(Data, BaseAddr, Offset);
645 DecodedRange2 = decodeRange(Data, BaseAddr, Offset);
660 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
664 decodeRanges(DecodedRanges, Data, BaseAddr, Offset);
699 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
700 llvm::Expected<LineTable> Decoded = LineTable::decode(Data, BaseAddr);
769 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
770 llvm::Expected<LineTable> Decoded = LineTable::decode(Data, BaseAddr);
857 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
858 llvm::Expected<Header> Decoded = Header::decode(Data);
930 DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize);
931 llvm::Expected<Header> Decoded = Header::decode(Data);
989 GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
997 GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
1007 // Verify that all of the data in a GsymCreator is correctly decoded from
1009 GC.forEachFunctionInfo([&](const FunctionInfo &FI) -> bool {
1028 const Header &Hdr = GR->getHeader();
1167 VerifyFunctionInfoError(GR, Func1Addr-1, "address 0xfff is not in GSYM");
1172 VerifyFunctionInfo(GR, Func1Addr+FuncSize-1, Func1);
1175 VerifyFunctionInfoError(GR, Func2Addr-1, "address 0x101f is not in GSYM");
1179 VerifyFunctionInfo(GR, Func2Addr+FuncSize-1, Func2);
1197 FI.OptLineTable->push(LineEntry(0x1000, MainFileIndex, 5));
1198 FI.OptLineTable->push(LineEntry(0x1010, FooFileIndex, 10));
1199 FI.OptLineTable->push(LineEntry(0x1012, FooFileIndex, 20));
1200 FI.OptLineTable->push(LineEntry(0x1014, FooFileIndex, 11));
1201 FI.OptLineTable->push(LineEntry(0x1016, FooFileIndex, 30));
1202 FI.OptLineTable->push(LineEntry(0x1018, FooFileIndex, 12));
1203 FI.OptLineTable->push(LineEntry(0x1020, MainFileIndex, 8));
1206 FI.Inline->Name = GC.insertString("inline1");
1207 FI.Inline->CallFile = MainFileIndex;
1208 FI.Inline->CallLine = 6;
1209 FI.Inline->Ranges.insert(AddressRange(0x1010, 0x1020));
1215 FI.Inline->Children.emplace_back(Inline2);
1221 FI.Inline->Children.emplace_back(Inline3);
1235 auto LR = GR->lookup(0x1000);
1237 EXPECT_THAT(LR->Locations,
1239 LR = GR->lookup(0x100F);
1241 EXPECT_THAT(LR->Locations,
1244 LR = GR->lookup(0x1010);
1247 EXPECT_THAT(LR->Locations,
1251 LR = GR->lookup(0x1012);
1253 EXPECT_THAT(LR->Locations,
1258 LR = GR->lookup(0x1014);
1260 EXPECT_THAT(LR->Locations,
1264 LR = GR->lookup(0x1016);
1266 EXPECT_THAT(LR->Locations,
1271 LR = GR->lookup(0x1018);
1273 EXPECT_THAT(LR->Locations,
1277 LR = GR->lookup(0x1020);
1279 EXPECT_THAT(LR->Locations,
1290 - ''
1291 - /tmp/main.c
1292 - main
1294 - Table:
1295 - Code: 0x00000001
1299 - Attribute: DW_AT_name
1300 Form: DW_FORM_strp
1301 - Attribute: DW_AT_low_pc
1302 Form: DW_FORM_addr
1303 - Attribute: DW_AT_high_pc
1304 Form: DW_FORM_addr
1305 - Attribute: DW_AT_language
1306 Form: DW_FORM_data2
1307 - Code: 0x00000002
1311 - Attribute: DW_AT_name
1312 Form: DW_FORM_strp
1313 - Attribute: DW_AT_low_pc
1314 Form: DW_FORM_addr
1315 - Attribute: DW_AT_high_pc
1316 Form: DW_FORM_addr
1318 - Version: 4
1321 - AbbrCode: 0x00000001
1323 - Value: 0x0000000000000001
1324 - Value: 0x0000000000001000
1325 - Value: 0x0000000000002000
1326 - Value: 0x0000000000000004
1327 - AbbrCode: 0x00000002
1329 - Value: 0x000000000000000D
1330 - Value: 0x0000000000001000
1331 - Value: 0x0000000000002000
1332 - AbbrCode: 0x00000000
1354 EXPECT_EQ(GR->getNumAddresses(), 1u);
1355 auto ExpFI = GR->getFunctionInfo(0x1000);
1357 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
1358 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
1359 EXPECT_FALSE(ExpFI->Inline.has_value());
1368 - ''
1369 - /tmp/main.c
1370 - main
1372 - Table:
1373 - Code: 0x00000001
1377 - Attribute: DW_AT_name
1378 Form: DW_FORM_strp
1379 - Attribute: DW_AT_low_pc
1380 Form: DW_FORM_addr
1381 - Attribute: DW_AT_high_pc
1382 Form: DW_FORM_data4
1383 - Attribute: DW_AT_language
1384 Form: DW_FORM_data2
1385 - Code: 0x00000002
1389 - Attribute: DW_AT_name
1390 Form: DW_FORM_strp
1391 - Attribute: DW_AT_low_pc
1392 Form: DW_FORM_addr
1393 - Attribute: DW_AT_high_pc
1394 Form: DW_FORM_data4
1396 - Version: 4
1399 - AbbrCode: 0x00000001
1401 - Value: 0x0000000000000001
1402 - Value: 0x0000000000001000
1403 - Value: 0x0000000000001000
1404 - Value: 0x0000000000000004
1405 - AbbrCode: 0x00000002
1407 - Value: 0x000000000000000D
1408 - Value: 0x0000000000001000
1409 - Value: 0x0000000000001000
1410 - AbbrCode: 0x00000000
1432 EXPECT_EQ(GR->getNumAddresses(), 1u);
1433 auto ExpFI = GR->getFunctionInfo(0x1000);
1435 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
1436 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
1437 EXPECT_FALSE(ExpFI->Inline.has_value());
1448 - ''
1449 - /tmp/main.c
1450 - Foo
1451 - dump
1452 - this
1454 - Table:
1455 - Code: 0x00000001
1459 - Attribute: DW_AT_name
1460 Form: DW_FORM_strp
1461 - Attribute: DW_AT_low_pc
1462 Form: DW_FORM_addr
1463 - Attribute: DW_AT_high_pc
1464 Form: DW_FORM_addr
1465 - Attribute: DW_AT_language
1466 Form: DW_FORM_data2
1467 - Code: 0x00000002
1471 - Attribute: DW_AT_name
1472 Form: DW_FORM_strp
1473 - Code: 0x00000003
1477 - Attribute: DW_AT_name
1478 Form: DW_FORM_strp
1479 - Attribute: DW_AT_low_pc
1480 Form: DW_FORM_addr
1481 - Attribute: DW_AT_high_pc
1482 Form: DW_FORM_addr
1483 - Code: 0x00000004
1487 - Attribute: DW_AT_name
1488 Form: DW_FORM_strp
1489 - Attribute: DW_AT_type
1490 Form: DW_FORM_ref4
1491 - Attribute: DW_AT_artificial
1492 Form: DW_FORM_flag_present
1494 - Version: 4
1497 - AbbrCode: 0x00000001
1499 - Value: 0x0000000000000001
1500 - Value: 0x0000000000001000
1501 - Value: 0x0000000000002000
1502 - Value: 0x0000000000000004
1503 - AbbrCode: 0x00000002
1505 - Value: 0x000000000000000D
1506 - AbbrCode: 0x00000003
1508 - Value: 0x0000000000000011
1509 - Value: 0x0000000000001000
1510 - Value: 0x0000000000002000
1511 - AbbrCode: 0x00000004
1513 - Value: 0x0000000000000016
1514 - Value: 0x0000000000000022
1515 - Value: 0x0000000000000001
1516 - AbbrCode: 0x00000000
1517 - AbbrCode: 0x00000000
1518 - AbbrCode: 0x00000000
1540 EXPECT_EQ(GR->getNumAddresses(), 1u);
1541 auto ExpFI = GR->getFunctionInfo(0x1000);
1543 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
1544 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
1545 EXPECT_FALSE(ExpFI->Inline.has_value());
1546 StringRef MethodName = GR->getString(ExpFI->Name);
1552 // relocate data within the DWARF sections. This means that if a function
1565 - ''
1566 - /tmp/main.c
1567 - main
1568 - dead_stripped
1569 - dead_stripped2
1571 - Table:
1572 - Code: 0x00000001
1576 - Attribute: DW_AT_name
1577 Form: DW_FORM_strp
1578 - Attribute: DW_AT_low_pc
1579 Form: DW_FORM_addr
1580 - Attribute: DW_AT_high_pc
1581 Form: DW_FORM_data4
1582 - Attribute: DW_AT_language
1583 Form: DW_FORM_data2
1584 - Code: 0x00000002
1588 - Attribute: DW_AT_name
1589 Form: DW_FORM_strp
1590 - Attribute: DW_AT_low_pc
1591 Form: DW_FORM_addr
1592 - Attribute: DW_AT_high_pc
1593 Form: DW_FORM_data4
1595 - Version: 4
1598 - AbbrCode: 0x00000001
1600 - Value: 0x0000000000000001
1601 - Value: 0x0000000000001000
1602 - Value: 0x0000000000001000
1603 - Value: 0x0000000000000004
1604 - AbbrCode: 0x00000002
1606 - Value: 0x000000000000000D
1607 - Value: 0x0000000000001000
1608 - Value: 0x0000000000001000
1609 - AbbrCode: 0x00000002
1611 - Value: 0x0000000000000012
1612 - Value: 0x0000000000000000
1613 - Value: 0x0000000000000100
1614 - AbbrCode: 0x00000002
1616 - Value: 0x0000000000000020
1617 - Value: 0x0000000000000000
1618 - Value: 0x0000000000000040
1619 - AbbrCode: 0x00000000
1630 // Only allow addresses between [0x1000 - 0x2000) to be linked into the
1646 EXPECT_EQ(GR->getNumAddresses(), 1u);
1647 auto ExpFI = GR->getFunctionInfo(0x1000);
1649 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
1650 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
1651 EXPECT_FALSE(ExpFI->Inline.has_value());
1652 StringRef MethodName = GR->getString(ExpFI->Name);
1675 EXPECT_EQ(GR->getNumAddresses(), 1u);
1676 auto ExpFI = GR->getFunctionInfo(0x1500);
1678 ASSERT_EQ(ExpFI->Range, AddressRange(0x1500, 0x2000));
1679 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
1680 EXPECT_FALSE(ExpFI->Inline.has_value());
1681 StringRef MethodName = GR->getString(ExpFI->Name);
1690 - ''
1691 - /tmp/main.c
1692 - main
1693 - inline1
1695 - Table:
1696 - Code: 0x00000001
1700 - Attribute: DW_AT_name
1701 Form: DW_FORM_strp
1702 - Attribute: DW_AT_low_pc
1703 Form: DW_FORM_addr
1704 - Attribute: DW_AT_high_pc
1705 Form: DW_FORM_data4
1706 - Attribute: DW_AT_language
1707 Form: DW_FORM_data2
1708 - Attribute: DW_AT_stmt_list
1709 Form: DW_FORM_sec_offset
1710 - Code: 0x00000002
1714 - Attribute: DW_AT_name
1715 Form: DW_FORM_strp
1716 - Attribute: DW_AT_low_pc
1717 Form: DW_FORM_addr
1718 - Attribute: DW_AT_high_pc
1719 Form: DW_FORM_data4
1720 - Code: 0x00000003
1724 - Attribute: DW_AT_name
1725 Form: DW_FORM_strp
1726 - Attribute: DW_AT_low_pc
1727 Form: DW_FORM_addr
1728 - Attribute: DW_AT_high_pc
1729 Form: DW_FORM_data4
1730 - Attribute: DW_AT_call_file
1731 Form: DW_FORM_data4
1732 - Attribute: DW_AT_call_line
1733 Form: DW_FORM_data4
1735 - Version: 4
1738 - AbbrCode: 0x00000001
1740 - Value: 0x0000000000000001
1741 - Value: 0x0000000000001000
1742 - Value: 0x0000000000001000
1743 - Value: 0x0000000000000004
1744 - Value: 0x0000000000000000
1745 - AbbrCode: 0x00000002
1747 - Value: 0x000000000000000D
1748 - Value: 0x0000000000001000
1749 - Value: 0x0000000000001000
1750 - AbbrCode: 0x00000003
1752 - Value: 0x0000000000000012
1753 - Value: 0x0000000000001100
1754 - Value: 0x0000000000000100
1755 - Value: 0x0000000000000001
1756 - Value: 0x000000000000000A
1757 - AbbrCode: 0x00000000
1758 - AbbrCode: 0x00000000
1760 - Length: 96
1770 - /tmp
1772 - Name: main.c
1776 - Name: inline.h
1781 - Opcode: DW_LNS_extended_op
1784 Data: 4096
1785 - Opcode: DW_LNS_advance_line
1787 Data: 4096
1788 - Opcode: DW_LNS_copy
1789 Data: 4096
1790 - Opcode: DW_LNS_advance_pc
1791 Data: 256
1792 - Opcode: DW_LNS_set_file
1793 Data: 2
1794 - Opcode: DW_LNS_advance_line
1796 Data: 2
1797 - Opcode: DW_LNS_copy
1798 Data: 2
1799 - Opcode: DW_LNS_advance_pc
1800 Data: 128
1801 - Opcode: DW_LNS_advance_line
1803 Data: 128
1804 - Opcode: DW_LNS_copy
1805 Data: 128
1806 - Opcode: DW_LNS_advance_pc
1807 Data: 128
1808 - Opcode: DW_LNS_set_file
1809 Data: 1
1810 - Opcode: DW_LNS_advance_line
1811 SData: -10
1812 Data: 1
1813 - Opcode: DW_LNS_copy
1814 Data: 1
1815 - Opcode: DW_LNS_advance_pc
1816 Data: 3584
1817 - Opcode: DW_LNS_advance_line
1819 Data: 3584
1820 - Opcode: DW_LNS_extended_op
1823 Data: 3584
1845 EXPECT_EQ(GR->getNumAddresses(), 1u);
1846 auto ExpFI = GR->getFunctionInfo(0x1000);
1848 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
1849 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
1850 EXPECT_TRUE(ExpFI->Inline.has_value());
1851 StringRef MethodName = GR->getString(ExpFI->Name);
1855 auto LR = GR->lookup(0x1000);
1857 EXPECT_THAT(LR->Locations,
1859 LR = GR->lookup(0x1100-1);
1861 EXPECT_THAT(LR->Locations,
1864 LR = GR->lookup(0x1100);
1866 EXPECT_THAT(LR->Locations,
1869 LR = GR->lookup(0x1180-1);
1871 EXPECT_THAT(LR->Locations,
1874 LR = GR->lookup(0x1180);
1876 EXPECT_THAT(LR->Locations,
1879 LR = GR->lookup(0x1200-1);
1881 EXPECT_THAT(LR->Locations,
1884 LR = GR->lookup(0x1200);
1886 EXPECT_THAT(LR->Locations,
1941 - ''
1942 - '/tmp/main.c'
1943 - lines_no_decl
1944 - lines_with_decl
1945 - no_lines_no_decl
1946 - no_lines_with_decl
1948 - Table:
1949 - Code: 0x00000001
1953 - Attribute: DW_AT_name
1954 Form: DW_FORM_strp
1955 - Attribute: DW_AT_low_pc
1956 Form: DW_FORM_addr
1957 - Attribute: DW_AT_high_pc
1958 Form: DW_FORM_data4
1959 - Attribute: DW_AT_language
1960 Form: DW_FORM_data2
1961 - Attribute: DW_AT_stmt_list
1962 Form: DW_FORM_sec_offset
1963 - Code: 0x00000002
1967 - Attribute: DW_AT_name
1968 Form: DW_FORM_strp
1969 - Attribute: DW_AT_low_pc
1970 Form: DW_FORM_addr
1971 - Attribute: DW_AT_high_pc
1972 Form: DW_FORM_data4
1973 - Code: 0x00000003
1977 - Attribute: DW_AT_name
1978 Form: DW_FORM_strp
1979 - Attribute: DW_AT_low_pc
1980 Form: DW_FORM_addr
1981 - Attribute: DW_AT_high_pc
1982 Form: DW_FORM_data4
1983 - Attribute: DW_AT_decl_file
1984 Form: DW_FORM_data1
1985 - Attribute: DW_AT_decl_line
1986 Form: DW_FORM_data1
1988 - Version: 4
1991 - AbbrCode: 0x00000001
1993 - Value: 0x0000000000000001
1994 - Value: 0x0000000000001000
1995 - Value: 0x0000000000001000
1996 - Value: 0x0000000000000004
1997 - Value: 0x0000000000000000
1998 - AbbrCode: 0x00000002
2000 - Value: 0x000000000000000D
2001 - Value: 0x0000000000001000
2002 - Value: 0x0000000000001000
2003 - AbbrCode: 0x00000003
2005 - Value: 0x000000000000001B
2006 - Value: 0x0000000000002000
2007 - Value: 0x0000000000001000
2008 - Value: 0x0000000000000001
2009 - Value: 0x0000000000000014
2010 - AbbrCode: 0x00000002
2012 - Value: 0x000000000000002B
2013 - Value: 0x0000000000003000
2014 - Value: 0x0000000000001000
2015 - AbbrCode: 0x00000003
2017 - Value: 0x000000000000003C
2018 - Value: 0x0000000000004000
2019 - Value: 0x0000000000001000
2020 - Value: 0x0000000000000001
2021 - Value: 0x0000000000000028
2022 - AbbrCode: 0x00000000
2024 - Length: 92
2034 - '/tmp'
2036 - Name: main.c
2041 - Opcode: DW_LNS_extended_op
2044 Data: 4096
2045 - Opcode: DW_LNS_advance_line
2047 Data: 0
2048 - Opcode: DW_LNS_copy
2049 Data: 0
2050 - Opcode: DW_LNS_advance_pc
2051 Data: 512
2052 - Opcode: DW_LNS_advance_line
2054 Data: 0
2055 - Opcode: DW_LNS_copy
2056 Data: 0
2057 - Opcode: DW_LNS_advance_pc
2058 Data: 3584
2059 - Opcode: DW_LNS_extended_op
2062 Data: 0
2063 - Opcode: DW_LNS_extended_op
2066 Data: 8192
2067 - Opcode: DW_LNS_advance_line
2069 Data: 0
2070 - Opcode: DW_LNS_copy
2071 Data: 0
2072 - Opcode: DW_LNS_advance_pc
2073 Data: 512
2074 - Opcode: DW_LNS_advance_line
2076 Data: 0
2077 - Opcode: DW_LNS_copy
2078 Data: 0
2079 - Opcode: DW_LNS_advance_pc
2080 Data: 3584
2081 - Opcode: DW_LNS_extended_op
2084 Data: 0
2106 EXPECT_EQ(GR->getNumAddresses(), 4u);
2108 auto ExpFI = GR->getFunctionInfo(0x1000);
2110 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
2111 EXPECT_TRUE(ExpFI->OptLineTable);
2112 StringRef MethodName = GR->getString(ExpFI->Name);
2116 EXPECT_EQ(ExpFI->OptLineTable->size(), 2u);
2117 EXPECT_EQ(ExpFI->OptLineTable->first()->Addr, 0x1000u);
2118 EXPECT_EQ(ExpFI->OptLineTable->first()->Line, 11u);
2120 ExpFI = GR->getFunctionInfo(0x2000);
2122 ASSERT_EQ(ExpFI->Range, AddressRange(0x2000, 0x3000));
2123 EXPECT_TRUE(ExpFI->OptLineTable);
2124 MethodName = GR->getString(ExpFI->Name);
2128 EXPECT_EQ(ExpFI->OptLineTable->size(), 2u);
2129 EXPECT_EQ(ExpFI->OptLineTable->first()->Addr, 0x2000u);
2130 EXPECT_EQ(ExpFI->OptLineTable->first()->Line, 21u);
2132 ExpFI = GR->getFunctionInfo(0x3000);
2134 ASSERT_EQ(ExpFI->Range, AddressRange(0x3000, 0x4000));
2136 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
2137 MethodName = GR->getString(ExpFI->Name);
2140 ExpFI = GR->getFunctionInfo(0x4000);
2142 ASSERT_EQ(ExpFI->Range, AddressRange(0x4000, 0x5000));
2143 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
2144 MethodName = GR->getString(ExpFI->Name);
2148 EXPECT_EQ(ExpFI->OptLineTable->size(), 1u);
2149 EXPECT_EQ(ExpFI->OptLineTable->first()->Addr, 0x4000u);
2150 EXPECT_EQ(ExpFI->OptLineTable->first()->Line, 40u);
2159 // 1 - Compilers might set the low PC to -1 (UINT32_MAX) for compile unit
2161 // 2 - Set the low and high PC to the same value ("stripped2")
2162 // 3 - Have the high PC lower than the low PC ("stripped3")
2194 - ''
2195 - '/tmp/main.c'
2196 - main
2197 - stripped1
2198 - stripped2
2199 - stripped3
2201 - Table:
2202 - Code: 0x00000001
2206 - Attribute: DW_AT_name
2207 Form: DW_FORM_strp
2208 - Attribute: DW_AT_low_pc
2209 Form: DW_FORM_addr
2210 - Attribute: DW_AT_high_pc
2211 Form: DW_FORM_data4
2212 - Attribute: DW_AT_language
2213 Form: DW_FORM_data2
2214 - Code: 0x00000002
2218 - Attribute: DW_AT_name
2219 Form: DW_FORM_strp
2220 - Attribute: DW_AT_low_pc
2221 Form: DW_FORM_addr
2222 - Attribute: DW_AT_high_pc
2223 Form: DW_FORM_data4
2224 - Code: 0x00000003
2228 - Attribute: DW_AT_name
2229 Form: DW_FORM_strp
2230 - Attribute: DW_AT_low_pc
2231 Form: DW_FORM_addr
2232 - Attribute: DW_AT_high_pc
2233 Form: DW_FORM_addr
2235 - Version: 4
2238 - AbbrCode: 0x00000001
2240 - Value: 0x0000000000000001
2241 - Value: 0x0000000000001000
2242 - Value: 0x0000000000001000
2243 - Value: 0x0000000000000004
2244 - AbbrCode: 0x00000002
2246 - Value: 0x000000000000000D
2247 - Value: 0x0000000000001000
2248 - Value: 0x0000000000001000
2249 - AbbrCode: 0x00000002
2251 - Value: 0x0000000000000012
2252 - Value: 0x00000000FFFFFFFF
2253 - Value: 0x0000000000000001
2254 - AbbrCode: 0x00000003
2256 - Value: 0x000000000000001C
2257 - Value: 0x0000000000003000
2258 - Value: 0x0000000000003000
2259 - AbbrCode: 0x00000003
2261 - Value: 0x0000000000000026
2262 - Value: 0x0000000000004000
2263 - Value: 0x0000000000003FFF
2264 - AbbrCode: 0x00000000
2287 EXPECT_EQ(GR->getNumAddresses(), 1u);
2288 auto ExpFI = GR->getFunctionInfo(0x1000);
2290 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
2291 StringRef MethodName = GR->getString(ExpFI->Name);
2300 // 1 - Compilers might set the low PC to -1 (UINT64_MAX) for compile unit
2302 // 2 - Set the low and high PC to the same value ("stripped2")
2303 // 3 - Have the high PC lower than the low PC ("stripped3")
2335 - ''
2336 - '/tmp/main.c'
2337 - main
2338 - stripped1
2339 - stripped2
2340 - stripped3
2342 - Table:
2343 - Code: 0x00000001
2347 - Attribute: DW_AT_name
2348 Form: DW_FORM_strp
2349 - Attribute: DW_AT_low_pc
2350 Form: DW_FORM_addr
2351 - Attribute: DW_AT_high_pc
2352 Form: DW_FORM_data4
2353 - Attribute: DW_AT_language
2354 Form: DW_FORM_data2
2355 - Code: 0x00000002
2359 - Attribute: DW_AT_name
2360 Form: DW_FORM_strp
2361 - Attribute: DW_AT_low_pc
2362 Form: DW_FORM_addr
2363 - Attribute: DW_AT_high_pc
2364 Form: DW_FORM_data4
2365 - Code: 0x00000003
2369 - Attribute: DW_AT_name
2370 Form: DW_FORM_strp
2371 - Attribute: DW_AT_low_pc
2372 Form: DW_FORM_addr
2373 - Attribute: DW_AT_high_pc
2374 Form: DW_FORM_addr
2376 - Version: 4
2379 - AbbrCode: 0x00000001
2381 - Value: 0x0000000000000001
2382 - Value: 0x0000000000001000
2383 - Value: 0x0000000000001000
2384 - Value: 0x0000000000000004
2385 - AbbrCode: 0x00000002
2387 - Value: 0x000000000000000D
2388 - Value: 0x0000000000001000
2389 - Value: 0x0000000000001000
2390 - AbbrCode: 0x00000002
2392 - Value: 0x0000000000000012
2393 - Value: 0xFFFFFFFFFFFFFFFF
2394 - Value: 0x0000000000000001
2395 - AbbrCode: 0x00000003
2397 - Value: 0x000000000000001C
2398 - Value: 0x0000000000003000
2399 - Value: 0x0000000000003000
2400 - AbbrCode: 0x00000003
2402 - Value: 0x0000000000000026
2403 - Value: 0x0000000000004000
2404 - Value: 0x0000000000003FFF
2405 - AbbrCode: 0x00000000
2428 EXPECT_EQ(GR->getNumAddresses(), 1u);
2429 auto ExpFI = GR->getFunctionInfo(0x1000);
2431 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
2432 StringRef MethodName = GR->getString(ExpFI->Name);
2470 FI.OptLineTable->push(LineEntry(FuncAddr+0x00, SourceFileIdx, 5));
2471 FI.OptLineTable->push(LineEntry(FuncAddr+0x10, HeaderFileIdx, 10));
2472 FI.OptLineTable->push(LineEntry(FuncAddr+0x12, HeaderFileIdx, 20));
2473 FI.OptLineTable->push(LineEntry(FuncAddr+0x14, HeaderFileIdx, 11));
2474 FI.OptLineTable->push(LineEntry(FuncAddr+0x16, HeaderFileIdx, 30));
2475 FI.OptLineTable->push(LineEntry(FuncAddr+0x18, HeaderFileIdx, 12));
2476 FI.OptLineTable->push(LineEntry(FuncAddr+0x20, SourceFileIdx, 8));
2483 FI.Inline->Name = GC.insertString(InlineName1);
2484 FI.Inline->CallFile = SourceFileIdx;
2485 FI.Inline->CallLine = 6;
2486 FI.Inline->Ranges.insert(AddressRange(FuncAddr + 0x10, FuncAddr + 0x20));
2492 FI.Inline->Children.emplace_back(Inline2);
2498 FI.Inline->Children.emplace_back(Inline3);
2533 //GR->dump(outs());
2541 // GC1000 and GR1000 are for [0x1000-0x1030)
2542 // GC2000 and GR2000 are for [0x2000-0x2030)
2543 // GC3000 and GR3000 are for [0x3000-0x3030)
2544 // GC4000 and GR4000 are for [0x4000-0x4030)
2596 // Verify that all lookups match the range [0x1000-0x1030) when doing lookups
2601 auto MainLR = GR->lookup(Addr);
2603 auto SegmentLR = GR1000->lookup(Addr);
2609 ASSERT_THAT_EXPECTED(GR1000->lookup(0x2000), Failed());
2610 ASSERT_THAT_EXPECTED(GR1000->lookup(0x3000), Failed());
2611 ASSERT_THAT_EXPECTED(GR1000->lookup(0x4000), Failed());
2614 // Verify that all lookups match the range [0x2000-0x2030) when doing lookups
2619 auto MainLR = GR->lookup(Addr);
2621 auto SegmentLR = GR2000->lookup(Addr);
2627 ASSERT_THAT_EXPECTED(GR2000->lookup(0x1000), Failed());
2628 ASSERT_THAT_EXPECTED(GR2000->lookup(0x3000), Failed());
2629 ASSERT_THAT_EXPECTED(GR2000->lookup(0x4000), Failed());
2633 // Verify that all lookups match the range [0x3000-0x3030) when doing lookups
2638 auto MainLR = GR->lookup(Addr);
2640 auto SegmentLR = GR3000->lookup(Addr);
2646 ASSERT_THAT_EXPECTED(GR3000->lookup(0x1000), Failed());
2647 ASSERT_THAT_EXPECTED(GR3000->lookup(0x2000), Failed());
2648 ASSERT_THAT_EXPECTED(GR3000->lookup(0x4000), Failed());
2651 // Verify that all lookups match the range [0x4000-0x4030) when doing lookups
2656 auto MainLR = GR->lookup(Addr);
2659 auto SegmentLR = GR4000->lookup(Addr);
2665 ASSERT_THAT_EXPECTED(GR4000->lookup(0x1000), Failed());
2666 ASSERT_THAT_EXPECTED(GR4000->lookup(0x2000), Failed());
2667 ASSERT_THAT_EXPECTED(GR4000->lookup(0x3000), Failed());
2684 //GR->dump(outs());
2692 // GC1000 and GR1000 are for [0x1000-0x1030)
2693 // GC2000 and GR2000 are for [0x2000-0x2030)
2694 // GC3000 and GR3000 are for [0x3000-0x3030)
2695 // GC4000 and GR4000 are for [0x4000-0x4030)
2747 // Verify that all lookups match the range [0x1000-0x1030) when doing lookups
2752 auto MainLR = GR->lookup(Addr);
2754 auto SegmentLR = GR1000->lookup(Addr);
2760 ASSERT_THAT_EXPECTED(GR1000->lookup(0x2000), Failed());
2761 ASSERT_THAT_EXPECTED(GR1000->lookup(0x3000), Failed());
2762 ASSERT_THAT_EXPECTED(GR1000->lookup(0x4000), Failed());
2765 // Verify that all lookups match the range [0x2000-0x2030) when doing lookups
2770 auto MainLR = GR->lookup(Addr);
2772 auto SegmentLR = GR2000->lookup(Addr);
2778 ASSERT_THAT_EXPECTED(GR2000->lookup(0x1000), Failed());
2779 ASSERT_THAT_EXPECTED(GR2000->lookup(0x3000), Failed());
2780 ASSERT_THAT_EXPECTED(GR2000->lookup(0x4000), Failed());
2784 // Verify that all lookups match the range [0x3000-0x3030) when doing lookups
2789 auto MainLR = GR->lookup(Addr);
2791 auto SegmentLR = GR3000->lookup(Addr);
2797 ASSERT_THAT_EXPECTED(GR3000->lookup(0x1000), Failed());
2798 ASSERT_THAT_EXPECTED(GR3000->lookup(0x2000), Failed());
2799 ASSERT_THAT_EXPECTED(GR3000->lookup(0x4000), Failed());
2802 // Verify that all lookups match the range [0x4000-0x4030) when doing lookups
2807 auto MainLR = GR->lookup(Addr);
2810 auto SegmentLR = GR4000->lookup(Addr);
2816 ASSERT_THAT_EXPECTED(GR4000->lookup(0x1000), Failed());
2817 ASSERT_THAT_EXPECTED(GR4000->lookup(0x2000), Failed());
2818 ASSERT_THAT_EXPECTED(GR4000->lookup(0x3000), Failed());
2876 - ''
2877 - '/tmp/main.cpp'
2878 - foo
2879 - invalid1
2880 - valid1
2881 - invalid2
2882 - valid2
2884 - ID: 0
2886 - Code: 0x1
2890 - Attribute: DW_AT_name
2891 Form: DW_FORM_strp
2892 - Attribute: DW_AT_language
2893 Form: DW_FORM_udata
2894 - Attribute: DW_AT_stmt_list
2895 Form: DW_FORM_sec_offset
2896 - Code: 0x2
2900 - Attribute: DW_AT_name
2901 Form: DW_FORM_strp
2902 - Attribute: DW_AT_low_pc
2903 Form: DW_FORM_addr
2904 - Attribute: DW_AT_high_pc
2905 Form: DW_FORM_addr
2906 - Code: 0x3
2910 - Attribute: DW_AT_name
2911 Form: DW_FORM_strp
2912 - Attribute: DW_AT_low_pc
2913 Form: DW_FORM_addr
2914 - Attribute: DW_AT_high_pc
2915 Form: DW_FORM_addr
2916 - Attribute: DW_AT_call_file
2917 Form: DW_FORM_data1
2918 - Attribute: DW_AT_call_line
2919 Form: DW_FORM_data1
2920 - Code: 0x4
2924 - Attribute: DW_AT_name
2925 Form: DW_FORM_strp
2926 - Attribute: DW_AT_low_pc
2927 Form: DW_FORM_addr
2928 - Attribute: DW_AT_high_pc
2929 Form: DW_FORM_addr
2930 - Attribute: DW_AT_call_file
2931 Form: DW_FORM_data1
2932 - Attribute: DW_AT_call_line
2933 Form: DW_FORM_data1
2935 - Length: 0x85
2941 - AbbrCode: 0x1
2943 - Value: 0x1
2944 - Value: 0x2
2945 - Value: 0x0
2946 - AbbrCode: 0x2
2948 - Value: 0xF
2949 - Value: 0x1000
2950 - Value: 0x2000
2951 - AbbrCode: 0x3
2953 - Value: 0x13
2954 - Value: 0xFFF
2955 - Value: 0x1001
2956 - Value: 0x1
2957 - Value: 0xA
2958 - AbbrCode: 0x4
2960 - Value: 0x1C
2961 - Value: 0x1010
2962 - Value: 0x1100
2963 - Value: 0x1
2964 - Value: 0xB
2965 - AbbrCode: 0x3
2967 - Value: 0x23
2968 - Value: 0x1000
2969 - Value: 0x1100
2970 - Value: 0x1
2971 - Value: 0xC
2972 - AbbrCode: 0x3
2974 - Value: 0x2C
2975 - Value: 0x1020
2976 - Value: 0x1030
2977 - Value: 0x1
2978 - Value: 0xD
2979 - AbbrCode: 0x0
2980 - AbbrCode: 0x0
2981 - AbbrCode: 0x0
2983 - Length: 84
2993 - '/tmp'
2995 - Name: main.cpp
3000 - Opcode: DW_LNS_extended_op
3003 Data: 4096
3004 - Opcode: DW_LNS_advance_line
3006 Data: 0
3007 - Opcode: DW_LNS_copy
3008 Data: 0
3009 - Opcode: DW_LNS_advance_pc
3010 Data: 16
3011 - Opcode: DW_LNS_advance_line
3013 Data: 0
3014 - Opcode: DW_LNS_copy
3015 Data: 0
3016 - Opcode: DW_LNS_advance_pc
3017 Data: 16
3018 - Opcode: DW_LNS_advance_line
3020 Data: 0
3021 - Opcode: DW_LNS_copy
3022 Data: 0
3023 - Opcode: DW_LNS_advance_pc
3024 Data: 16
3025 - Opcode: DW_LNS_advance_line
3027 Data: 0
3028 - Opcode: DW_LNS_copy
3029 Data: 0
3030 - Opcode: DW_LNS_advance_pc
3031 Data: 4048
3032 - Opcode: DW_LNS_advance_line
3034 Data: 0
3035 - Opcode: DW_LNS_copy
3036 Data: 0
3037 - Opcode: DW_LNS_advance_pc
3038 Data: 16
3039 - Opcode: DW_LNS_advance_line
3040 SData: -1
3041 Data: 0
3042 - Opcode: DW_LNS_extended_op
3045 Data: 0
3068 EXPECT_EQ(GR->getNumAddresses(), 1u);
3069 auto ExpFI = GR->getFunctionInfo(0x1000);
3071 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x2000));
3072 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
3073 EXPECT_TRUE(ExpFI->Inline.has_value());
3074 StringRef FuncName = GR->getString(ExpFI->Name);
3078 "- 0x0000000000001001) that isn't contained in any parent address ranges, "
3081 "- 0x0000000000001100) that isn't contained in any parent address ranges, "
3093 StringRef InlineFuncName = GR->getString(ExpFI->Inline->Name);
3095 EXPECT_EQ(ExpFI->Inline->CallFile, 0u);
3096 EXPECT_EQ(ExpFI->Inline->CallLine, 0u);
3097 EXPECT_EQ(ExpFI->Inline->Children.size(), 1u);
3103 InlineInfo &Inline1 = ExpFI->Inline->Children[0];
3104 StringRef Inline1Name = GR->getString(Inline1.Name);
3115 StringRef Inline2Name = GR->getString(Inline2.Name);
3153 - ''
3154 - '/tmp/main.cpp'
3155 - foo
3156 - inlineWithInvalidRange
3158 - ID: 0
3160 - Code: 0x1
3164 - Attribute: DW_AT_name
3165 Form: DW_FORM_strp
3166 - Attribute: DW_AT_language
3167 Form: DW_FORM_udata
3168 - Attribute: DW_AT_stmt_list
3169 Form: DW_FORM_sec_offset
3170 - Code: 0x2
3174 - Attribute: DW_AT_name
3175 Form: DW_FORM_strp
3176 - Attribute: DW_AT_low_pc
3177 Form: DW_FORM_addr
3178 - Attribute: DW_AT_high_pc
3179 Form: DW_FORM_addr
3180 - Code: 0x3
3184 - Attribute: DW_AT_name
3185 Form: DW_FORM_strp
3186 - Attribute: DW_AT_low_pc
3187 Form: DW_FORM_addr
3188 - Attribute: DW_AT_high_pc
3189 Form: DW_FORM_addr
3190 - Attribute: DW_AT_call_file
3191 Form: DW_FORM_data4
3192 - Attribute: DW_AT_call_line
3193 Form: DW_FORM_data4
3195 - Length: 0x45
3201 - AbbrCode: 0x1
3203 - Value: 0x1
3204 - Value: 0x2
3205 - Value: 0x0
3206 - AbbrCode: 0x2
3208 - Value: 0xF
3209 - Value: 0x1000
3210 - Value: 0x1050
3211 - AbbrCode: 0x3
3213 - Value: 0x13
3214 - Value: 0x1100
3215 - Value: 0x1200
3216 - Value: 0x1
3217 - Value: 0xB
3218 - AbbrCode: 0x0
3219 - AbbrCode: 0x0
3221 - Length: 76
3231 - '/tmp'
3233 - Name: main.cpp
3238 - Opcode: DW_LNS_extended_op
3241 Data: 4096
3242 - Opcode: DW_LNS_advance_line
3244 Data: 0
3245 - Opcode: DW_LNS_copy
3246 Data: 0
3247 - Opcode: DW_LNS_advance_pc
3248 Data: 16
3249 - Opcode: DW_LNS_advance_line
3251 Data: 0
3252 - Opcode: DW_LNS_copy
3253 Data: 0
3254 - Opcode: DW_LNS_advance_pc
3255 Data: 16
3256 - Opcode: DW_LNS_advance_line
3258 Data: 0
3259 - Opcode: DW_LNS_copy
3260 Data: 0
3261 - Opcode: DW_LNS_advance_pc
3262 Data: 16
3263 - Opcode: DW_LNS_advance_line
3265 Data: 0
3266 - Opcode: DW_LNS_copy
3267 Data: 0
3268 - Opcode: DW_LNS_advance_pc
3269 Data: 32
3270 - Opcode: DW_LNS_extended_op
3273 Data: 0
3296 EXPECT_EQ(GR->getNumAddresses(), 1u);
3297 auto ExpFI = GR->getFunctionInfo(0x1000);
3299 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
3300 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
3301 EXPECT_FALSE(ExpFI->Inline.has_value());
3302 StringRef FuncName = GR->getString(ExpFI->Name);
3306 " - 0x0000000000001200) that isn't contained in any parent address ranges,"
3320 // - one contains a function "foo" with line table entries and "bar" without
3321 // - one contains a function "bar" with line table entries and "foo" without
3368 - ''
3369 - '/tmp/main.cpp'
3370 - foo
3371 - bar
3373 - ID: 0
3375 - Code: 0x1
3379 - Attribute: DW_AT_name
3380 Form: DW_FORM_strp
3381 - Attribute: DW_AT_language
3382 Form: DW_FORM_udata
3383 - Attribute: DW_AT_stmt_list
3384 Form: DW_FORM_sec_offset
3385 - Code: 0x2
3389 - Attribute: DW_AT_name
3390 Form: DW_FORM_strp
3391 - Attribute: DW_AT_low_pc
3392 Form: DW_FORM_addr
3393 - Attribute: DW_AT_high_pc
3394 Form: DW_FORM_addr
3396 - Length: 0x3C
3402 - AbbrCode: 0x1
3404 - Value: 0x1
3405 - Value: 0x2
3406 - Value: 0x0
3407 - AbbrCode: 0x2
3409 - Value: 0xF
3410 - Value: 0x1000
3411 - Value: 0x1050
3412 - AbbrCode: 0x2
3414 - Value: 0x13
3415 - Value: 0x2000
3416 - Value: 0x2050
3417 - AbbrCode: 0x0
3418 - Length: 0x3C
3424 - AbbrCode: 0x1
3426 - Value: 0x1
3427 - Value: 0x2
3428 - Value: 0x43
3429 - AbbrCode: 0x2
3431 - Value: 0xF
3432 - Value: 0x1000
3433 - Value: 0x1050
3434 - AbbrCode: 0x2
3436 - Value: 0x13
3437 - Value: 0x2000
3438 - Value: 0x2050
3439 - AbbrCode: 0x0
3441 - Length: 63
3451 - '/tmp'
3453 - Name: main.cpp
3458 - Opcode: DW_LNS_extended_op
3461 Data: 4096
3462 - Opcode: DW_LNS_advance_line
3464 Data: 0
3465 - Opcode: DW_LNS_copy
3466 Data: 0
3467 - Opcode: DW_LNS_advance_pc
3468 Data: 80
3469 - Opcode: DW_LNS_advance_line
3471 Data: 0
3472 - Opcode: DW_LNS_extended_op
3475 Data: 0
3476 - Length: 63
3486 - '/tmp'
3488 - Name: main.cpp
3493 - Opcode: DW_LNS_extended_op
3496 Data: 8192
3497 - Opcode: DW_LNS_advance_line
3499 Data: 0
3500 - Opcode: DW_LNS_copy
3501 Data: 0
3502 - Opcode: DW_LNS_advance_pc
3503 Data: 80
3504 - Opcode: DW_LNS_advance_line
3506 Data: 0
3507 - Opcode: DW_LNS_extended_op
3510 Data: 0
3533 EXPECT_EQ(GR->getNumAddresses(), 2u);
3535 auto ExpFI = GR->getFunctionInfo(0x1000);
3537 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
3538 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
3539 EXPECT_FALSE(ExpFI->Inline.has_value());
3540 StringRef FuncName = GR->getString(ExpFI->Name);
3544 auto ExpFI2 = GR->getFunctionInfo(0x2000);
3546 ASSERT_EQ(ExpFI2->Range, AddressRange(0x2000, 0x2050));
3547 EXPECT_TRUE(ExpFI2->OptLineTable.has_value());
3548 EXPECT_FALSE(ExpFI2->Inline.has_value());
3549 StringRef FuncName2 = GR->getString(ExpFI2->Name);
3600 - ''
3601 - '/tmp/main.cpp'
3602 - foo
3603 - inline1
3604 - inline2
3606 - ID: 0
3608 - Code: 0x1
3612 - Attribute: DW_AT_name
3613 Form: DW_FORM_strp
3614 - Attribute: DW_AT_language
3615 Form: DW_FORM_udata
3616 - Attribute: DW_AT_stmt_list
3617 Form: DW_FORM_sec_offset
3618 - Code: 0x2
3622 - Attribute: DW_AT_name
3623 Form: DW_FORM_strp
3624 - Attribute: DW_AT_ranges
3625 Form: DW_FORM_sec_offset
3626 - Code: 0x3
3630 - Attribute: DW_AT_name
3631 Form: DW_FORM_strp
3632 - Attribute: DW_AT_ranges
3633 Form: DW_FORM_sec_offset
3634 - Attribute: DW_AT_call_file
3635 Form: DW_FORM_data4
3636 - Attribute: DW_AT_call_line
3637 Form: DW_FORM_data4
3638 - Code: 0x4
3642 - Attribute: DW_AT_name
3643 Form: DW_FORM_strp
3644 - Attribute: DW_AT_ranges
3645 Form: DW_FORM_sec_offset
3646 - Attribute: DW_AT_call_file
3647 Form: DW_FORM_data4
3648 - Attribute: DW_AT_call_line
3649 Form: DW_FORM_data4
3651 - Offset: 0x0
3654 - LowOffset: 0x1000
3656 - LowOffset: 0x2000
3658 - Offset: 0x30
3661 - LowOffset: 0x1010
3663 - LowOffset: 0x2010
3665 - Offset: 0x60
3668 - LowOffset: 0x1015
3670 - LowOffset: 0x2015
3673 - Length: 0x3F
3679 - AbbrCode: 0x1
3681 - Value: 0x1
3682 - Value: 0x2
3683 - Value: 0x0
3684 - AbbrCode: 0x2
3686 - Value: 0xF
3687 - Value: 0x0
3688 - AbbrCode: 0x3
3690 - Value: 0x13
3691 - Value: 0x30
3692 - Value: 0x1
3693 - Value: 0xB
3694 - AbbrCode: 0x4
3696 - Value: 0x1B
3697 - Value: 0x60
3698 - Value: 0x2
3699 - Value: 0x15
3700 - AbbrCode: 0x0
3701 - AbbrCode: 0x0
3702 - AbbrCode: 0x0
3704 - Length: 120
3714 - '/tmp'
3716 - Name: main.cpp
3720 - Name: inline.h
3725 - Opcode: DW_LNS_extended_op
3728 Data: 4096
3729 - Opcode: DW_LNS_advance_line
3731 Data: 0
3732 - Opcode: DW_LNS_copy
3733 Data: 0
3734 - Opcode: DW_LNS_advance_pc
3735 Data: 16
3736 - Opcode: DW_LNS_set_file
3737 Data: 2
3738 - Opcode: DW_LNS_advance_line
3740 Data: 0
3741 - Opcode: DW_LNS_copy
3742 Data: 0
3743 - Opcode: DW_LNS_advance_pc
3744 Data: 16
3745 - Opcode: DW_LNS_advance_line
3747 Data: 0
3748 - Opcode: DW_LNS_copy
3749 Data: 0
3750 - Opcode: DW_LNS_advance_pc
3751 Data: 48
3752 - Opcode: DW_LNS_set_file
3753 Data: 1
3754 - Opcode: DW_LNS_advance_line
3755 SData: -10
3756 Data: 0
3757 - Opcode: DW_LNS_extended_op
3760 Data: 0
3761 - Opcode: DW_LNS_extended_op
3764 Data: 8192
3765 - Opcode: DW_LNS_advance_line
3767 Data: 0
3768 - Opcode: DW_LNS_copy
3769 Data: 0
3770 - Opcode: DW_LNS_advance_pc
3771 Data: 16
3772 - Opcode: DW_LNS_set_file
3773 Data: 2
3774 - Opcode: DW_LNS_copy
3775 Data: 0
3776 - Opcode: DW_LNS_advance_pc
3777 Data: 16
3778 - Opcode: DW_LNS_advance_line
3780 Data: 0
3781 - Opcode: DW_LNS_copy
3782 Data: 0
3783 - Opcode: DW_LNS_advance_pc
3784 Data: 48
3785 - Opcode: DW_LNS_set_file
3786 Data: 1
3787 - Opcode: DW_LNS_extended_op
3790 Data: 0
3813 EXPECT_EQ(GR->getNumAddresses(), 2u);
3815 auto ExpFI = GR->getFunctionInfo(0x1000);
3817 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
3818 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
3819 EXPECT_TRUE(ExpFI->Inline.has_value());
3820 StringRef FuncName = GR->getString(ExpFI->Name);
3824 auto ExpFI2 = GR->getFunctionInfo(0x2000);
3826 ASSERT_EQ(ExpFI2->Range, AddressRange(0x2000, 0x2050));
3827 EXPECT_TRUE(ExpFI2->OptLineTable.has_value());
3828 EXPECT_TRUE(ExpFI2->Inline.has_value());
3829 StringRef FuncName2 = GR->getString(ExpFI2->Name);
3868 - ''
3869 - '/tmp/main.cpp'
3870 - foo
3871 - inline1
3873 - ID: 0
3875 - Code: 0x1
3879 - Attribute: DW_AT_name
3880 Form: DW_FORM_strp
3881 - Attribute: DW_AT_language
3882 Form: DW_FORM_udata
3883 - Attribute: DW_AT_stmt_list
3884 Form: DW_FORM_sec_offset
3885 - Code: 0x2
3889 - Attribute: DW_AT_name
3890 Form: DW_FORM_strp
3891 - Attribute: DW_AT_low_pc
3892 Form: DW_FORM_addr
3893 - Attribute: DW_AT_high_pc
3894 Form: DW_FORM_addr
3895 - Code: 0x3
3899 - Attribute: DW_AT_name
3900 Form: DW_FORM_strp
3901 - Attribute: DW_AT_low_pc
3902 Form: DW_FORM_addr
3903 - Attribute: DW_AT_high_pc
3904 Form: DW_FORM_addr
3905 - Attribute: DW_AT_call_file
3906 Form: DW_FORM_data4
3907 - Attribute: DW_AT_call_line
3908 Form: DW_FORM_data4
3910 - Length: 0x45
3916 - AbbrCode: 0x1
3918 - Value: 0x1
3919 - Value: 0x2
3920 - Value: 0x0
3921 - AbbrCode: 0x2
3923 - Value: 0xF
3924 - Value: 0x1000
3925 - Value: 0x1050
3926 - AbbrCode: 0x3
3928 - Value: 0x13
3929 - Value: 0x1010
3930 - Value: 0x1010
3931 - Value: 0x1
3932 - Value: 0xB
3933 - AbbrCode: 0x0
3934 - AbbrCode: 0x0
3936 - Length: 89
3946 - '/tmp'
3948 - Name: main.cpp
3952 - Name: inline.h
3957 - Opcode: DW_LNS_extended_op
3960 Data: 4096
3961 - Opcode: DW_LNS_advance_line
3963 Data: 0
3964 - Opcode: DW_LNS_copy
3965 Data: 0
3966 - Opcode: DW_LNS_advance_pc
3967 Data: 16
3968 - Opcode: DW_LNS_set_file
3969 Data: 2
3970 - Opcode: DW_LNS_advance_line
3972 Data: 0
3973 - Opcode: DW_LNS_copy
3974 Data: 0
3975 - Opcode: DW_LNS_advance_pc
3976 Data: 16
3977 - Opcode: DW_LNS_advance_line
3979 Data: 0
3980 - Opcode: DW_LNS_copy
3981 Data: 0
3982 - Opcode: DW_LNS_advance_pc
3983 Data: 48
3984 - Opcode: DW_LNS_set_file
3985 Data: 1
3986 - Opcode: DW_LNS_advance_line
3987 SData: -10
3988 Data: 0
3989 - Opcode: DW_LNS_extended_op
3992 Data: 0
4015 EXPECT_EQ(GR->getNumAddresses(), 1u);
4017 auto ExpFI = GR->getFunctionInfo(0x1000);
4019 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
4020 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
4021 EXPECT_FALSE(ExpFI->Inline.has_value());
4022 StringRef FuncName = GR->getString(ExpFI->Name);
4057 - ''
4058 - '/tmp/main.cpp'
4059 - foo
4060 - ''
4062 - ID: 0
4064 - Code: 0x1
4068 - Attribute: DW_AT_name
4069 Form: DW_FORM_strp
4070 - Attribute: DW_AT_language
4071 Form: DW_FORM_udata
4072 - Attribute: DW_AT_stmt_list
4073 Form: DW_FORM_sec_offset
4074 - Code: 0x2
4078 - Attribute: DW_AT_name
4079 Form: DW_FORM_strp
4080 - Attribute: DW_AT_linkage_name
4081 Form: DW_FORM_strp
4082 - Attribute: DW_AT_low_pc
4083 Form: DW_FORM_addr
4084 - Attribute: DW_AT_high_pc
4085 Form: DW_FORM_addr
4087 - Length: 0x2B
4093 - AbbrCode: 0x1
4095 - Value: 0x1
4096 - Value: 0x2
4097 - Value: 0x0
4098 - AbbrCode: 0x2
4100 - Value: 0xF
4101 - Value: 0x13
4102 - Value: 0x1000
4103 - Value: 0x1050
4104 - AbbrCode: 0x0
4106 - Length: 68
4116 - '/tmp'
4118 - Name: main.cpp
4123 - Opcode: DW_LNS_extended_op
4126 Data: 4096
4127 - Opcode: DW_LNS_advance_line
4129 Data: 0
4130 - Opcode: DW_LNS_copy
4131 Data: 0
4132 - Opcode: DW_LNS_advance_pc
4133 Data: 256
4134 - Opcode: DW_LNS_advance_line
4136 Data: 0
4137 - Opcode: DW_LNS_copy
4138 Data: 0
4139 - Opcode: DW_LNS_advance_pc
4140 Data: 256
4141 - Opcode: DW_LNS_extended_op
4144 Data: 0
4167 EXPECT_EQ(GR->getNumAddresses(), 1u);
4169 auto ExpFI = GR->getFunctionInfo(0x1000);
4171 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
4172 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
4173 EXPECT_FALSE(ExpFI->Inline.has_value());
4174 StringRef FuncName = GR->getString(ExpFI->Name);
4206 // ---------- ------ ------ ------ --- ------------- -------------
4214 - ''
4215 - '/tmp/main.cpp'
4216 - foo
4218 - ID: 0
4220 - Code: 0x1
4224 - Attribute: DW_AT_name
4225 Form: DW_FORM_strp
4226 - Attribute: DW_AT_language
4227 Form: DW_FORM_udata
4228 - Attribute: DW_AT_stmt_list
4229 Form: DW_FORM_sec_offset
4230 - Code: 0x2
4234 - Attribute: DW_AT_name
4235 Form: DW_FORM_strp
4236 - Attribute: DW_AT_low_pc
4237 Form: DW_FORM_addr
4238 - Attribute: DW_AT_high_pc
4239 Form: DW_FORM_addr
4241 - Length: 0x27
4247 - AbbrCode: 0x1
4249 - Value: 0x1
4250 - Value: 0x2
4251 - Value: 0x0
4252 - AbbrCode: 0x2
4254 - Value: 0xF
4255 - Value: 0x1000
4256 - Value: 0x1050
4257 - AbbrCode: 0x0
4259 - Length: 71
4269 - '/tmp'
4271 - Name: main.cpp
4276 - Opcode: DW_LNS_extended_op
4279 Data: 4096
4280 - Opcode: DW_LNS_advance_line
4282 Data: 0
4283 - Opcode: DW_LNS_copy
4284 Data: 0
4285 - Opcode: DW_LNS_advance_pc
4286 Data: 16
4287 - Opcode: DW_LNS_advance_line
4289 Data: 0
4290 - Opcode: DW_LNS_copy
4291 Data: 0
4292 - Opcode: DW_LNS_advance_line
4294 Data: 0
4295 - Opcode: DW_LNS_copy
4296 Data: 0
4297 - Opcode: DW_LNS_advance_pc
4298 Data: 64
4299 - Opcode: DW_LNS_advance_line
4301 Data: 0
4302 - Opcode: DW_LNS_extended_op
4305 Data: 0
4328 EXPECT_EQ(GR->getNumAddresses(), 1u);
4330 auto ExpFI = GR->getFunctionInfo(0x1000);
4332 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
4333 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
4334 EXPECT_FALSE(ExpFI->Inline.has_value());
4335 StringRef FuncName = GR->getString(ExpFI->Name);
4344 auto LR = GR->lookup(0x1010);
4347 EXPECT_THAT(LR->Locations, testing::ElementsAre(src_loc));
4351 // Test that llvm-gsymutil can handle invalid file indexes in the following
4353 // - In line entries in the line table
4354 // - When parsing inline entries that have a DW_AT_call_file
4355 // - When parsing function dies with no line table entries and it tries to
4425 // ---------- ------ ------ ------ --- ------------- -------------
4434 - ''
4435 - '/tmp/main.cpp'
4436 - foo
4437 - inline_with_invalid_call_file
4438 - inline_inside_parent_with_invalid_call_file
4439 - inline_with_valid_call_file
4440 - inline_inside_parent_with_valid_call_file
4441 - func_with_valid_decl_file
4442 - func_with_invalid_decl_file
4444 - ID: 0
4446 - Code: 0x1
4450 - Attribute: DW_AT_name
4451 Form: DW_FORM_strp
4452 - Attribute: DW_AT_language
4453 Form: DW_FORM_udata
4454 - Attribute: DW_AT_stmt_list
4455 Form: DW_FORM_sec_offset
4456 - Code: 0x2
4460 - Attribute: DW_AT_name
4461 Form: DW_FORM_strp
4462 - Attribute: DW_AT_low_pc
4463 Form: DW_FORM_addr
4464 - Attribute: DW_AT_high_pc
4465 Form: DW_FORM_addr
4466 - Code: 0x3
4470 - Attribute: DW_AT_name
4471 Form: DW_FORM_strp
4472 - Attribute: DW_AT_low_pc
4473 Form: DW_FORM_addr
4474 - Attribute: DW_AT_high_pc
4475 Form: DW_FORM_addr
4476 - Attribute: DW_AT_call_file
4477 Form: DW_FORM_data4
4478 - Attribute: DW_AT_call_line
4479 Form: DW_FORM_data4
4480 - Code: 0x4
4484 - Attribute: DW_AT_name
4485 Form: DW_FORM_strp
4486 - Attribute: DW_AT_low_pc
4487 Form: DW_FORM_addr
4488 - Attribute: DW_AT_high_pc
4489 Form: DW_FORM_addr
4490 - Attribute: DW_AT_call_file
4491 Form: DW_FORM_data4
4492 - Attribute: DW_AT_call_line
4493 Form: DW_FORM_data4
4494 - Code: 0x5
4498 - Attribute: DW_AT_name
4499 Form: DW_FORM_strp
4500 - Attribute: DW_AT_decl_file
4501 Form: DW_FORM_data1
4502 - Attribute: DW_AT_decl_line
4503 Form: DW_FORM_data1
4504 - Attribute: DW_AT_low_pc
4505 Form: DW_FORM_addr
4506 - Attribute: DW_AT_high_pc
4507 Form: DW_FORM_addr
4509 - Length: 0xCC
4515 - AbbrCode: 0x1
4517 - Value: 0x1
4518 - Value: 0x2
4519 - Value: 0x0
4520 - AbbrCode: 0x2
4522 - Value: 0xF
4523 - Value: 0x1000
4524 - Value: 0x1050
4525 - AbbrCode: 0x3
4527 - Value: 0x13
4528 - Value: 0x1010
4529 - Value: 0x1020
4530 - Value: 0xA
4531 - Value: 0xB
4532 - AbbrCode: 0x4
4534 - Value: 0x31
4535 - Value: 0x1010
4536 - Value: 0x1015
4537 - Value: 0x1
4538 - Value: 0xC
4539 - AbbrCode: 0x0
4540 - AbbrCode: 0x3
4542 - Value: 0x5D
4543 - Value: 0x1020
4544 - Value: 0x1030
4545 - Value: 0x1
4546 - Value: 0xD
4547 - AbbrCode: 0x4
4549 - Value: 0x79
4550 - Value: 0x1020
4551 - Value: 0x1025
4552 - Value: 0x1
4553 - Value: 0xE
4554 - AbbrCode: 0x0
4555 - AbbrCode: 0x0
4556 - AbbrCode: 0x5
4558 - Value: 0xA3
4559 - Value: 0x1
4560 - Value: 0x14
4561 - Value: 0x2000
4562 - Value: 0x2050
4563 - AbbrCode: 0x5
4565 - Value: 0xBD
4566 - Value: 0xA
4567 - Value: 0x14
4568 - Value: 0x3000
4569 - Value: 0x3050
4570 - AbbrCode: 0x0
4572 - Length: 78
4582 - '/tmp'
4584 - Name: main.cpp
4589 - Opcode: DW_LNS_extended_op
4592 Data: 4096
4593 - Opcode: DW_LNS_advance_line
4595 Data: 0
4596 - Opcode: DW_LNS_copy
4597 Data: 0
4598 - Opcode: DW_LNS_advance_pc
4599 Data: 16
4600 - Opcode: DW_LNS_set_file
4601 Data: 10
4602 - Opcode: DW_LNS_advance_line
4604 Data: 0
4605 - Opcode: DW_LNS_copy
4606 Data: 0
4607 - Opcode: DW_LNS_advance_pc
4608 Data: 16
4609 - Opcode: DW_LNS_set_file
4610 Data: 1
4611 - Opcode: DW_LNS_copy
4612 Data: 0
4613 - Opcode: DW_LNS_advance_pc
4614 Data: 16
4615 - Opcode: DW_LNS_advance_line
4617 Data: 0
4618 - Opcode: DW_LNS_copy
4619 Data: 0
4620 - Opcode: DW_LNS_advance_pc
4621 Data: 32
4622 - Opcode: DW_LNS_extended_op
4625 Data: 0
4648 EXPECT_EQ(GR->getNumAddresses(), 3u);
4650 auto ExpFI = GR->getFunctionInfo(0x1000);
4652 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
4653 StringRef FuncName = GR->getString(ExpFI->Name);
4656 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
4659 ASSERT_EQ(ExpFI->OptLineTable->size(), 3u);
4660 EXPECT_TRUE(ExpFI->Inline.has_value());
4664 ASSERT_EQ(ExpFI->Inline->Children.size(), 1u);
4665 StringRef InlineName = GR->getString(ExpFI->Inline->Children[0].Name);
4668 ExpFI = GR->getFunctionInfo(0x0000000000002000);
4670 ASSERT_EQ(ExpFI->Range, AddressRange(0x2000, 0x2050));
4671 FuncName = GR->getString(ExpFI->Name);
4673 EXPECT_FALSE(ExpFI->Inline.has_value());
4676 EXPECT_TRUE(ExpFI->OptLineTable.has_value());
4677 ASSERT_EQ(ExpFI->OptLineTable->size(), 1u);
4679 ExpFI = GR->getFunctionInfo(0x0000000000003000);
4681 ASSERT_EQ(ExpFI->Range, AddressRange(0x3000, 0x3050));
4682 FuncName = GR->getString(ExpFI->Name);
4684 EXPECT_FALSE(ExpFI->Inline.has_value());
4688 EXPECT_FALSE(ExpFI->OptLineTable.has_value());
4707 // Test that llvm-gsymutil lookup the correct funtion info when address
4743 - ''
4744 - '/tmp/main.cpp'
4745 - foo
4746 - bar
4748 - ID: 0
4750 - Code: 0x1
4754 - Attribute: DW_AT_name
4755 Form: DW_FORM_strp
4756 - Attribute: DW_AT_language
4757 Form: DW_FORM_udata
4758 - Attribute: DW_AT_stmt_list
4759 Form: DW_FORM_sec_offset
4760 - Code: 0x2
4764 - Attribute: DW_AT_name
4765 Form: DW_FORM_strp
4766 - Attribute: DW_AT_low_pc
4767 Form: DW_FORM_addr
4768 - Attribute: DW_AT_high_pc
4769 Form: DW_FORM_addr
4771 - Length: 0x3C
4777 - AbbrCode: 0x1
4779 - Value: 0x1
4780 - Value: 0x2
4781 - Value: 0x0
4782 - AbbrCode: 0x2
4784 - Value: 0xF
4785 - Value: 0x1000
4786 - Value: 0x1050
4787 - AbbrCode: 0x2
4789 - Value: 0x13
4790 - Value: 0x1000
4791 - Value: 0x1100
4792 - AbbrCode: 0x0
4794 - Length: 71
4804 - '/tmp'
4806 - Name: main.cpp
4811 - Opcode: DW_LNS_extended_op
4814 Data: 4096
4815 - Opcode: DW_LNS_advance_line
4817 Data: 0
4818 - Opcode: DW_LNS_copy
4819 Data: 0
4820 - Opcode: DW_LNS_advance_pc
4821 Data: 16
4822 - Opcode: DW_LNS_advance_line
4824 Data: 0
4825 - Opcode: DW_LNS_copy
4826 Data: 0
4827 - Opcode: DW_LNS_advance_line
4829 Data: 0
4830 - Opcode: DW_LNS_copy
4831 Data: 0
4832 - Opcode: DW_LNS_advance_pc
4833 Data: 64
4834 - Opcode: DW_LNS_advance_line
4836 Data: 0
4837 - Opcode: DW_LNS_extended_op
4840 Data: 0
4863 EXPECT_EQ(GR->getNumAddresses(), 2u);
4866 auto ExpFI = GR->getFunctionInfo(Addr);
4868 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1050));
4869 StringRef FuncName = GR->getString(ExpFI->Name);
4875 auto ExpFI = GR->getFunctionInfo(Addr);
4877 ASSERT_EQ(ExpFI->Range, AddressRange(0x1000, 0x1100));
4878 StringRef FuncName = GR->getString(ExpFI->Name);
4890 GR->dump(DumpStrm);
4895 "@ 0x00000068: [0x0000000000001000 - 0x0000000000001050) \"foo\"",
4896 "@ 0x00000088: [0x0000000000001000 - 0x0000000000001100) \"bar\""};