diff options
Diffstat (limited to 'lit')
237 files changed, 10264 insertions, 478 deletions
diff --git a/lit/Breakpoint/Inputs/debug_addrx.yaml b/lit/Breakpoint/Inputs/debug_addrx.yaml new file mode 100644 index 000000000000..7d4cd74543e3 --- /dev/null +++ b/lit/Breakpoint/Inputs/debug_addrx.yaml @@ -0,0 +1,57 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000201000 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000201000 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C700112000E897010000F4CCCCCCCCCCCC55B810202000483D102020004889E57417B8000000004885C0740D5DBF10202000FFE00F1F4400005DC3660F1F440000BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF10202000FFE00F1F005DC3660F1F440000803D592F0000007517554889E5E87EFFFFFFC605472F0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89CCCCCCCCCCCCCCCCCCC3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC31C0C3CCCCCCCCCCCCCCCCCCCCCCCCCC415741564189FF415541544C8D25E61E000055488D2DE61E0000534989F64989D54C29E54883EC0848C1FD03E8430000004885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 44000000050000006B0000005F0000003A0000000E0000001A0000001E000000930000002E0000001600000067000000050000009A0000008E000000000000006900000095000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 74686973005F5A336261723141005F76707472244100666F6F00696E74005F5F7674626C5F7074725F74797065005F5A4E314133666F6F4576002F686F6D652F756D622F74657374735F323031382F3131326C6C64625F726C657461677300746573742E63630041006100636C616E672076657273696F6E20382E302E3020287472756E6B2033343438333429006D61696E0078006F626A410062617200 + - Name: .debug_loc + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: E010200000000000E010200000000000030011009FE010200000000000E1102000000000000500110023019F00000000000000000000000000000000 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 011101252513050325721710171B25731711015517741700000213011D13360B03250B0B3A0B3B0B0000030D0003254913380B34190000040D00032549133A0B3B0B380B0000052E016E2503253A0B3B0B4C0B4D183C193F191D130000060500491334190000070F0049130000080F00491303250000091500491300000A240003253E0B0B0B00000B2E01111B1206401864137A193B0B471300000C050003254913341900000D3400021703253A0B3B0B491300000E2E01111B120640187A196E2503253A0B3B0B3F1900000F050003253A0B3B0B49130000102E01111B120640187A1903253A0B3B0B49133F19000011340003253A0B3B0B4913000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: C8000000050001080000000001000400010800000000000000020800000000000000000000000C0000000C000000022E000000040910010303035C0000000004066C0000000104080507080105010210002E000000067000000000000761000000086700000005096C0000000A040504072E0000000B000100000001578600000008480000000C0DC60000000D000000000601096C000000000E010100000001570A0B010D0F0E010D2E0000000010020300000001570C01116C000000110F01122E00000000072E00000000 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 27000000050008000000000007E0102000000000000107F010200000000000010700112000000000000300 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 1C00000005000800E010200000000000F0102000000000000011200000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 97000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E02250000000066F622AD4EB40BCEA506478235D9D438250000000066F622AD4EB40BCEA506478235D9D438000902E0102000000000001905010A150201000101000902F010200000000000030C0105010A140201000101000902001120000000000003100105030A170203000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3131326C6C64625F726C657461677300746573742E636300 +Symbols: diff --git a/lit/Breakpoint/Inputs/debug_rnglist_basic.yaml b/lit/Breakpoint/Inputs/debug_rnglist_basic.yaml new file mode 100644 index 000000000000..6a6db28790e3 --- /dev/null +++ b/lit/Breakpoint/Inputs/debug_rnglist_basic.yaml @@ -0,0 +1,50 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400440 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400440 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C730054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89900F1F840000000000554889E5B8010000005DC30F1F440000554889E54883EC10C745FC00000000E8DCFFFFFF4883C4105DC3660F1F440000415741564189FF415541544C8D25A618000055488D2DA6180000534989F64989D54C29E54883EC0848C1FD03E86FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 200000000500000000000000230000002C0000005D00000065000000690000006D000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 636C616E672076657273696F6E20382E302E3020287472756E6B203334333438372900746573742E637070002F686F6D652F756D622F74657374735F323031382F313033726E676C697374732F6C6C64622F63726561746574657374005F5A337A656476007A656400696E74006D61696E00 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 011101252513050325721710171B251101551774170000022E001101120640186E2503253A0B3B0B49133F190000032E0011011206401803253A0B3B0B49133F19000004240003253E0B0B0B000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 580000000500010800000000010004000108000000000000000200000000000000000C0000000C0000000220054000000000000B000000015603040101570000000330054000000000001A0000000156060105570000000405050400 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 1D00000005000800000000000720054000000000000B0730054000000000001A00 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 82000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E023100000000F7B7492A97F18E69F7EC76B19E9024873100000000F7B7492A97F18E69F7EC76B19E90248700090220054000000000000105020A4B020700010100090230054000000000001605090AE5050206580206000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F313033726E676C697374732F6C6C64622F6372656174657465737400746573742E63707000 +Symbols: +... diff --git a/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml b/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml new file mode 100644 index 000000000000..b919e3e4d1cb --- /dev/null +++ b/lit/Breakpoint/Inputs/debug_rnglist_offset_pair.yaml @@ -0,0 +1,53 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400440 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400440 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C740054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000B9020000008B05F91A00000F1F44000021F883C1FF75F98905E71A0000C3669050BF01000000E8D5FFFFFF31C059C390415741564189FF415541544C8D25A618000055488D2DA6180000534989F64989D54C29E54883EC0848C1FD03E86FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 300000000500000000000000230000002C0000004F00000051000000550000005D0000006100000066000000680000006A000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 636C616E672076657273696F6E20382E302E3020287472756E6B203334343033352900746573742E637070002F686F6D652F756D622F74657374735F323031382F3130365F726E676C6973747332004300696E74005F5A33666F6F6900666F6F006D61696E00500049005700 + - Name: .debug_loc + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 05000000000000001000000000000000030011009F00000000000000000000000000000000 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 011101252513050325721710171B251101120674170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000042E011101120640187A196E2503253A0B3B0B3F190000050500021803253A0B3B0B49130000060B01110112060000073400021703253A0B3B0B49130000080B015517000009340003253A0B3B0B491300000A2E011101120640187A1903253A0B3B0B49133F1900000B48007F137D0100000C0F004913000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: AC0000000500010800000000010004000108000000000000000220054000000000002F0000000C00000002033C000000010309032420400000000000030405040420054000000000001E0000000157050601040501550801043C0000000625054000000000001800000007000000000901063C000000080C000000090A0107AA0000000000000A40054000000000000F000000015707010E3C0000000B400000004B05400000000000000C3C00000000 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 18000000050008000000000005200540000000000004051204171D00 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 7F000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E0223000000003D8C80E874CE6D5F1FC4A6544BE9D5B323000000003D8C80E874CE6D5F1FC4A6544BE9D5B300090220054000000000001605080A5B0515C60503063C0508063005016805004105030A21A00204000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3130365F726E676C697374733200746573742E63707000 +Symbols: diff --git a/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml b/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml new file mode 100644 index 000000000000..79807773432f --- /dev/null +++ b/lit/Breakpoint/Inputs/debug_rnglist_rlestartend.yaml @@ -0,0 +1,49 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000201000 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000201000 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C7F0102000E897010000F4CCCCCCCCCCCC55B810202000483D102020004889E57417B8000000004885C0740D5DBF10202000FFE00F1F4400005DC3660F1F440000BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF10202000FFE00F1F005DC3660F1F440000803D592F0000007517554889E5E87EFFFFFFC605472F0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89CCCCCCCCCCCCCCCCCC554889E5B8010000005DC3CCCCCCCCCC554889E54883EC10C745FC00000000E8DCFFFFFF4883C4105DC3CCCCCCCCCCCC415741564189FF415541544C8D25E61E000055488D2DE61E0000534989F64989D54C29E54883EC0848C1FD03E8430000004885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2000000005000000040000002B0000003900000062000000270000000000000034000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 696E7400636C616E672076657273696F6E20382E302E3020287472756E6B2033343430333529007A656400746573742E637070006D61696E002F686F6D652F756D622F74657374735F323031382F3130375F726E676C6973747374617274656E64005F5A337A65647600 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 011101252513050325721710171B251101551774170000022E001101120640186E2503253A0B3B0B49133F190000032E0011011206401803253A0B3B0B49133F19000004240003253E0B0B0B000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 580000000500010800000000010004000108000000000000000200000000000000000C0000000C00000002E0102000000000000B0000000156030401015700000003F0102000000000001A0000000156060105570000000405050400 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2B000000050008000000000006E010200000000000EB1020000000000006F0102000000000000A1120000000000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 82000000050008004C000000010101FB0E0D00010101010000000100000101011F010900000003011F020F051E020000000000C404455D157064301CF8C713A4AC4CEE0000000000C404455D157064301CF8C713A4AC4CEE000902E0102000000000000105030A4B0207000101000902F01020000000000016050A0AE5050306580206000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E637070002F686F6D652F756D622F74657374735F323031382F3130375F726E676C6973747374617274656E6400 +Symbols: diff --git a/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml b/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml new file mode 100644 index 000000000000..15b95e2a1750 --- /dev/null +++ b/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml @@ -0,0 +1,57 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000201000 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000201000 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C700112000E897010000F4CCCCCCCCCCCC55B810202000483D102020004889E57417B8000000004885C0740D5DBF10202000FFE00F1F4400005DC3660F1F440000BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF10202000FFE00F1F005DC3660F1F440000803D592F0000007517554889E5E87EFFFFFFC605472F0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89CCCCCCCCCCCCCCCCCCC3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC31C0C3CCCCCCCCCCCCCCCCCCCCCCCCCC415741564189FF415541544C8D25E61E000055488D2DE61E0000534989F64989D54C29E54883EC0848C1FD03E8430000004885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 28000000050000003000000067000000000000002800000076000000240000006F0000007400000022000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3131345F726E676C69737473007900696E74005F5A336261726900636C616E672076657273696F6E20382E302E3020287472756E6B203334353639392920286C6C766D2F7472756E6B203334353530362900746573742E6363006D61696E00780062617200 + - Name: .debug_loclists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '15000000050008000000000003000301005503020101005000' + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 011101252513050325721710171B2573171101552374178C01170000022E01111B120640187A196E2503253A0B3B0B49133F190000030500021703253A0B3B0B49130000042E01111B120640187A1903253A0B3B0B49133F1900000534001C0D03253A0B3B0B4913000006240003253E0B0B0B000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 6600000005000108000000000100040001080000000000000002080000000000000000000000000C0000000C00000002000400000001570304010365000000030C0000000701036500000000040106000000015706010765000000050108010865000000000605050400 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '1300000005000800010000000400000003000403010600' + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 1C00000005000800E010200000000000F010200000000000E310200000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 82000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E022200000000FC42F1EAF1396417A8FBE442FBADC7032200000000FC42F1EAF1396417A8FBE442FBADC703000902E01020000000000014050B0A130504063C0201000101000902F0102000000000001805030A140206000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3131345F726E676C6973747300746573742E636300 +Symbols: diff --git a/lit/Breakpoint/Inputs/implicit_const_form_support.yaml b/lit/Breakpoint/Inputs/implicit_const_form_support.yaml new file mode 100644 index 000000000000..f1d8373923b4 --- /dev/null +++ b/lit/Breakpoint/Inputs/implicit_const_form_support.yaml @@ -0,0 +1,41 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x00000000004004A0 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x00000000004004A0 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C01006400048C7C1A005400048C7C77E054000E8B7FFFFFFF4660F1F440000B820204000483D202040007413B8000000004885C07409BF20204000FFE06690C30F1F440000662E0F1F840000000000BE202040004881EE2020400048C1FE034889F048C1E83F4801C648D1FE7411B8000000004885C07407BF20204000FFE0C30F1F440000662E0F1F840000000000803DD91A0000007517554889E5E87EFFFFFFC605C71A0000015DC30F1F440000C30F1F440000662E0F1F840000000000EB8EB800000000C3B800000000C3554889E5534883EC08E8E6FFFFFF89C3E8E5FFFFFF01D84883C4085B5DC30F1F4000415741564189FF415541544C8D251618000055488D2D16180000534989F64989D54C29E54883EC0848C1FD03E877FEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_frame + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000008 + Content: 14000000FFFFFFFF03000178100C0708900100000000000014000000000000007205400000000000060000000000000014000000000000007805400000000000060000000000000034000000000000007E054000000000001E0000000000000004010000000E10860204030000000D060405000000830304140000000C070800 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 900000000500010800000000023A00000021310000000000000072054000000000002A0000000000000000000000039A0000000109054C0000007E054000000000001E00000000000000019C040405696E7400012C000000059F0000004C00000078054000000000000600000000000000019C018C00000001910000004C00000072054000000000000600000000000000019C00 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 012E003F19030E3A21013B0B3921056E0E49131101120740187A190000021101250E130B030E1B0E1101120710170000032E003F19030E3A0B3B0B390B49131101120740187C1900000424000B0B3E0B0308000000 + - Name: .debug_aranges + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2C00000002000000000008000000000072054000000000002A0000000000000000000000000000000000000000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 5600000002001F0000000101FB0E0D00010101010000000100000100746573742E6370700000000000050C000902720540000000000001050913050159050C22050913050159050C22050D9105167405175805012F0207000101 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3130315F696D706C696369745F636F6E73742F6E657700666F6F3200746573742E63707000474E5520432B2B313420382E302E3120323031383033313920286578706572696D656E74616C29202D6D74756E653D67656E65726963202D6D617263683D7838362D3634202D67202D6764776172662D3500666F6F31005F5A34666F6F3176006D61696E005F5A34666F6F327600 +Symbols: +... diff --git a/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml b/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml new file mode 100644 index 000000000000..5adc9d82fcad --- /dev/null +++ b/lit/Breakpoint/Inputs/single-file-split-dwarf.o.yaml @@ -0,0 +1,84 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x0000000000000010 + Content: 554889E531C0C745FC000000005DC390554889E55DC3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C000000050000000000000000000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F002F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C65006D61696E00666F6F005F5A33666F6F7600696E7400 + - Name: .debug_loc.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B44219B3421711011206000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2B00000005000408000000003F4B7684A29835B9010000000000000000000100000000000000000000000016000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_str_offsets.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 200000000500000000000000070000002A00000033000000380000003C00000044000000 + - Name: .debug_str.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F00636C616E672076657273696F6E20382E302E3020287472756E6B203334323731382900746573742E637070006D61696E00696E74005F5A33666F6F7600666F6F00 + - Name: .debug_info.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 3600000005000508000000003F4B7684A29835B901000104000202000F0000000156030101350000000301060000000156050601050404050400 + - Name: .debug_abbrev.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 011101B042252525130503250000022E0011813E1206401803253A0B3B0B49133F190000032E0011813E120640186E2503253A0B3B0B3F19000004240003253E0B0B0B000000 + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '140000000500080000000000000000000000000000000000' + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: A00000000500000001000000000000000000000004000000040000000D000000080000004C4C564D3037303000000000010000000200000003000000040000003080880B8973880B6A7F9A7C0B3D06B5000000000000000000000000000000000000000009000000120000001B0000002E2E03130000242403130000002435000000000000002E29000000000000002E1A000000000000002E2900000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 210000000200000000002F0000002900000030666F6F001A000000306D61696E0000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 170000000200000000002F0000003500000090696E740000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 70000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E020000000000FD7C0F2E46BA561F7BDA351B04E677090000000000FD7C0F2E46BA561F7BDA351B04E6770900090200000000000000000105030AC905003F05010A4B0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F39355F6C6C64622F726570726F2F6477617266355F73706C69745F73696E676C655F66696C652F707265706172655F73616D706C6500746573742E63707000 +... diff --git a/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml b/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml new file mode 100644 index 000000000000..da3e160a26e5 --- /dev/null +++ b/lit/Breakpoint/Inputs/single-file-split-dwarf.yaml @@ -0,0 +1,61 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400440 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400440 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0B005400048C7C14005400048C7C720054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000554889E531C0C745FC000000005DC390554889E55DC3662E0F1F840000000000415741564189FF415541544C8D25B618000055488D2DB6180000534989F64989D54C29E54883EC0848C1FD03E87FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C000000050000000000000007000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E6F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006D61696E00666F6F005F5A33666F6F7600696E7400 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B44219B3421711011206000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2B00000005000408000000003F4B7684A29835B9010000000008000000000108000000200540000000000016000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '140000000500080020054000000000003005400000000000' + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: A00000000500000001000000000000000000000004000000040000000D000000080000004C4C564D3037303000000000010000000200000003000000040000003080880B8973880B6A7F9A7C0B3D06B56300000057000000520000005B0000000000000009000000120000001B0000002E2E03130000242403130000002435000000000000002E29000000000000002E1A000000000000002E2900000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 210000000200000000002F0000002900000030666F6F001A000000306D61696E0000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 170000000200000000002F0000003500000090696E740000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 70000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E024B00000000FD7C0F2E46BA561F7BDA351B04E677094B00000000FD7C0F2E46BA561F7BDA351B04E6770900090220054000000000000105030AC905003F05010A4B0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746573742E63707000 +... diff --git a/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml b/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml new file mode 100644 index 000000000000..acacc9b95370 --- /dev/null +++ b/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml @@ -0,0 +1,35 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .debug_loc.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .debug_str_offsets.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 200000000500000000000000090000002C000000340000003C0000004000000045000000 + - Name: .debug_str.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E64776F00636C616E672076657273696F6E20382E302E3020287472756E6B203334373239392900746573742E6363005F5A3362617A760062617A006D61696E00696E7400 + - Name: .debug_info.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 360000000500050800000000E93484C441B7E84A01000104000202000600000001560304010103011C0000000156050104350000000406050400 + - Name: .debug_abbrev.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 011101B042252525130503250000022E00111B120640186E2503253A0B3B0B3F190000032E00111B1206401803253A0B3B0B49133F19000004240003253E0B0B0B000000 +Symbols: {} +DynamicSymbols: {} +... diff --git a/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml b/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml new file mode 100644 index 000000000000..3a362b0d02dd --- /dev/null +++ b/lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml @@ -0,0 +1,61 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400440 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400440 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C730054000E8B7FFFFFFF4660F1F44000055B820204000483D202040004889E57417B8000000004885C0740D5DBF20204000FFE00F1F4400005DC3660F1F440000BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF20204000FFE00F1F005DC3660F1F440000803D391B0000007517554889E5E87EFFFFFFC605271B0000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89660F1F840000000000554889E55DC3662E0F1F840000000000554889E54883EC10C745FC00000000E8DCFFFFFF31C04883C4105DC30F1F4000415741564189FF415541544C8D25A618000055488D2DA6180000534989F64989D54C29E54883EC0848C1FD03E86FFEFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C000000050000000000000009000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 746573742E64776F002F686F6D652F756D622F74657374735F323031382F3132322F69737375652F6477617266355F73706C69740062617A005F5A3362617A76006D61696E00696E7400 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B442197317111B1206000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 240000000500040800000000E93484C441B7E84A010000000008000000000108000000002C000000 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '00' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '140000000500080020054000000000003005400000000000' + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: A00000000500000001000000000000000000000004000000040000000D000000080000004C4C564D3037303000000000010000000000000003000000000000003080880B64D103B5C260880B6A7F9A7C460000003900000035000000410000000000000009000000120000001B0000002E2E03130000242403130000002435000000000000002E1A000000000000002E1A000000000000002E2600000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 210000000200000000002800000026000000306D61696E001A0000003062617A0000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '17000000020000000000280000003500000090696E740000000000' + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 71000000050008004C000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E022C000000004B61BD987753AF9C38389263DC08E24F2C000000004B61BD987753AF9C38389263DC08E24F00090220054000000000000105010A4B0500BC05030AE5750206000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 2F686F6D652F756D622F74657374735F323031382F3132322F69737375652F6477617266355F73706C697400746573742E636300 + diff --git a/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file1.dwo.yaml b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file1.dwo.yaml new file mode 100644 index 000000000000..6346f6c8eac7 --- /dev/null +++ b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file1.dwo.yaml @@ -0,0 +1,40 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .debug_loc.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .debug_str_offsets.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 5C00000005000000000000000A0000002D000000370000004000000050000000520000005A000000600000006200000066000000760000007F000000840000008A0000008F0000009400000096000000990000009C000000A5000000B5000000 + - Name: .debug_str.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 66696C65312E64776F00636C616E672076657273696F6E20382E302E3020287472756E6B20333437323939290066696C65312E637070007E73747275637431005F5A4E37737472756374313166457600660073747275637431005F5A316776006700696E74005F5A4E377374727563743144324576005F5A347465737476007465737400666C6F6174006D61696E00746869730078007331007332007E73747275637432005F5A4E377374727563743231664576007374727563743200 + - Name: .debug_info.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: D900000005000508000000008D03E0CB5B41F18901000104000202000B000000015607080103B400000003040601020104030202054000000000060405020300072A00000008013200000001565800000001070A30000000090291780FBC0000000A000B029174100108B400000000000C02060000000156010B3A00000002030900000001560B0C010DB80000000D046E00000001560E0111B40000000B0291781101152A0000000B029170120116C1000000000E0905040E0D0404072A0000000304150102060413020705D70000000006140502080007C100000000 + - Name: .debug_abbrev.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 011101B042252525130503250000022E00111B120640186E2503253A0B3B0B49133F190000031301360B03250B0B3A0B3B0B0000042E0103253A0B3B0B3C193F190000050500491334190000062E006E2503253A0B3B0B3C193F190000070F0049130000082E01111B1206401864133A0B3B0B6E2547130000090500021803254913341900000A0B01552300000B3400021803253A0B3B0B491300000C2E00111B120640183A0B3B0B471300000D2E01111B1206401803253A0B3B0B49133F1900000E240003253E0B0B0B000000 + - Name: .debug_rnglists.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 150000000500080001000000040000000101040C1F04253200 +Symbols: {} +DynamicSymbols: {} +... diff --git a/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file2.dwo.yaml b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file2.dwo.yaml new file mode 100644 index 000000000000..b506415ef8b4 --- /dev/null +++ b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-file2.dwo.yaml @@ -0,0 +1,40 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .debug_loc.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: '' + - Name: .debug_str_offsets.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 3000000005000000000000000A0000002D000000370000004000000050000000520000005A0000006A0000006F00000071000000 + - Name: .debug_str.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 66696C65322E64776F00636C616E672076657273696F6E20382E302E3020287472756E6B20333437323939290066696C65322E637070007E73747275637432005F5A4E37737472756374323166457600660073747275637432005F5A4E3773747275637432443245760074686973007800696E7400 + - Name: .debug_info.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 740000000500050800000000B90811685AA26A1801000104000202040601020603030207043000000000050405020800061A0000000700320000000156480000000103072000000008029178086E00000009000A0291740901047300000000000B0106000000015601072A000000061A0000000C0A050400 + - Name: .debug_abbrev.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 011101B042252525130503250000021301360B03250B0B3A0B3B0B0000032E0103253A0B3B0B3C193F190000040500491334190000052E006E2503253A0B3B0B3C193F190000060F0049130000072E01111B1206401864133A0B3B0B6E254713000008050002180325491334190000090B01552300000A3400021803253A0B3B0B491300000B2E00111B120640183A0B3B0B471300000C240003253E0B0B0B000000 + - Name: .debug_rnglists.dwo + Type: SHT_PROGBITS + Flags: [ SHF_EXCLUDE ] + AddressAlign: 0x0000000000000001 + Content: 150000000500080001000000040000000100040C1F04253200 +Symbols: {} +DynamicSymbols: {} +... diff --git a/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-main.yaml b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-main.yaml new file mode 100644 index 000000000000..ee998b4969f5 --- /dev/null +++ b/lit/Breakpoint/Inputs/split-dwarf5-debug-stroffsets-main.yaml @@ -0,0 +1,70 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400630 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400630 + AddressAlign: 0x0000000000000010 + Content: 31ED4989D15E4889E24883E4F0505449C7C0C008400048C7C15008400048C7C790074000E877FFFFFFF4660F1F44000055B840204000483D402040004889E57417B8000000004885C0740D5DBF40204000FFE00F1F4400005DC3660F1F440000BE40204000554881EE402040004889E548C1FE034889F048C1E83F4801C648D1FE7415B8000000004885C0740B5DBF40204000FFE00F1F005DC3660F1F440000803D69190000007517554889E5E87EFFFFFFC60557190000015DC30F1F440000F3C30F1F4000662E0F1F840000000000554889E55DEB89900F1F840000000000554889E5B8010000005DC30F1F440000554889E54883EC2048897DF8E8DFFFFFFF8945F0E9000000008B45F08945F44883C4205DC389D14889C7894DECE80E00000066666666662E0F1F84000000000050E88AFEFFFF48890424E891FEFFFF90554889E55DC3662E0F1F840000000000554889E50F57C05DC30F1F8000000000554889E54883EC20C745FC00000000E8CCFFFFFFE897000000E8D2FFFFFFF30F1145E0E900000000C745FC00000000488D7DF0E838000000488D7DF8E84FFFFFFF8B45FC4883C4205DC389D1488945E8894DE4488D7DF0E814000000488D7DF8E82BFFFFFF488B7DE8E812FEFFFF6690554889E54883EC2048897DF8E8FFFEFFFF8945F0E9000000008B45F08945F44883C4205DC389D14889C7894DECE82EFFFFFF66666666662E0F1F840000000000554889E55DC3662E0F1F840000000000415741564189FF415541544C8D257615000055488D2D76150000534989F64989D54C29E54883EC0848C1FD03E81FFDFFFF4885ED742031DB0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3 + - Name: .eh_frame_hdr + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x0000000000400B1C + AddressAlign: 0x0000000000000004 + Content: 011B033BE8FDFFFF0C000000A4FAFFFF04FFFFFF14FBFFFF44FFFFFFF4FBFFFF04FEFFFF04FCFFFF7CFFFFFF44FCFFFF24FEFFFF54FCFFFF3CFEFFFF64FCFFFF5CFEFFFF74FCFFFFA4FFFFFFE4FCFFFFD4FFFFFF24FDFFFF7CFEFFFF34FDFFFFA4FEFFFFA4FDFFFFECFEFFFF + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 0C00000005000000000000000A0000000C000000050000008F0000000A000000 + - Name: .debug_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 66696C65312E64776F000000000000000000000000000000000000000000000000000000000000000000000000000067005F5A3167760073747275637431007E73747275637431005F5A4E3773747275637431443245760066005F5A4E3773747275637431316645760074657374005F5A347465737476006D61696E00696E7400666C6F617400737472756374320066696C65322E64776F007E73747275637432005F5A4E377374727563743244324576005F5A4E37737472756374323166457600 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 01110010177217B042251B25B44219731711015523741700000001110010177217B042251B25B442197317110155237417000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2C00000005000408000000008D03E0CB5B41F1890100000000080000000001080000000000000000000000000C0000002C000000050004081A000000B90811685AA26A1801F4000000180000000001380000000000000000000000002C000000 + - Name: .debug_rnglists + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 1C00000005000800010000000400000003000B03013203020603030903046E001300000005000800010000000400000003003203010600 + - Name: .debug_macinfo + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: '0000' + - Name: .debug_addr + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 2C0000000500080010074000000000002007400000000000700740000000000080074000000000009007400000000000140000000500080000084000000000004008400000000000 + - Name: .debug_names + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: 84010000050000000100000000000000000000000D0000000D00000013000000080000004C4C564D3037303000000000000000000000000001000000050000000600000007000000000000000800000000000000000000000B0000000C0000000D0000006CDCF90ECAA55B7A6A7F9A7C1B1710AF1C1710AF0BB602000CB602003080880B88F31A59AB8B407A65689E7C798A6A6F9BE1710F3100000048000000780000003700000087000000580000002F0000007D0000006F0000005A0000006A0000003F000000810000000000000009000000120000001B000000240000002D000000360000003F00000048000000510000005A000000630000006C0000002E2E03130000242403130000131303130000002E1A000000000000002E45000000000000002E8E00000000000000132A0000000000000013C1000000000000002E70000000000000002E1A0000000000000024B4000000000000002E7E000000000000002E70000000000000002E7E000000000000002E450000000000000024B800000000000000D800000005000000010000000000000000000000060000000600000013000000080000004C4C564D30373030300000000100000002000000030000000500000006000000000000007A8A6A6F4BBE6D7A3080880B1C1710AF0BB602002CA4527A99000000A20000007D0000008700000058000000B20000000000000009000000120000001B000000240000002D0000002E2E03130000242403130000131303130000002E35000000000000002E3500000000000000247300000000000000131A000000000000002E60000000000000002E6000000000000000000000 + - Name: .debug_gnu_pubnames + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 50000000020000000000300000007000000030737472756374313A3A66007E0000003074657374008E000000306D61696E001A0000003067004500000030737472756374313A3A7E73747275637431000000000035000000020030000000300000003500000030737472756374323A3A7E73747275637432006000000030737472756374323A3A660000000000 + - Name: .debug_gnu_pubtypes + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: 3C000000020000000000300000002A000000107374727563743100B800000090666C6F617400C1000000107374727563743200B400000090696E74000000000024000000020030000000300000001A0000001073747275637432007300000090696E740000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: F00000000500080065000000010101FB0E0D00010101010000000100000101011F02000000002500000003011F020F051E0327000000004195A4D2AC12B4F174DBFAD42A0CB9B227000000004195A4D2AC12B4F174DBFAD42A0CB9B2310000000193DBF7D5AE9184526D2D968251B49D0200090210074000000000001405030A4B0207000101000902200740000000000018050B0ABB060378C80507440501063D050B65020D0001010009027007400000000000030A0105140A4A02020001010009028007400000000000030C0105020A4B0205000101000902900740000000000003100105030AE5595DE6050175023F000101A30000000500080065000000010101FB0E0D00010101010000000100000101011F02000000002500000003011F020F051E03390000000040CCBAC21BCB1E430C6A1484F8570F05390000000040CCBAC21BCB1E430C6A1484F8570F05310000000193DBF7D5AE9184526D2D968251B49D02000902000840000000000014050B0ABB06C40507400501063D050B65020D00010100090240084000000000001805140A4A0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x0000000000000001 + Content: 000000000000000000000000000000000000000000000000000000000000000000000000002E0066696C65312E637070006465636C732E680066696C65322E63707000 diff --git a/lit/Breakpoint/case-insensitive.test b/lit/Breakpoint/case-insensitive.test index 841448c42990..f6330b5f4320 100644 --- a/lit/Breakpoint/case-insensitive.test +++ b/lit/Breakpoint/case-insensitive.test @@ -1,8 +1,6 @@ -# REQUIRES: windows -# XFAIL: windows -# -> llvm.org/pr24528 -# -# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t +# REQUIRES: system-windows + +# RUN: %build %p/Inputs/case-sensitive.c --nodefaultlib -o %t # RUN: lldb-test breakpoints %t %s | FileCheck %s breakpoint set -f case-sensitive.c -l 3 diff --git a/lit/Breakpoint/case-sensitive.test b/lit/Breakpoint/case-sensitive.test index dd5635b952d6..3f47974c295d 100644 --- a/lit/Breakpoint/case-sensitive.test +++ b/lit/Breakpoint/case-sensitive.test @@ -1,6 +1,6 @@ # REQUIRES: nowindows # -# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t +# RUN: %build %p/Inputs/case-sensitive.c --nodefaultlib -o %t # RUN: lldb-test breakpoints %t %s | FileCheck %s breakpoint set -f case-sensitive.c -l 3 diff --git a/lit/Breakpoint/debug_addrx.test b/lit/Breakpoint/debug_addrx.test new file mode 100644 index 000000000000..d5813cb96686 --- /dev/null +++ b/lit/Breakpoint/debug_addrx.test @@ -0,0 +1,30 @@ +# RUN: yaml2obj %p/Inputs/debug_addrx.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# The following code and invocation were used. +# clang -gdwarf-5 test.cc -o test_v5 -fuse-ld=lld -fno-rtti -O2 -ffunction-sections +# Then output was converted to yaml and reduced. +# +# struct A { +# void foo() {}; +# }; +# +# void bar(struct A a) { +# a.foo(); +# } +# +# int main() { +# A objA; +# bar(objA); +# +# return 0; +# } +# +# clang and LLD versions were 8.0.0 (trunk 344834) +# +# Output file contains DW_FORM_addrx forms. + +b bar + +# CHECK-LABEL: b bar +# CHECK: Address: {{.*}}`bar(A) at test.cc:15:1 diff --git a/lit/Breakpoint/debug_rnglist_basic.test b/lit/Breakpoint/debug_rnglist_basic.test new file mode 100644 index 000000000000..268e4a0ed301 --- /dev/null +++ b/lit/Breakpoint/debug_rnglist_basic.test @@ -0,0 +1,30 @@ +# RUN: yaml2obj %p/Inputs/debug_rnglist_basic.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# The following code and invocation were used to produce yaml file, +# which was manually reduced after that. +# clang -O0 -gdwarf-5 test.cpp -o test -fuse-ld=lld -ffunction-sections +# +# //test.cpp: +# int zed() { +# return 1; +# } +# +# int main() { +# return zed(); +# } +# +# clang and LLD versions were 8.0.0 (trunk 343487) +# +# Output file contains .debug_rnglists section with basic entries: +# DW_RLE_start_length and DW_RLE_end_of_list. +# If LLDB would not be able to parse the section and entries correctly, +# then reported location would be incorrect. + +b main +# CHECK-LABEL: b main +# CHECK: Address: {{.*}}`main + 15 at test.cpp:6:9 + +b zed +# CHECK-LABEL: b zed +# CHECK: Address: {{.*}}`zed() + 4 at test.cpp:2:2 diff --git a/lit/Breakpoint/debug_rnglist_offset_pair.test b/lit/Breakpoint/debug_rnglist_offset_pair.test new file mode 100644 index 000000000000..8edf3ee4f000 --- /dev/null +++ b/lit/Breakpoint/debug_rnglist_offset_pair.test @@ -0,0 +1,33 @@ +# RUN: yaml2obj %p/Inputs/debug_rnglist_offset_pair.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# The following code and invocation were used to produce asm file, +# which was manually edited to add DW_RLE_base_address entry. +# clang -S -g -gdwarf-5 -O1 test.cpp -o test.s +# Then it was compiled and converted to yaml. +# +# int C = 0; +# void foo(int P) +# { +# for (int I = 0; I < 2; ++I) { +# int *W = &C; +# *W &= P; +# } +# } +# +# int main () +# { +# foo (1); +# return 0; +# } +# +# clang and LLD versions were 8.0.0 (trunk 344035) +# +# Output file contains .debug_rnglists section with entries: +# DW_RLE_offset_pair and DW_RLE_base_address. + +b foo +# CHECK-LABEL: b foo +# CHECK: Address: {{.*}}`foo(int) + 5 at test.cpp:8:8 + + diff --git a/lit/Breakpoint/debug_rnglist_rlestartend.test b/lit/Breakpoint/debug_rnglist_rlestartend.test new file mode 100644 index 000000000000..9c8beb82c529 --- /dev/null +++ b/lit/Breakpoint/debug_rnglist_rlestartend.test @@ -0,0 +1,28 @@ +# RUN: yaml2obj %p/Inputs/debug_rnglist_rlestartend.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# Test shows that LDLB is able to handle DW_RLE_start_end entries properly. + +# The following code and invocation were used to produce asm file. +# clang -O0 -gdwarf-5 test.cpp -S -o test.s -fuse-ld=lld -ffunction-sections +# It was edited to use DW_RLE_start_end, compiled and converted to yaml. +# The yaml was manually reduced. +# +# //test.cpp: +# int zed() { +# return 1; +# } +# +# int main() { +# return zed(); +# } +# +# clang and LLD versions were 8.0.0 (trunk 344035) + +b main +# CHECK-LABEL: b main +# CHECK: Address: {{.*}}`main + 15 at test.cpp:6:10 + +b zed +# CHECK-LABEL: b zed +# CHECK: Address: {{.*}}`zed() + 4 at test.cpp:2:3 diff --git a/lit/Breakpoint/debug_rnglistx_rlex.test b/lit/Breakpoint/debug_rnglistx_rlex.test new file mode 100644 index 000000000000..79a80479e72c --- /dev/null +++ b/lit/Breakpoint/debug_rnglistx_rlex.test @@ -0,0 +1,28 @@ +# RUN: yaml2obj %p/Inputs/debug_rnglistx_rlex.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +# The following code and invocation were used. +# clang -gdwarf-5 test.cc -o test_v5 -fuse-ld=lld -fno-rtti -O2 -ffunction-sections +# Then output was converted to yaml and reduced. +# +# int bar(int x) { +# return ++x; +# } +# +# int main() { +# int y = 1; +# return bar(y); +# } +# +# clang and LLD versions were 8.0.0 (trunk 345699) +# +# Output file contains DW_FORM_rnglistx and DW_RLE_startx_length. + +b bar +b main + +# CHECK-LABEL: b bar +# CHECK: Address: {{.*}}`bar(int) at test.cc:4:11 + +# CHECK-LABEL: b main +# CHECK: Address: {{.*}}`main at test.cc:9:3 diff --git a/lit/Breakpoint/implicit_const_form_support.test b/lit/Breakpoint/implicit_const_form_support.test new file mode 100644 index 000000000000..183181d2f307 --- /dev/null +++ b/lit/Breakpoint/implicit_const_form_support.test @@ -0,0 +1,33 @@ +# RUN: yaml2obj %p/Inputs/implicit_const_form_support.yaml > %ttest +# RUN: lldb-test breakpoints %ttest %s | FileCheck %s + +## The intention of the test is to check that DW_FORM_implicit_const +## is supported and handled properly. + +## About implicit_const_form_support.yaml: +## The following invocation and code were used to produce the binary +## which was converted to yaml and reduced: +## gcc version 8.0.1 20180319 (experimental) (GCC) +## +## g++ test.cpp -g -gdwarf-5 -o test +## +## // test.cpp +## int foo1() { +## return 0; +## } +## +## int foo2() { +## return 0; +## } +## +## int main() { +## return foo1() + foo2(); +## } + +b foo1 +# CHECK-LABEL: b foo1 +# CHECK: Address: {{.*}}foo1() at test.cpp:2:9 + +b foo2 +# CHECK-LABEL: b foo2 +# CHECK: Address: {{.*}}foo2() at test.cpp:6:9 diff --git a/lit/Breakpoint/single-file-split-dwarf.test b/lit/Breakpoint/single-file-split-dwarf.test new file mode 100644 index 000000000000..d0cc003bf210 --- /dev/null +++ b/lit/Breakpoint/single-file-split-dwarf.test @@ -0,0 +1,44 @@ +# RUN: rm -rf %t.dir +# RUN: mkdir %t.dir +# RUN: cd %t.dir +# RUN: yaml2obj %p/Inputs/single-file-split-dwarf.yaml > %t.dir/test +# RUN: yaml2obj %p/Inputs/single-file-split-dwarf.o.yaml > %t.dir/test.o +# RUN: lldb-test breakpoints %t.dir/test %s | FileCheck %s + +# This test checks that source code location is shown correctly +# when single split file debug information is used (when .dwo sections are in .o files). +# +# single-file-split-dwarf.yaml and single-file-split-dwarf.o.yaml are +# reduced yaml files produces from the object file and the corresponding executable. +# +# The following code was used initially: +# int main() { +# return 0; +# } +# +# void foo() { +# } +# +# Invocation used to produce .o file was: +# clang test.cpp -gdwarf-5 -gsplit-dwarf=single -c -o test.o -v +# +# The full invocation used to produce the executable was: +# "/usr/local/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker +# /lib64/ld-linux-x86-64.so.2 -o test /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crt1.o +# /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7.3.0/crtbegin.o +# -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0 -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu +# -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../.. +# -L/home/umb/LLVM/build/bin/../lib -L/lib -L/usr/lib test.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc +# --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/7.3.0/crtend.o +# /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/crtn.o +# +# Also, the DW_AT_comp_dir string value set to empty in yaml produced. +# Build bots had different path there and failed to find object. + +b main +# CHECK-LABEL: b main +# CHECK: Address: {{.*}}main + 13 at test.cpp:2:3 + +b foo +# CHECK-LABEL: b foo +# CHECK: Address: {{.*}}foo() + 4 at test.cpp:6:1 diff --git a/lit/Breakpoint/split-dwarf-5-addrbase.test b/lit/Breakpoint/split-dwarf-5-addrbase.test new file mode 100644 index 000000000000..72a717d609dc --- /dev/null +++ b/lit/Breakpoint/split-dwarf-5-addrbase.test @@ -0,0 +1,30 @@ +# RUN: rm -rf %t.dir +# RUN: mkdir %t.dir +# RUN: cd %t.dir +# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.dwo.yaml > %t.dir/test.dwo +# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.yaml > %t.dir/test +# RUN: lldb-test breakpoints %t.dir/test %s | FileCheck %s + +# This test checks that source code location is shown correctly +# when -gsplit-dwarf and DWARF 5 are used. +# +# split-dwarf-5-addrbase.dwo.yaml and split-dwarf-5-addrbase.yamlare +# reduced yaml files produces from the dwo file and the corresponding executable. +# +# The following code was used initially: +# void baz() { +# } +# +# int main() { +# baz(); +# return 0; +# } +# +# Invocation used to produce outputs was: +# clang test.cc -g -fno-rtti -c -gdwarf-5 -gsplit-dwarf +# clang test.o -g -fno-rtti -gdwarf-5 -o test -gsplit-dwarf +# clang version 8.0.0 (trunk 347299) + +b baz +# CHECK-LABEL: b baz +# CHECK: Address: {{.*}}baz() + 4 at test.cc:2:1 diff --git a/lit/Breakpoint/split-dwarf5-debug-stroffsets.test b/lit/Breakpoint/split-dwarf5-debug-stroffsets.test new file mode 100644 index 000000000000..c1418ebb0d52 --- /dev/null +++ b/lit/Breakpoint/split-dwarf5-debug-stroffsets.test @@ -0,0 +1,84 @@ +# RUN: rm -rf %t.dir +# RUN: mkdir %t.dir +# RUN: cd %t.dir +# RUN: yaml2obj %p/Inputs/split-dwarf5-debug-stroffsets-file1.dwo.yaml > %t.dir/file1.dwo +# RUN: yaml2obj %p/Inputs/split-dwarf5-debug-stroffsets-file2.dwo.yaml > %t.dir/file2.dwo +# RUN: yaml2obj %p/Inputs/split-dwarf5-debug-stroffsets-main.yaml > %t.dir/test +# RUN: lldb-test breakpoints %t.dir/test %s | FileCheck %s + +# This test checks that source code location is shown correctly +# when split DWARF 5 is used and both DWO/executable file contains +# .debug_str_offsets/.debug_str_offsets.dwo sections. +# Used clang version 8.0.0 (trunk 347299) +# +# split-dwarf5-debug-stroffsets-file1.dwo.yaml, split-dwarf5-debug-stroffsets-file2.dwo.yaml +# and split-dwarf5-debug-stroffsets-main.yaml are reduced yaml files produces +# from the DWO files and the corresponding executable. +# +# Code: +# // decl.h +# struct struct1 { +# ~struct1(); +# static void f(); +# }; +# +# struct struct2 { +# ~struct2(); +# static void f(); +# }; +# +# int g(); +# +# // file1.cpp +# #include "decls.h" +# +# int g() { +# return 1; +# } +# +# struct1::~struct1() { +# int x = g(); +# } +# +# void struct1::f() {} +# +# float test() { +# return 0.0f; +# } +# +# int main() { +# struct1::f(); +# struct2::f(); +# +# struct1 s1; +# struct2 s2; +# +# test(); +# +# return 0; +# } +# +# // file2.cpp +# +# +# #include "decls.h" +# +# struct2::~struct2() { +# int x = g(); +# } +# +# void struct2::f() {} +# +# +# Invocation used was: +# clang++ file1.cpp -o file1.o -g -fno-rtti -c -gdwarf-5 -gsplit-dwarf -ffunction-sections +# clang++ file2.cpp -o file2.o -g -fno-rtti -c -gdwarf-5 -gsplit-dwarf -ffunction-sections +# clang++ file1.o file2.o -g -fno-rtti -gdwarf-5 -o test -gsplit-dwarf -ffunction-sections + +b struct1::f +# CHECK-LABEL: b struct1::f +# CHECK: Address: {{.*}}struct1::f() + 4 at file1.cpp:11:20 + +b struct2::f +# CHECK-LABEL: b struct2::f +# CHECK: Address: {{.*}}struct2::f() + 4 at file2.cpp:7:20 diff --git a/lit/BuildScript/modes.test b/lit/BuildScript/modes.test new file mode 100644 index 000000000000..02311f712d77 --- /dev/null +++ b/lit/BuildScript/modes.test @@ -0,0 +1,35 @@ +RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
+RUN: | FileCheck --check-prefix=COMPILE %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
+RUN: | FileCheck --check-prefix=COMPILE-MULTI %s
+
+RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foo.exe foobar.obj \
+RUN: | FileCheck --check-prefix=LINK %s
+
+RUN: %build -n --verbose --arch=32 --mode=link --compiler=any -o %t/foobar.exe foo.obj bar.obj \
+RUN: | FileCheck --check-prefix=LINK-MULTI %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foobar.c \
+RUN: | FileCheck --check-prefix=BOTH %s
+
+RUN: %build -n --verbose --arch=32 --mode=compile-and-link --compiler=any -o %t/foobar.exe foo.c bar.c \
+RUN: | FileCheck --check-prefix=BOTH-MULTI %s
+
+
+COMPILE: compiling foobar.c -> foo.out
+
+COMPILE-MULTI: compiling foo.c -> foo.o{{(bj)?}}
+COMPILE-MULTI: compiling bar.c -> bar.o{{(bj)?}}
+
+
+LINK: linking foobar.obj -> foo.exe
+
+LINK-MULTI: linking foo.obj+bar.obj -> foobar.exe
+
+BOTH: compiling foobar.c -> [[OBJFOO:foobar.exe-foobar.o(bj)?]]
+BOTH: linking [[OBJFOO]] -> foobar.exe
+
+BOTH-MULTI: compiling foo.c -> [[OBJFOO:foobar.exe-foo.o(bj)?]]
+BOTH-MULTI: compiling bar.c -> [[OBJBAR:foobar.exe-bar.o(bj)?]]
+BOTH-MULTI: linking [[OBJFOO]]+[[OBJBAR]] -> foobar.exe
diff --git a/lit/BuildScript/script-args.test b/lit/BuildScript/script-args.test new file mode 100644 index 000000000000..13e8a5160942 --- /dev/null +++ b/lit/BuildScript/script-args.test @@ -0,0 +1,32 @@ +RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any -o %t/foo.out foobar.c \
+RUN: | FileCheck %s
+RUN: %build -n --verbose --arch=32 --mode=compile --compiler=any --outdir %t foo.c bar.c \
+RUN: | FileCheck --check-prefix=MULTI-INPUT %s
+
+
+CHECK: Script Arguments:
+CHECK-NEXT: Arch: 32
+CHECK: Compiler: any
+CHECK: Outdir: {{.*}}script-args.test.tmp
+CHECK: Output: {{.*}}script-args.test.tmp{{.}}foo.out
+CHECK: Nodefaultlib: False
+CHECK: Opt: none
+CHECK: Mode: compile
+CHECK: Clean: True
+CHECK: Verbose: True
+CHECK: Dryrun: True
+CHECK: Inputs: foobar.c
+
+MULTI-INPUT: Script Arguments:
+MULTI-INPUT-NEXT: Arch: 32
+MULTI-INPUT-NEXT: Compiler: any
+MULTI-INPUT-NEXT: Outdir: {{.*}}script-args.test.tmp
+MULTI-INPUT-NEXT: Output:
+MULTI-INPUT-NEXT: Nodefaultlib: False
+MULTI-INPUT-NEXT: Opt: none
+MULTI-INPUT-NEXT: Mode: compile
+MULTI-INPUT-NEXT: Clean: True
+MULTI-INPUT-NEXT: Verbose: True
+MULTI-INPUT-NEXT: Dryrun: True
+MULTI-INPUT-NEXT: Inputs: foo.c
+MULTI-INPUT-NEXT: bar.c
diff --git a/lit/BuildScript/toolchain-clang-cl.test b/lit/BuildScript/toolchain-clang-cl.test new file mode 100644 index 000000000000..cc219aca158f --- /dev/null +++ b/lit/BuildScript/toolchain-clang-cl.test @@ -0,0 +1,49 @@ +REQUIRES: lld, system-windows
+
+RUN: %build -n --verbose --arch=32 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK-32 %s
+
+RUN: %build -n --verbose --arch=64 --compiler=clang-cl --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=CHECK-64 %s
+
+CHECK-32: Script Arguments:
+CHECK-32: Arch: 32
+CHECK-32: Compiler: clang-cl
+CHECK-32: Outdir: {{.*}}
+CHECK-32: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
+CHECK-32: Nodefaultlib: False
+CHECK-32: Opt: none
+CHECK-32: Mode: compile
+CHECK-32: Clean: True
+CHECK-32: Verbose: True
+CHECK-32: Dryrun: True
+CHECK-32: Inputs: foobar.c
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
+CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
+CHECK-32: {{.*}}clang-cl{{(.exe)?}} -m32
+CHECK-32: linking foo.exe-foobar.obj -> foo.exe
+CHECK-32: {{.*}}lld-link
+
+CHECK-64: Script Arguments:
+CHECK-64: Arch: 64
+CHECK-64: Compiler: clang-cl
+CHECK-64: Outdir: {{.*}}
+CHECK-64: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
+CHECK-64: Nodefaultlib: False
+CHECK-64: Opt: none
+CHECK-64: Mode: compile
+CHECK-64: Clean: True
+CHECK-64: Verbose: True
+CHECK-64: Dryrun: True
+CHECK-64: Inputs: foobar.c
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
+CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
+CHECK-64: {{.*}}clang-cl{{(.exe)?}} -m64
+CHECK-64: linking foo.exe-foobar.obj -> foo.exe
+CHECK-64: {{.*}}lld-link{{(.exe)?}}
diff --git a/lit/BuildScript/toolchain-clang.test b/lit/BuildScript/toolchain-clang.test new file mode 100644 index 000000000000..416dc30f6c96 --- /dev/null +++ b/lit/BuildScript/toolchain-clang.test @@ -0,0 +1,14 @@ +RUN: %build -n --verbose --arch=32 --compiler=clang --mode=compile-and-link -o %t/foo.exe foobar.c \ +RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s + +RUN: %build -n --verbose --arch=64 --compiler=clang --mode=compile-and-link -o %t/foo.exe foobar.c \ +RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s + +CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe-foobar.o +CHECK: Cleaning {{.*}}toolchain-clang.test.tmp{{.}}foo.exe +CHECK: compiling foobar.c -> foo.exe-foobar.o +CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c +CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 -g -O0 -c -o {{.*}}foo.exe-foobar.o {{.*}}foobar.c +CHECK: linking foo.exe-foobar.o -> foo.exe +CHECK-32: {{.*}}clang++{{(.exe)?}} -m32 -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o +CHECK-64: {{.*}}clang++{{(.exe)?}} -m64 -o {{.*}}foo.exe {{.*}}foo.exe-foobar.o diff --git a/lit/BuildScript/toolchain-msvc.test b/lit/BuildScript/toolchain-msvc.test new file mode 100644 index 000000000000..85a8f0d62f0c --- /dev/null +++ b/lit/BuildScript/toolchain-msvc.test @@ -0,0 +1,62 @@ +REQUIRES: system-windows, msvc
+
+RUN: %build -n --verbose --arch=32 --compiler=msvc --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=X86 %s
+
+RUN: %build -n --verbose --arch=64 --compiler=msvc --mode=compile-and-link -o %t/foo.exe foobar.c \
+RUN: | FileCheck --check-prefix=X64 %s
+
+X86: Script Arguments:
+X86: Arch: 32
+X86: Compiler: msvc
+X86: Outdir: {{.*}}
+X86: Output: {{.*}}toolchain-msvc.test.tmp\foo.exe
+X86: Nodefaultlib: False
+X86: Opt: none
+X86: Mode: compile
+X86: Clean: True
+X86: Verbose: True
+X86: Dryrun: True
+X86: Inputs: foobar.c
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.ilk
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe-foobar.obj
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
+X86: compiling foobar.c -> foo.exe-foobar.obj
+X86: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x86\cl.exe
+X86: linking foo.exe-foobar.obj -> foo.exe
+X86: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x86\link.exe
+X86: Env
+X86: LIB = {{.*}}\ATLMFC\lib\x86
+X86: {{.*}}\lib\x86
+X86: {{.*}}\ucrt\x86
+X86: {{.*}}\um\x86
+X86: PATH = {{.*}}\bin\{{[Hh]ost[Xx]64}}\x64
+
+
+X64: Script Arguments:
+X64: Arch: 64
+X64: Compiler: msvc
+X64: Outdir: {{.*}}
+X64: Output: {{.*}}toolchain-msvc.test.tmp\foo.exe
+X64: Nodefaultlib: False
+X64: Opt: none
+X64: Mode: compile
+X64: Clean: True
+X64: Verbose: True
+X64: Dryrun: True
+X64: Inputs: foobar.c
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.ilk
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe-foobar.obj
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
+X64: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
+X64: compiling foobar.c -> foo.exe-foobar.obj
+X64: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x64\cl.exe
+X64: linking foo.exe-foobar.obj -> foo.exe
+X64: Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x64\link.exe
+X64: Env
+X64: LIB = {{.*}}\ATLMFC\lib\x64
+X64: {{.*}}\lib\x64
+X64: {{.*}}\ucrt\x64
+X64: {{.*}}\um\x64
+X64: PATH = {{.*}}\bin\{{[Hh]ost[Xx]64}}\x64
diff --git a/lit/CMakeLists.txt b/lit/CMakeLists.txt index 8a93236d2cf0..1ac013b2eed3 100644 --- a/lit/CMakeLists.txt +++ b/lit/CMakeLists.txt @@ -7,13 +7,9 @@ else () set(LLVM_BUILD_MODE "%(build_mode)s") endif () -if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER) - string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER ${LLDB_TEST_C_COMPILER}) -endif () - -if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER) - string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_CXX_COMPILER ${LLDB_TEST_CXX_COMPILER}) -endif () +if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(LLDB_IS_64_BITS 1) +endif() get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY) @@ -24,56 +20,43 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_D list(APPEND LLDB_TEST_DEPS LLDBUnitTests dsymutil + llc lldb lldb-test llvm-config llvm-mc llvm-objcopy + FileCheck + count + not ) if(TARGET lld) list(APPEND LLDB_TEST_DEPS lld) - set(LLDB_HAVE_LLD 1) -else() - set(LLDB_HAVE_LLD 0) endif() -if(BUILD_SHARED_LIBS) - set(ENABLE_SHARED 1) -else() - set(ENABLE_SHARED 0) -endif(BUILD_SHARED_LIBS) - # the value is not canonicalized within LLVM llvm_canonicalize_cmake_booleans( LLDB_DISABLE_PYTHON - LLVM_ENABLE_ZLIB) + LLVM_ENABLE_ZLIB + LLDB_IS_64_BITS) configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py) configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg) + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg) -if(NOT LLDB_BUILT_STANDALONE) - list(APPEND LLDB_TEST_DEPS - FileCheck - not - ) -endif() - -set(LLDB_TEST_PARAMS - lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - ) - add_lit_testsuite(check-lldb-lit "Running lldb lit test suite" ${CMAKE_CURRENT_BINARY_DIR} - PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg DEPENDS ${LLDB_TEST_DEPS} ) @@ -86,8 +69,6 @@ if (TARGET clang) endif() add_lit_testsuites(LLDB - ${CMAKE_CURRENT_BINARY_DIR} - PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg + ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${LLDB_TEST_DEPS} ) diff --git a/lit/Driver/Inputs/Print0.in b/lit/Driver/Inputs/Print0.in new file mode 100644 index 000000000000..cb545cc15ab0 --- /dev/null +++ b/lit/Driver/Inputs/Print0.in @@ -0,0 +1 @@ +expr 0 diff --git a/lit/Driver/Inputs/Print2.in b/lit/Driver/Inputs/Print2.in new file mode 100644 index 000000000000..f51389a02a07 --- /dev/null +++ b/lit/Driver/Inputs/Print2.in @@ -0,0 +1 @@ +expr 2 diff --git a/lit/Driver/Inputs/Print4.in b/lit/Driver/Inputs/Print4.in new file mode 100644 index 000000000000..a2d49f30b990 --- /dev/null +++ b/lit/Driver/Inputs/Print4.in @@ -0,0 +1 @@ +expr 4 diff --git a/lit/Driver/Inputs/Print6.in b/lit/Driver/Inputs/Print6.in new file mode 100644 index 000000000000..dee6212b87c1 --- /dev/null +++ b/lit/Driver/Inputs/Print6.in @@ -0,0 +1 @@ +expr 6 diff --git a/lit/Driver/Inputs/convenience.in b/lit/Driver/Inputs/convenience.in new file mode 100644 index 000000000000..6d5603c43513 --- /dev/null +++ b/lit/Driver/Inputs/convenience.in @@ -0,0 +1,9 @@ +breakpoint set -f hello.cpp -p Hello +run +script print(lldb.debugger) +script print(lldb.target) +script print(lldb.process) +script print(lldb.thread.GetStopDescription(100)) +script lldb.frame.GetLineEntry().GetLine() +script lldb.frame.GetLineEntry().GetFileSpec().GetFilename() +script lldb.frame.GetFunctionName() diff --git a/lit/Driver/Inputs/hello.cpp b/lit/Driver/Inputs/hello.cpp new file mode 100644 index 000000000000..1ec0677aeb2c --- /dev/null +++ b/lit/Driver/Inputs/hello.cpp @@ -0,0 +1,11 @@ +// The build.py script always runs the compiler in C++ mode, regardless of the +// file extension. This results in mangled names presented to the linker which +// in turn cannot find the printf symbol. +extern "C" { +int printf(const char *format, ...); + +int main(int argc, char **argv) { + printf("Hello World\n"); + return 0; +} +} diff --git a/lit/Driver/TestCommands.test b/lit/Driver/TestCommands.test new file mode 100644 index 000000000000..3589abb8278c --- /dev/null +++ b/lit/Driver/TestCommands.test @@ -0,0 +1,41 @@ +# RUN: %lldb -x -b \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -O 'expr 1' \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -O 'expr 3' \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -o 'expr 5' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -o 'expr 7' \ +# RUN: | FileCheck %s +# +# RUN: %lldb -x -b \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -o 'expr 5' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -o 'expr 7' \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -O 'expr 1' \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -O 'expr 3' \ +# RUN: | FileCheck %s +# +# RUN: %lldb -x -b \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -o 'expr 5' \ +# RUN: -O 'expr 1' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -o 'expr 7' \ +# RUN: -O 'expr 3' \ +# RUN: | FileCheck %s + +# CHECK: (int) $0 = 0 +# CHECK: (int) $1 = 1 +# CHECK: (int) $2 = 2 +# CHECK: (int) $3 = 3 +# CHECK: (int) $4 = 4 +# CHECK: (int) $5 = 5 +# CHECK: (int) $6 = 6 +# CHECK: (int) $7 = 7 diff --git a/lit/Driver/TestConvenienceVariables.test b/lit/Driver/TestConvenienceVariables.test new file mode 100644 index 000000000000..99536e4c0290 --- /dev/null +++ b/lit/Driver/TestConvenienceVariables.test @@ -0,0 +1,22 @@ +RUN: %build %p/Inputs/hello.cpp -o %t +RUN: %lldb %t -s %p/Inputs/convenience.in -o quit | FileCheck %s + +script print(lldb.debugger) + +CHECK: stop reason = breakpoint 1.1 +CHECK: Debugger (instance: {{.*}}, id: {{[0-9]+}}) +CHECK: script print(lldb.target) +CHECK: TestConvenienceVariables.test +CHECK: script print(lldb.process) +CHECK: SBProcess: pid = {{[0-9]+}}, +CHECK-SAME: state = stopped, +CHECK-SAME: threads = {{[0-9]+}}, +CHECK-SAME: executable = TestConvenienceVariables.test +CHECK: script print(lldb.thread.GetStopDescription(100)) +CHECK: breakpoint 1.1 +CHECK: script lldb.frame.GetLineEntry().GetLine() +CHECK: 8 +CHECK: script lldb.frame.GetLineEntry().GetFileSpec().GetFilename() +CHECK: hello.c +CHECK: script lldb.frame.GetFunctionName() +CHECK: main
\ No newline at end of file diff --git a/lit/Driver/TestCore.test b/lit/Driver/TestCore.test new file mode 100644 index 000000000000..cca8171da631 --- /dev/null +++ b/lit/Driver/TestCore.test @@ -0,0 +1,2 @@ +# RUN: not %lldb -c /bogus/path 2>&1 | FileCheck %s +# CHECK: error: file specified in --core (-c) option doesn't exist diff --git a/lit/Driver/TestFile.test b/lit/Driver/TestFile.test new file mode 100644 index 000000000000..0e80594aeb1b --- /dev/null +++ b/lit/Driver/TestFile.test @@ -0,0 +1,2 @@ +# RUN: not %lldb -f /bogus/path 2>&1 | FileCheck %s +# CHECK: error: file specified in --file (-f) option doesn't exist diff --git a/lit/Driver/TestNoUseColor.test b/lit/Driver/TestNoUseColor.test new file mode 100644 index 000000000000..62735301fca8 --- /dev/null +++ b/lit/Driver/TestNoUseColor.test @@ -0,0 +1,4 @@ +# RUN: %lldb --no-use-color -s %s | FileCheck %s +settings show use-color +# CHECK: use-color (boolean) = false +q diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit new file mode 100644 index 000000000000..4ab5d56f0364 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit @@ -0,0 +1 @@ +target stop-hook add -n b -o "expr ptr" diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit new file mode 100644 index 000000000000..906c18b004df --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit @@ -0,0 +1 @@ +target stop-hook add -f stop-hook.c -l 30 -e 34 -o "expr ptr"
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit new file mode 100644 index 000000000000..98ed59ca46b2 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit @@ -0,0 +1,3 @@ +target stop-hook add -f stop-hook.c -l 30 -e 34 +expr ptr +DONE
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit new file mode 100644 index 000000000000..f192d9952e97 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit @@ -0,0 +1,7 @@ +break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" +run +target stop-hook add +frame variable --show-globals g_val +thread list +continue +DONE diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit new file mode 100644 index 000000000000..467f60b1e1e0 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit @@ -0,0 +1,4 @@ +break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" +run +target stop-hook add -x 2 -o "frame variable thread_index" +target stop-hook add -o continue diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp b/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp new file mode 100644 index 000000000000..dab133d9d952 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp @@ -0,0 +1,76 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <chrono> +#include <cstdio> +#include <mutex> +#include <random> +#include <thread> + +std::default_random_engine g_random_engine{std::random_device{}()}; +std::uniform_int_distribution<> g_distribution{0, 3000}; + +uint32_t g_val = 0; + +uint32_t +access_pool (bool flag = false) +{ + static std::mutex g_access_mutex; + if (!flag) + g_access_mutex.lock(); + + uint32_t old_val = g_val; + if (flag) + g_val = old_val + 1; + + if (!flag) + g_access_mutex.unlock(); + return g_val; +} + +void +thread_func (uint32_t thread_index) +{ + // Break here to test that the stop-hook mechanism works for multiple threads. + printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index); + + uint32_t count = 0; + uint32_t val; + while (count++ < 4) + { + // random micro second sleep from zero to .3 seconds + int usec = g_distribution(g_random_engine); + printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec); + std::this_thread::sleep_for(std::chrono::microseconds{usec}); // Set break point at this line + + if (count < 2) + val = access_pool (); + else + val = access_pool (true); + + printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count); + } + printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index); +} + + +int main (int argc, char const *argv[]) +{ + std::thread threads[3]; + + // Create 3 threads + for (auto &thread : threads) + thread = std::thread{thread_func, std::distance(threads, &thread)}; + + // Join all of our threads + for (auto &thread : threads) + thread.join(); + + return 0; +} diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook.c b/lit/ExecControl/StopHook/Inputs/stop-hook.c new file mode 100644 index 000000000000..c10c1e5ef0d2 --- /dev/null +++ b/lit/ExecControl/StopHook/Inputs/stop-hook.c @@ -0,0 +1,54 @@ +//===-- main.c --------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#include <stdio.h> +#include <stdlib.h> + +int a(int); +int b(int); +int c(int); + +int a(int val) +{ + if (val <= 1) + return b(val); + else if (val >= 3) + return c(val); + + return val; +} + +int b(int val) +{ + int rc = c(val); + void *ptr = malloc(1024); + if (!ptr) // Set breakpoint here to test target stop-hook. + return -1; + else + printf("ptr=%p\n", ptr); // We should stop here after stepping. + return rc; // End of the line range for which stop-hook is to be run. +} + +int c(int val) +{ + return val + 3; +} + +int main (int argc, char const *argv[]) +{ + int A1 = a(1); + printf("a(1) returns %d\n", A1); + + int C2 = c(2); // Another breakpoint which is outside of the stop-hook range. + printf("c(2) returns %d\n", C2); + + int A3 = a(3); + printf("a(3) returns %d\n", A3); + + return 0; +} diff --git a/lit/ExecControl/StopHook/stop-hook-threads.test b/lit/ExecControl/StopHook/stop-hook-threads.test new file mode 100644 index 000000000000..aa6b668340c7 --- /dev/null +++ b/lit/ExecControl/StopHook/stop-hook-threads.test @@ -0,0 +1,33 @@ +# RUN: %clangxx %p/Inputs/stop-hook-threads.cpp -g -o %t +# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \ +# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s +# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \ +# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FILTER %s +# XFAIL: system-windows + +thread list +break set -f stop-hook-threads.cpp -p "Set break point at this line" +target stop-hook list + +# CHECK: Hook: 1 +# CHECK-NEXT: State: enabled +# CHECK-FILTER-NEXT: Thread +# CHECK-FILTER-NEXT: index: 2 +# CHECK-NEXT: Commands: +# CHECK-NEXT: frame variable + +# CHECK-FILTER: Hook: 2 +# CHECK-FILTER-NEXT: State: enabled +# CHECK-FILTER-NEXT: Commands: +# CHECK-FILTER-NEXT: continue + +# Get the threads going +continue + +# When we filter per thread, we expect exactly 4 identical "frame var" results +# CHECK-FILTER: (uint32_t) thread_index = [[THREAD_INDEX:[0-9]*]] +# CHECK-FILTER-COUNT-3: (uint32_t) thread_index = [[THREAD_INDEX]] +# CHECK-FILTER-NOT: thread_index + +# When we don't filter, we expect to count 12 stopped threads in the thread list output +# CHECK-NO-FILTER-COUNT-12: at stop-hook-threads.cpp{{.*}} stop reason = breakpoint
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/stop-hook.test b/lit/ExecControl/StopHook/stop-hook.test new file mode 100644 index 000000000000..ca6495ef14ad --- /dev/null +++ b/lit/ExecControl/StopHook/stop-hook.test @@ -0,0 +1,76 @@ +# RUN: %clang %p/Inputs/stop-hook.c -g -o %t +# Test setting stop-hook per-function +# RUN: %lldb -b -s %p/Inputs/stop-hook-1.lldbinit -s %s -f %t \ +# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FUNC %s +# Test setting stop-hook per-line range +# RUN: %lldb -b -s %p/Inputs/stop-hook-2.lldbinit -s %s -f %t | FileCheck %s +# Test setting stop-hook with multi-line expression +# RUN: %lldb -b -s %p/Inputs/stop-hook-3.lldbinit -s %s -f %t | FileCheck %s +# This test is not "unsupported" on Windows, but it fails because "expr ptr" +# does not evaluate correctly. However, the error message contains the expected +# string, so the test "passes" despite the fact that the commands failed +# llvm.org/pr40119 +# UNSUPPORTED: system-windows + +break set -f stop-hook.c -p "// Set breakpoint here to test target stop-hook" +break set -f stop-hook.c -p "// Another breakpoint which is outside of the stop-hook range" +target stop-hook list + +# CHECK: Hook: 1 +# CHECK-NEXT: State: enabled +# CHECK-NEXT: Specifier: +# CHECK-FUNC-NEXT: Function: b. +# CHECK-NEXT: Commands: +# CHECK-NEXT: expr ptr + +target stop-hook disable + +target stop-hook list +# CHECK: Hook: 1 +# CHECK-NEXT: State: disabled +# CHECK-NEXT: Specifier: +# CHECK-FUNC-NEXT: Function: b. +# CHECK-NEXT: Commands: +# CHECK-NEXT: expr ptr + +target stop-hook enable + +target stop-hook list +# CHECK: Hook: 1 +# CHECK-NEXT: State: enabled +# CHECK-NEXT: Specifier: +# CHECK-FUNC-NEXT: Function: b. +# CHECK-NEXT: Commands: +# CHECK-NEXT: expr ptr + +run +# Stopping inside of the stop hook range +# CHECK: (lldb) run +# CHECK-NEXT: (void *) $0 = 0x + +thread step-over +# Stepping inside of the stop hook range +# CHECK: (lldb) thread step-over +# CHECK-NEXT: (void *) $1 = 0x +# CHECK: ->{{.*}} // We should stop here after stepping. + +process continue +# Stopping outside of the stop hook range +# CHECK: (lldb) process continue +# CHECK-NOT: (void *) +# CHECK: ->{{.*}} // Another breakpoint which is outside of the stop-hook range. + +thread step-over +# Stepping inside of the stop hook range +# CHECK: (lldb) thread step-over +# CHECK-NOT: (void *) + +settings set auto-confirm true +target stop-hook delete + +target stop-hook list +# CHECK: (lldb) target stop-hook list +# CHECK-NOT: Hook: 1 +# CHECK: No stop hooks +# CHECK-NOT: Hook: 1 + diff --git a/lit/Expr/TestIRMemoryMap.test b/lit/Expr/TestIRMemoryMap.test index 23595945011d..0741c31af38b 100644 --- a/lit/Expr/TestIRMemoryMap.test +++ b/lit/Expr/TestIRMemoryMap.test @@ -1,6 +1,6 @@ -# XFAIL: windows +# UNSUPPORTED: windows -# RUN: %cxx %p/Inputs/call-function.cpp -g -o %t +# RUN: %clangxx %p/Inputs/call-function.cpp -g -o %t # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic diff --git a/lit/Expr/TestIRMemoryMapWindows.test b/lit/Expr/TestIRMemoryMapWindows.test new file mode 100644 index 000000000000..f25db591fa51 --- /dev/null +++ b/lit/Expr/TestIRMemoryMapWindows.test @@ -0,0 +1,13 @@ +# REQUIRES: system-windows + +# RUN: %clang_cl /Zi /GS- %p/Inputs/call-function.cpp /c /o %t.obj +# RUN: %msvc_link /debug:full %t.obj /out:%t + +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic + +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-overlap1 +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-overlap1 + +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-mix-malloc-free +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-mix-malloc-free diff --git a/lit/Expr/TestMultilineExpr.test b/lit/Expr/TestMultilineExpr.test new file mode 100644 index 000000000000..ae02407b5767 --- /dev/null +++ b/lit/Expr/TestMultilineExpr.test @@ -0,0 +1,9 @@ +# RUN: %lldb -b -s %s | FileCheck %s + +# In terminal sessions LLDB hides input from subsequent lines so it's not visible in the output we check below. +expression +2+ +3 + +# CHECK: (lldb) expression +# CHECK: (int) {{.*}} = 5 diff --git a/lit/Heap/Inputs/cstr.c b/lit/Heap/Inputs/cstr.c new file mode 100644 index 000000000000..2f9117b635e5 --- /dev/null +++ b/lit/Heap/Inputs/cstr.c @@ -0,0 +1,17 @@ +#include <stdlib.h> + +int main(void) { + char *str; + int size = 9; //strlen("patatino") + 1 + str = (char *)malloc(sizeof(char)*size); + *(str+0) = 'p'; + *(str+1) = 'a'; + *(str+2) = 't'; + *(str+3) = 'a'; + *(str+4) = 't'; + *(str+5) = 'i'; + *(str+6) = 'n'; + *(str+7) = 'o'; + *(str+8) = '\0'; + return 0; +} diff --git a/lit/Heap/heap-cstr.test b/lit/Heap/heap-cstr.test new file mode 100644 index 000000000000..00d19ffbe47f --- /dev/null +++ b/lit/Heap/heap-cstr.test @@ -0,0 +1,10 @@ +# REQUIRES: system-darwin +# RUN: %clang %p/Inputs/cstr.c -g -o %t +# RUN: %lldb -b -s %s -f %t | FileCheck %s + +br set -p return +command script import lldb.macosx.heap +run +cstr "patatino" + +# CHECK: {{.*}}: malloc( 16) -> {{.*}} diff --git a/lit/Minidump/Inputs/dump-content.dmp b/lit/Minidump/Inputs/dump-content.dmp Binary files differnew file mode 100644 index 000000000000..18eb59ffb7e6 --- /dev/null +++ b/lit/Minidump/Inputs/dump-content.dmp diff --git a/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.cpp b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.cpp new file mode 100644 index 000000000000..6bf78b5dc43b --- /dev/null +++ b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.cpp @@ -0,0 +1,40 @@ +
+// nodefaultlib build: cl -Zi sigsegv.cpp /link /nodefaultlib
+
+#ifdef USE_CRT
+#include <stdio.h>
+#else
+int main();
+extern "C"
+{
+ int _fltused;
+ void mainCRTStartup() { main(); }
+ void printf(const char*, ...) {}
+}
+#endif
+
+void crash(bool crash_self)
+{
+ printf("Before...\n");
+ if(crash_self)
+ {
+ printf("Crashing in 3, 2, 1 ...\n");
+ *(volatile int*)nullptr = 0;
+ }
+ printf("After...\n");
+}
+
+int foo(int x, float y, const char* msg)
+{
+ bool flag = x > y;
+ if(flag)
+ printf("x = %d, y = %f, msg = %s\n", x, y, msg);
+ crash(flag);
+ return x << 1;
+}
+
+int main()
+{
+ foo(10, 3.14, "testing");
+}
+
diff --git a/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.dmp b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.dmp Binary files differnew file mode 100644 index 000000000000..c918a6c64e55 --- /dev/null +++ b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.dmp diff --git a/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.lldbinit b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.lldbinit new file mode 100644 index 000000000000..dff1f1a295e4 --- /dev/null +++ b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.lldbinit @@ -0,0 +1,2 @@ +bt all +dis diff --git a/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.pdb b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.pdb Binary files differnew file mode 100644 index 000000000000..d60f9cffddac --- /dev/null +++ b/lit/Minidump/Windows/Sigsegv/Inputs/sigsegv.pdb diff --git a/lit/Minidump/Windows/Sigsegv/sigsegv.test b/lit/Minidump/Windows/Sigsegv/sigsegv.test new file mode 100644 index 000000000000..dfa98c566561 --- /dev/null +++ b/lit/Minidump/Windows/Sigsegv/sigsegv.test @@ -0,0 +1,13 @@ +// RUN: cd %p/Inputs +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 \ +// RUN: %lldb -c sigsegv.dmp -s sigsegv.lldbinit | FileCheck %s + +CHECK: * thread #1, stop reason = Exception 0xc0000005 encountered at address 0x7ff7a13110d9 +CHECK: * frame #0: 0x00007ff7a13110d9 sigsegv.exe + +CHECK: -> 0x7ff7a13110d9: movl $0x0, 0x0 +CHECK: 0x7ff7a13110e4: leaq 0x1f45(%rip), %rcx +CHECK: 0x7ff7a13110eb: callq 0x7ff7a1311019 +CHECK: 0x7ff7a13110f0: addq $0x28, %rsp +CHECK: 0x7ff7a13110f4: retq +CHECK: 0x7ff7a13110f5: int3 diff --git a/lit/Minidump/dump-all.test b/lit/Minidump/dump-all.test new file mode 100644 index 000000000000..9af319760456 --- /dev/null +++ b/lit/Minidump/dump-all.test @@ -0,0 +1,86 @@ +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --all' | \ +# RUN: FileCheck --check-prefix=CHECKDIR --check-prefix=CHECKCPU \ +# RUN: --check-prefix=CHECKSTATUS --check-prefix=CHECKLSB \ +# RUN: --check-prefix=CHECKCMD --check-prefix=CHECKENV \ +# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \ +# RUN: --check-prefix=CHECKSTAT --check-prefix=CHECKUP --check-prefix=CHECKFD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump -a' | \ +# RUN: FileCheck --check-prefix=CHECKDIR --check-prefix=CHECKCPU \ +# RUN: --check-prefix=CHECKSTATUS --check-prefix=CHECKLSB \ +# RUN: --check-prefix=CHECKCMD --check-prefix=CHECKENV \ +# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP \ +# RUN: --check-prefix=CHECKSTAT --check-prefix=CHECKUP --check-prefix=CHECKFD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --directory' | FileCheck --check-prefix=CHECKDIR %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --d' | FileCheck --check-prefix=CHECKDIR %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --linux' | \ +# RUN: FileCheck --check-prefix=CHECKCPU --check-prefix=CHECKSTATUS \ +# RUN: --check-prefix=CHECKLSB --check-prefix=CHECKCMD --check-prefix=CHECKENV \ +# RUN: --check-prefix=CHECKAUX --check-prefix=CHECKMAP --check-prefix=CHECKSTAT \ +# RUN: --check-prefix=CHECKUP --check-prefix=CHECKFD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cpuinfo' | FileCheck --check-prefix=CHECKCPU %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --C' | FileCheck --check-prefix=CHECKCPU %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --status' | FileCheck --check-prefix=CHECKSTATUS %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --s' | FileCheck --check-prefix=CHECKSTATUS %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --lsb-release' | FileCheck --check-prefix=CHECKLSB %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --r' | FileCheck --check-prefix=CHECKLSB %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --cmdline' | FileCheck --check-prefix=CHECKCMD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --c' | FileCheck --check-prefix=CHECKCMD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --environ' | FileCheck --check-prefix=CHECKENV %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --e' | FileCheck --check-prefix=CHECKENV %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --auxv' | FileCheck --check-prefix=CHECKAUX %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --x' | FileCheck --check-prefix=CHECKAUX %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --maps' | FileCheck --check-prefix=CHECKMAP %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --m' | FileCheck --check-prefix=CHECKMAP %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --stat' | FileCheck --check-prefix=CHECKSTAT %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --S' | FileCheck --check-prefix=CHECKSTAT %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --uptime' | FileCheck --check-prefix=CHECKUP %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --u' | FileCheck --check-prefix=CHECKUP %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --fd' | FileCheck --check-prefix=CHECKFD %s +# RUN: %lldb -c %p/Inputs/dump-content.dmp -o 'process plugin dump --f' | FileCheck --check-prefix=CHECKFD %s +# CHECKDIR: RVA SIZE TYPE MinidumpStreamType +# CHECKDIR-NEXT: ---------- ---------- ---------- -------------------------- +# CHECKDIR-NEXT: 0x000000b0 0x00000038 0x00000007 SystemInfo +# CHECKDIR-NEXT: 0x0000015d 0x0000001b 0x47670007 LinuxEnviron +# CHECKDIR-NEXT: 0x00000190 0x000000bc 0x47670009 LinuxMaps +# CHECKDIR-NEXT: 0x00000110 0x0000001a 0x47670004 LinuxProcStatus +# CHECKDIR-NEXT: 0x0000024c 0x00000018 0x4767000b LinuxProcStat +# CHECKDIR-NEXT: 0x00000142 0x0000001b 0x47670006 LinuxCMDLine +# CHECKDIR-NEXT: 0x00000272 0x00000016 0x4767000d LinuxProcFD +# CHECKDIR-NEXT: 0x00000178 0x00000018 0x47670008 LinuxAuxv +# CHECKDIR-NEXT: 0x000000e8 0x00000018 0x0000000f MiscInfo +# CHECKDIR-NEXT: 0x00000100 0x00000010 0x47670003 LinuxCPUInfo +# CHECKDIR-NEXT: 0x0000012a 0x00000018 0x47670005 LinuxLSBRelease +# CHECKDIR-NEXT: 0x00000264 0x0000000e 0x4767000c LinuxProcUptime + +# CHECKCPU: /proc/cpuinfo: +# CHECKCPU-NEXT: cpu info output + +# CHECKSTATUS: /proc/PID/status: +# CHECKSTATUS-NEXT: /proc/<pid>/status output + +# CHECKLSB: /etc/lsb-release: +# CHECKLSB-NEXT: /etc/lsb-release output + +# CHECKCMD: /proc/PID/cmdline: +# CHECKCMD-NEXT: /proc/<pid>/cmdline output + +# CHECKENV: /proc/PID/environ: +# CHECKENV-NEXT: /proc/<pid>/environ output + +# CHECKAUX: /proc/PID/auxv: +# CHECKAUX-NEXT: 0x00000000: 2f 70 72 6f 63 2f 3c 70 69 64 3e 2f 61 75 78 76 /proc/<pid>/auxv +# CHECKAUX-NEXT: 0x00000010: 20 6f 75 74 70 75 74 00 output. + +# CHECKMAP: /proc/PID/maps: +# CHECKMAP-NEXT: 400d9000-400db000 r-xp 00000000 b3:04 227 /system/bin/app_process +# CHECKMAP-NEXT: 400db000-400dc000 r--p 00001000 b3:04 227 /system/bin/app_process +# CHECKMAP-NEXT: 400dc000-400dd000 rw-p 00000000 00:00 0 + +# CHECKSTAT: /proc/PID/stat: +# CHECKSTAT-NEXT: /proc/<pid>/stat output + +# CHECKUP: uptime: +# CHECKUP-NEXT: uptime output + +# CHECKFD: /proc/PID/fd: +# CHECKFD-NEXT: /proc/<pid>/fd output diff --git a/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms b/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms new file mode 100644 index 000000000000..0241d512862c --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/bad-module-id-1.syms @@ -0,0 +1,2 @@ +MODULE Linux x86_64 E5894855+C35D+CCCCCCCCCCCCCCCCCCCC0 linux.out +PUBLIC 1000 0 _start diff --git a/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms b/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms new file mode 100644 index 000000000000..4ae10438f309 --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/bad-module-id-2.syms @@ -0,0 +1,2 @@ +MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCC linux.out +PUBLIC 1000 0 _start diff --git a/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms b/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms new file mode 100644 index 000000000000..2e6d72a37d58 --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/bad-module-id-3.syms @@ -0,0 +1,2 @@ +MODULE Linux x86_64 E58X4855C35DCCCCCCCCXCCCCCCCCCCC0 linux.out +PUBLIC 1000 0 _start diff --git a/lit/Modules/Breakpad/Inputs/discontiguous-sections.syms b/lit/Modules/Breakpad/Inputs/discontiguous-sections.syms new file mode 100644 index 000000000000..bf0a21bc6e09 --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/discontiguous-sections.syms @@ -0,0 +1,5 @@ +MODULE Linux x86_64 0000000024B5D199F0F766FFFFFF5DC30 linux.out +INFO CODE_ID 00000000B52499D1F0F766FFFFFF5DC3 +FILE 0 /tmp/a.c +PUBLIC 1010 0 _start +FILE 1 /tmp/b.c diff --git a/lit/Modules/Breakpad/Inputs/identification-linux.syms b/lit/Modules/Breakpad/Inputs/identification-linux.syms new file mode 100644 index 000000000000..d82e30c4a05d --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/identification-linux.syms @@ -0,0 +1,6 @@ +MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCCCCC0 linux.out +INFO CODE_ID 554889E55DC3CCCCCCCCCCCCCCCCCCCC +PUBLIC 1000 0 _start +STACK CFI INIT 1000 6 .cfa: $rsp 8 + .ra: .cfa -8 + ^ +STACK CFI 1001 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + +STACK CFI 1004 .cfa: $rbp 16 + diff --git a/lit/Modules/Breakpad/Inputs/identification-macosx.syms b/lit/Modules/Breakpad/Inputs/identification-macosx.syms new file mode 100644 index 000000000000..56e0635e5f69 --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/identification-macosx.syms @@ -0,0 +1,6 @@ +MODULE mac x86_64 D98C0E682089AA1BEACD6A8C1F16707B0 mac.out +PUBLIC 0 0 _mh_execute_header +PUBLIC f30 0 start +STACK CFI INIT f30 6 .cfa: $rsp 8 + .ra: .cfa -8 + ^ +STACK CFI f31 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + +STACK CFI f34 .cfa: $rbp 16 + diff --git a/lit/Modules/Breakpad/Inputs/identification-windows.syms b/lit/Modules/Breakpad/Inputs/identification-windows.syms new file mode 100644 index 000000000000..8fa5f305209b --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/identification-windows.syms @@ -0,0 +1,4 @@ +MODULE windows x86 A0C9165780B5490981A1925EA62165C01 a.pdb
+INFO CODE_ID 5C01672A4000 a.exe
+FILE 1 c:\tmp\a.cpp
+PUBLIC 1000 0 main
diff --git a/lit/Modules/Breakpad/Inputs/sections-trailing-func.syms b/lit/Modules/Breakpad/Inputs/sections-trailing-func.syms new file mode 100644 index 000000000000..6176d35143cd --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/sections-trailing-func.syms @@ -0,0 +1,8 @@ +MODULE Linux x86_64 0000000024B5D199F0F766FFFFFF5DC30 linux.out +INFO CODE_ID 00000000B52499D1F0F766FFFFFF5DC3 +FILE 0 /tmp/a.c +FUNC 1010 10 0 _start +1010 4 4 0 +1014 5 5 0 +1019 5 6 0 +101e 2 7 0 diff --git a/lit/Modules/Breakpad/Inputs/sections.syms b/lit/Modules/Breakpad/Inputs/sections.syms new file mode 100644 index 000000000000..121cca439b02 --- /dev/null +++ b/lit/Modules/Breakpad/Inputs/sections.syms @@ -0,0 +1,12 @@ +MODULE Linux x86_64 0000000024B5D199F0F766FFFFFF5DC30 linux.out +INFO CODE_ID 00000000B52499D1F0F766FFFFFF5DC3 +FILE 0 /tmp/a.c +FUNC 1010 10 0 _start +1010 4 4 0 +1014 5 5 0 +1019 5 6 0 +101e 2 7 0 +PUBLIC 1010 0 _start +STACK CFI INIT 1010 10 .cfa: $rsp 8 + .ra: .cfa -8 + ^ +STACK CFI 1011 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + +STACK CFI 1014 .cfa: $rbp 16 + diff --git a/lit/Modules/Breakpad/breakpad-identification.test b/lit/Modules/Breakpad/breakpad-identification.test new file mode 100644 index 000000000000..49758b59a1e5 --- /dev/null +++ b/lit/Modules/Breakpad/breakpad-identification.test @@ -0,0 +1,32 @@ +RUN: lldb-test object-file %p/Inputs/identification-linux.syms | FileCheck %s --check-prefix=LINUX +RUN: lldb-test object-file %p/Inputs/identification-macosx.syms | FileCheck %s --check-prefix=MAC +RUN: lldb-test object-file %p/Inputs/identification-windows.syms | FileCheck %s --check-prefix=WINDOWS +RUN: not lldb-test object-file %p/Inputs/bad-module-id-1.syms 2>&1 | FileCheck %s --check-prefix=ERROR +RUN: not lldb-test object-file %p/Inputs/bad-module-id-2.syms 2>&1 | FileCheck %s --check-prefix=ERROR +RUN: not lldb-test object-file %p/Inputs/bad-module-id-3.syms 2>&1 | FileCheck %s --check-prefix=ERROR + +LINUX: Plugin name: breakpad +LINUX: Architecture: x86_64--linux +LINUX: UUID: 554889E5-5DC3-CCCC-CCCC-CCCCCCCCCCCC +LINUX: Executable: false +LINUX: Stripped: false +LINUX: Type: debug info +LINUX: Strata: user + +MAC: Plugin name: breakpad +MAC: Architecture: x86_64--macosx +MAC: UUID: 680E8CD9-8920-1BAA-EACD-6A8C1F16707B +MAC: Executable: false +MAC: Stripped: false +MAC: Type: debug info +MAC: Strata: user + +WINDOWS: Plugin name: breakpad +WINDOWS: Architecture: i386--windows +WINDOWS: UUID: 5716C9A0-B580-0949-81A1-925EA62165C0-01000000 +WINDOWS: Executable: false +WINDOWS: Stripped: false +WINDOWS: Type: debug info +WINDOWS: Strata: user + +ERROR: not recognised as an object file diff --git a/lit/Modules/Breakpad/discontiguous-sections.test b/lit/Modules/Breakpad/discontiguous-sections.test new file mode 100644 index 000000000000..0c9aeea08d7e --- /dev/null +++ b/lit/Modules/Breakpad/discontiguous-sections.test @@ -0,0 +1,27 @@ +# Test handling discontiguous sections. +RUN: lldb-test object-file %p/Inputs/discontiguous-sections.syms -contents | FileCheck %s + +CHECK: Showing 5 sections + +CHECK: ID: 0x1 +CHECK-NEXT: Name: MODULE + +CHECK: ID: 0x2 +CHECK-NEXT: Name: INFO + +CHECK: ID: 0x3 +CHECK-NEXT: Name: FILE +CHECK: File size: 16 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 46494C45 2030202F 746D702F 612E630A |FILE 0 /tmp/a.c.| +CHECK-NEXT: ) + +CHECK: ID: 0x4 +CHECK-NEXT: Name: PUBLIC + +CHECK: ID: 0x5 +CHECK-NEXT: Name: FILE +CHECK: File size: 16 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 46494C45 2031202F 746D702F 622E630A |FILE 1 /tmp/b.c.| +CHECK-NEXT: ) diff --git a/lit/Breakpoint/lit.local.cfg b/lit/Modules/Breakpad/lit.local.cfg index df9b335dd131..df9b335dd131 100644 --- a/lit/Breakpoint/lit.local.cfg +++ b/lit/Modules/Breakpad/lit.local.cfg diff --git a/lit/Modules/Breakpad/sections-trailing-func.test b/lit/Modules/Breakpad/sections-trailing-func.test new file mode 100644 index 000000000000..9ea5c9da7810 --- /dev/null +++ b/lit/Modules/Breakpad/sections-trailing-func.test @@ -0,0 +1,15 @@ +# Test handling of a (valid) breakpad file, which ends with a line without a +# recognised keyword. + +RUN: lldb-test object-file %p/Inputs/sections-trailing-func.syms -contents | FileCheck %s + +CHECK: Showing 4 sections + +CHECK: ID: 0x4 +CHECK-NEXT: Name: FUNC +CHECK: File size: 66 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 46554E43 20313031 30203130 2030205F 73746172 740A3130 31302034 20342030 |FUNC 1010 10 0 _start.1010 4 4 0| +CHECK-NEXT: 0020: 0A313031 34203520 3520300A 31303139 20352036 20300A31 30316520 32203720 |.1014 5 5 0.1019 5 6 0.101e 2 7 | +CHECK-NEXT: 0040: 300A |0.| +CHECK-NEXT: ) diff --git a/lit/Modules/Breakpad/sections.test b/lit/Modules/Breakpad/sections.test new file mode 100644 index 000000000000..32ccf848db60 --- /dev/null +++ b/lit/Modules/Breakpad/sections.test @@ -0,0 +1,89 @@ +RUN: lldb-test object-file %p/Inputs/sections.syms -contents | FileCheck %s + +CHECK: Showing 6 sections + +CHECK: Index: 0 +CHECK-NEXT: ID: 0x1 +CHECK-NEXT: Name: MODULE +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 64 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 4D4F4455 4C45204C 696E7578 20783836 5F363420 30303030 30303030 32344235 |MODULE Linux x86_64 0000000024B5| +CHECK-NEXT: 0020: 44313939 46304637 36364646 46464646 35444333 30206C69 6E75782E 6F75740A |D199F0F766FFFFFF5DC30 linux.out.| +CHECK-NEXT: ) + +CHECK: Index: 1 +CHECK-NEXT: ID: 0x2 +CHECK-NEXT: Name: INFO +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 46 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 494E464F 20434F44 455F4944 20303030 30303030 30423532 34393944 31463046 |INFO CODE_ID 00000000B52499D1F0F| +CHECK-NEXT: 0020: 37363646 46464646 46354443 330A |766FFFFFF5DC3.| +CHECK-NEXT: ) + +CHECK: Index: 2 +CHECK-NEXT: ID: 0x3 +CHECK-NEXT: Name: FILE +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 16 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 46494C45 2030202F 746D702F 612E630A |FILE 0 /tmp/a.c.| +CHECK-NEXT: ) + +CHECK: Index: 3 +CHECK-NEXT: ID: 0x4 +CHECK-NEXT: Name: FUNC +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 66 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 46554E43 20313031 30203130 2030205F 73746172 740A3130 31302034 20342030 |FUNC 1010 10 0 _start.1010 4 4 0| +CHECK-NEXT: 0020: 0A313031 34203520 3520300A 31303139 20352036 20300A31 30316520 32203720 |.1014 5 5 0.1019 5 6 0.101e 2 7 | +CHECK-NEXT: 0040: 300A |0.| +CHECK-NEXT: ) + +CHECK: Index: 4 +CHECK-NEXT: ID: 0x5 +CHECK-NEXT: Name: PUBLIC +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 21 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 5055424C 49432031 30313020 30205F73 74617274 0A |PUBLIC 1010 0 _start.| +CHECK-NEXT: ) + +CHECK: Index: 5 +CHECK-NEXT: ID: 0x6 +CHECK-NEXT: Name: STACK +CHECK-NEXT: Type: regular +CHECK-NEXT: Permissions: --- +CHECK-NEXT: Thread specific: no +CHECK-NEXT: VM address: 0 +CHECK-NEXT: VM size: 0 +CHECK-NEXT: File size: 136 +CHECK-NEXT: Data: ( +CHECK-NEXT: 0000: 53544143 4B204346 4920494E 49542031 30313020 3130202E 6366613A 20247273 |STACK CFI INIT 1010 10 .cfa: $rs| +CHECK-NEXT: 0020: 70203820 2B202E72 613A202E 63666120 2D38202B 205E0A53 5441434B 20434649 |p 8 + .ra: .cfa -8 + ^.STACK CFI| +CHECK-NEXT: 0040: 20313031 31202472 62703A20 2E636661 202D3136 202B205E 202E6366 613A2024 | 1011 $rbp: .cfa -16 + ^ .cfa: $| +CHECK-NEXT: 0060: 72737020 3136202B 0A535441 434B2043 46492031 30313420 2E636661 3A202472 |rsp 16 +.STACK CFI 1014 .cfa: $r| +CHECK-NEXT: 0080: 62702031 36202B0A |bp 16 +.| +CHECK-NEXT: ) diff --git a/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf b/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf Binary files differnew file mode 100644 index 000000000000..d5fd2d1fa91d --- /dev/null +++ b/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf diff --git a/lit/Modules/ELF/PT_LOAD-empty.yaml b/lit/Modules/ELF/PT_LOAD-empty.yaml new file mode 100644 index 000000000000..9f1cb0745723 --- /dev/null +++ b/lit/Modules/ELF/PT_LOAD-empty.yaml @@ -0,0 +1,26 @@ +# Test behavior on unusual (and probably corrupt) files. Test that we drop an +# empty PT_LOAD segment. + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s +# +# CHECK-NOT: container + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0x1000 + Align: 0x4 diff --git a/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml b/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml new file mode 100644 index 000000000000..e97afe9070ce --- /dev/null +++ b/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml @@ -0,0 +1,50 @@ +# Test that an overlapping PT_INTERP segment does not cause us to drop the +# subsequent PT_LOAD segment. + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Index: 0 +# CHECK-NEXT: ID: 0xfffffffffffffffe +# CHECK-NEXT: Name: PT_LOAD[0] +# CHECK-NEXT: Type: container +# CHECK-NEXT: Permissions: rwx +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1000 +# CHECK-NEXT: VM size: 12 +# CHECK-NEXT: File size: 12 +# CHECK-NEXT: Showing 2 subsections + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .interp + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1000 + AddressAlign: 0x4 + Content: 3232 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1004 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D +ProgramHeaders: + - Type: PT_INTERP + Flags: [ PF_R ] + VAddr: 0x1000 + Align: 0x4 + Sections: + - Section: .interp + - Type: PT_LOAD + Flags: [ PF_X, PF_W, PF_R ] + VAddr: 0x1000 + Align: 0x4 + Sections: + - Section: .interp + - Section: .text diff --git a/lit/Modules/ELF/PT_LOAD-overlap-section.yaml b/lit/Modules/ELF/PT_LOAD-overlap-section.yaml new file mode 100644 index 000000000000..3b7bde802ce0 --- /dev/null +++ b/lit/Modules/ELF/PT_LOAD-overlap-section.yaml @@ -0,0 +1,66 @@ +# Test behavior on strange (invalid?) elf files where the sections cross segment +# boundary. The test input was generated from this yaml file, but the program +# header was modified by hand, so this input is here for reference only. +# +# Right now lldb shortens sections to make sure every section is fully contained +# within a segment, but other behaviors are possible too (including outright +# rejecting such files). + +# RUN: lldb-test object-file %S/Inputs/PT_LOAD-overlap-section.elf | FileCheck %s + +# CHECK: Index: 0 +# CHECK-NEXT: ID: 0xffffffffffffffff +# CHECK-NEXT: Name: PT_LOAD[0] +# CHECK-NEXT: Type: container +# CHECK-NEXT: Permissions: rwx +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1006 +# CHECK-NEXT: VM size: 8 +# CHECK-NEXT: File size: 8 +# CHECK-NEXT: Showing 1 subsections +# CHECK-NEXT: Index: 0 +# CHECK-NEXT: ID: 0x2 +# CHECK-NEXT: Name: .text +# CHECK-NEXT: Type: code +# CHECK-NEXT: Permissions: r-x +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1008 +# CHECK-NEXT: VM size: 6 +# CHECK-NEXT: File size: 8 + +# CHECK: Index: 1 +# CHECK-NEXT: ID: 0x1 +# CHECK-NEXT: Name: .interp +# CHECK-NEXT: Type: regular +# CHECK-NEXT: Permissions: r-- +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1000 +# CHECK-NEXT: VM size: 6 +# CHECK-NEXT: File size: 8 + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .interp + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1008 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_W, PF_R ] + VAddr: 0x1008 # Modified by hand to start at 0x1006 + Align: 0x4 + Sections: + - Section: .text diff --git a/lit/Modules/ELF/PT_LOAD-overlap.yaml b/lit/Modules/ELF/PT_LOAD-overlap.yaml new file mode 100644 index 000000000000..1315f54e6c02 --- /dev/null +++ b/lit/Modules/ELF/PT_LOAD-overlap.yaml @@ -0,0 +1,42 @@ +# Test behavior on unusual (and probably corrupt) object files. Check that we +# drop the second PT_LOAD segment which overlaps with the first one. + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Type: container +# CHECK-NOT: Type: container + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1008 + AddressAlign: 0x4 + Content: 3232 +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_W, PF_R ] + VAddr: 0x1000 + Align: 0x4 + Sections: + - Section: .text + - Section: .data + - Type: PT_LOAD + Flags: [ PF_R, PF_W ] + VAddr: 0x1008 + Align: 0x4 + Sections: + - Section: .data diff --git a/lit/Modules/ELF/PT_LOAD.yaml b/lit/Modules/ELF/PT_LOAD.yaml new file mode 100644 index 000000000000..d673a69c8cd8 --- /dev/null +++ b/lit/Modules/ELF/PT_LOAD.yaml @@ -0,0 +1,79 @@ +# Test that sections are made child-sections of the PT_LOAD segments/sections. + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Index: 0 +# CHECK-NEXT: ID: 0xffffffffffffffff +# CHECK-NEXT: Name: PT_LOAD[0] +# CHECK-NEXT: Type: container +# CHECK-NEXT: Permissions: rwx +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1000 +# CHECK-NEXT: VM size: 10 +# CHECK-NEXT: File size: 10 +# CHECK-NEXT: Showing 2 subsections +# CHECK-NEXT: Index: 0 +# CHECK-NEXT: ID: 0x1 +# CHECK-NEXT: Name: .text +# CHECK-NEXT: Type: code +# CHECK-NEXT: Permissions: r-x +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1000 +# CHECK-NEXT: VM size: 8 +# CHECK-NEXT: File size: 8 +# CHECK-EMPTY: +# CHECK-NEXT: Index: 1 +# CHECK-NEXT: ID: 0x2 +# CHECK-NEXT: Name: .data +# CHECK-NEXT: Type: data +# CHECK-NEXT: Permissions: r-- +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x1008 +# CHECK-NEXT: VM size: 2 +# CHECK-NEXT: File size: 2 +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-NEXT: Index: 1 +# CHECK-NEXT: ID: 0x3 +# CHECK-NEXT: Name: .data_outside +# CHECK-NEXT: Type: regular +# CHECK-NEXT: Permissions: r-- +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x2000 +# CHECK-NEXT: VM size: 2 +# CHECK-NEXT: File size: 2 + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1008 + AddressAlign: 0x4 + Content: 3232 + - Name: .data_outside + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x2000 + AddressAlign: 0x4 + Content: 3232 +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_W, PF_R ] + VAddr: 0x1000 + Align: 0x4 + Sections: + - Section: .text + - Section: .data diff --git a/lit/Modules/ELF/base-address.yaml b/lit/Modules/ELF/base-address.yaml new file mode 100644 index 000000000000..68f117708351 --- /dev/null +++ b/lit/Modules/ELF/base-address.yaml @@ -0,0 +1,34 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Base VM address: 0x400000 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400078 +Sections: + - Name: .pad + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x0000000000400000 + AddressAlign: 0x0000000000001000 + Size: 0x78 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400078 + AddressAlign: 0x0000000000000001 + Content: 48C7C0E700000048C7C72F0000000F05CC +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0x400000 + Align: 0x200000 + Sections: + - Section: .pad + - Section: .text +... diff --git a/lit/Modules/ELF/basic-info.yaml b/lit/Modules/ELF/basic-info.yaml new file mode 100644 index 000000000000..0e1db67e9d5f --- /dev/null +++ b/lit/Modules/ELF/basic-info.yaml @@ -0,0 +1,27 @@ +# REQUIRES: lld + +# RUN: yaml2obj %s > %t.o +# RUN: ld.lld %t.o -o %t -image-base 0x47000 +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Plugin name: elf +# CHECK: Architecture: x86_64-- +# CHECK: Executable: true +# CHECK: Stripped: false +# CHECK: Type: executable +# CHECK: Strata: user +# CHECK: Base VM address: 0x47000 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x0000000000000010 + Content: 554889E55DC3 +... diff --git a/lit/Modules/build-id-case.yaml b/lit/Modules/ELF/build-id-case.yaml index 246163ad52af..843bc40fb791 100644 --- a/lit/Modules/build-id-case.yaml +++ b/lit/Modules/ELF/build-id-case.yaml @@ -6,8 +6,6 @@ # CHECK: Name: .debug_frame # CHECK-NEXT: Type: dwarf-frame -# CHECK-NEXT: VM size: 0 -# CHECK-NEXT: File size: 8 --- !ELF FileHeader: diff --git a/lit/Modules/compressed-sections.yaml b/lit/Modules/ELF/compressed-sections.yaml index c75dc857522a..df070a2d53d6 100644 --- a/lit/Modules/compressed-sections.yaml +++ b/lit/Modules/ELF/compressed-sections.yaml @@ -19,6 +19,7 @@ Sections: # CHECK: Name: .hello_elf # CHECK-NEXT: Type: regular +# CHECK: VM address: 0 # CHECK-NEXT: VM size: 0 # CHECK-NEXT: File size: 28 # CHECK-NEXT: Data: @@ -26,7 +27,7 @@ Sections: # CHECK: Name: .bogus # CHECK-NEXT: Type: regular +# CHECK: VM address: 0 # CHECK-NEXT: VM size: 0 # CHECK-NEXT: File size: 8 -# CHECK-NEXT: Data: -# CHECK-NEXT: DEADBEEF BAADF00D +# CHECK-NEXT: Data: () diff --git a/lit/Modules/elf-duplicate-section.yaml b/lit/Modules/ELF/duplicate-section.yaml index b4b391cc912d..b4b391cc912d 100644 --- a/lit/Modules/elf-duplicate-section.yaml +++ b/lit/Modules/ELF/duplicate-section.yaml diff --git a/lit/Modules/elf-many-sections.s b/lit/Modules/ELF/many-sections.s index a5e4aee18821..15d7e8fc1589 100644 --- a/lit/Modules/elf-many-sections.s +++ b/lit/Modules/ELF/many-sections.s @@ -7,7 +7,7 @@ ## aaaaaaaa..dddddddd, plus a couple of standard ones (.strtab, etc.) ## Check the number is correct plus the names of a couple of chosen sections. -# CHECK: Showing 65541 sections +# CHECK: Showing 65540 sections # CHECK: Name: aaaaaaaa # CHECK: Name: bbbbbbbb # CHECK: Name: cccccccc diff --git a/lit/Modules/ELF/section-addresses.yaml b/lit/Modules/ELF/section-addresses.yaml new file mode 100644 index 000000000000..012abbf1f6d3 --- /dev/null +++ b/lit/Modules/ELF/section-addresses.yaml @@ -0,0 +1,58 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK-LABEL: Name: .one +# CHECK: VM address: 0x0 + +# CHECK-LABEL: Name: .nonalloc +# CHECK: VM address: 0x0 + +# CHECK-LABEL: Name: .two +# CHECK: VM address: 0x8 + +# CHECK-LABEL: Name: .three +# CHECK: VM address: 0xc + +# CHECK-LABEL: Name: .four +# CHECK: VM address: 0xc + +# CHECK-LABEL: Name: .five +# CHECK: VM address: 0x1000 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 + Entry: 0x00000000000007A0 +Sections: + - Name: .one + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D + - Name: .nonalloc + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D + - Name: .two + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: DE + - Name: .three + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + - Name: .four + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D + - Name: .five + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000001000 + Content: DEADBEEFBAADF00D +... diff --git a/lit/Modules/ELF/section-overlap.yaml b/lit/Modules/ELF/section-overlap.yaml new file mode 100644 index 000000000000..bfbd873be41b --- /dev/null +++ b/lit/Modules/ELF/section-overlap.yaml @@ -0,0 +1,51 @@ +# Test handling of (corrupt?) object files, which have sections with overlapping +# virtual addresses. +# +# Right now the overlapping sections get dropped, but other behaviors +# (including outright rejecting such files) are possible too. + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK-NOT: .overlap1 +# CHECK-NOT: .overlap2 + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_ARM +Sections: + - Name: .sect1 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .overlap1 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x1004 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .sect2 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x2000 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D + - Name: .overlap2 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x2004 + AddressAlign: 0x4 + Content: DEADBEEFBAADF00D +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_W, PF_R ] + VAddr: 0x1000 + Align: 0x4 + Sections: + - Section: .sect1 + - Section: .overlap1 diff --git a/lit/Modules/ELF/section-permissions.yaml b/lit/Modules/ELF/section-permissions.yaml new file mode 100644 index 000000000000..99c2773c81b3 --- /dev/null +++ b/lit/Modules/ELF/section-permissions.yaml @@ -0,0 +1,34 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK-LABEL: Name: .r-x +# CHECK: Permissions: r-x +# +# CHECK-LABEL: Name: .rw- +# CHECK: Permissions: rw- + +# CHECK-LABEL: Name: .--- +# CHECK: Permissions: --- + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 + Entry: 0x00000000000007A0 +Sections: + - Name: .r-x + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: DEADBEEFBAADF00D + - Name: .rw- + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D + - Name: .--- + Type: SHT_PROGBITS + AddressAlign: 0x0000000000000001 + Content: DEADBEEFBAADF00D +... diff --git a/lit/Modules/ELF/section-types-edgecases.yaml b/lit/Modules/ELF/section-types-edgecases.yaml new file mode 100644 index 000000000000..ad1fa2d9097b --- /dev/null +++ b/lit/Modules/ELF/section-types-edgecases.yaml @@ -0,0 +1,35 @@ +# This test doesn't attempt to mandate a specific section classification. It is +# here to document the existing behavior and to make sure we don't do something +# completely crazy (like crashing). + +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# The section is called .data, but it has the SHF_EXECINSTR flag set. Have +# the flag take precedence over the name. +# CHECK-LABEL: Name: .data +# CHECK-NEXT: Type: code + +# Section type (SHT_SYMTAB) takes precedence over name-based deduction. +# CHECK-LABEL: Name: .text +# CHECK-NEXT: Type: elf-symbol-table + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 + Entry: 0x00000000000007A0 +Sections: + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_EXECINSTR, SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D + - Name: .text + Type: SHT_SYMTAB + Flags: [ ] + AddressAlign: 0x0000000000000004 + Content: DEADBEEFBAADF00D +... diff --git a/lit/Modules/elf-section-types.yaml b/lit/Modules/ELF/section-types.yaml index 64906a9acf8b..907d57b10cfe 100644 --- a/lit/Modules/elf-section-types.yaml +++ b/lit/Modules/ELF/section-types.yaml @@ -1,37 +1,41 @@ # RUN: yaml2obj %s > %t # RUN: lldb-test object-file %t | FileCheck %s -# CHECK: Name: .text +# CHECK-LABEL: Name: .text # CHECK-NEXT: Type: code -# CHECK: Name: .debug_info +# CHECK-LABEL: Name: .debug_info # CHECK-NEXT: Type: dwarf-info -# CHECK-NEXT: VM size: 0 -# CHECK-NEXT: File size: 8 -# CHECK: Name: .debug_types +# CHECK-LABEL: Name: .debug_types # CHECK-NEXT: Type: dwarf-types -# CHECK-NEXT: VM size: 0 -# CHECK-NEXT: File size: 8 -# CHECK: Name: .debug_names +# CHECK-LABEL: Name: .debug_names # CHECK-NEXT: Type: dwarf-names -# CHECK-NEXT: VM size: 0 -# CHECK-NEXT: File size: 8 -# CHECK: Name: .gnu_debugaltlink +# CHECK-LABEL: Name: .gnu_debugaltlink # CHECK-NEXT: Type: dwarf-gnu-debugaltlink -# CHECK-NEXT: VM size: 0 -# CHECK-NEXT: File size: 8 -# CHECK: Name: __codesection +# CHECK-LABEL: Name: __codesection # CHECK-NEXT: Type: code +# CHECK-LABEL: Name: .data +# CHECK-NEXT: Type: data +# CHECK: Thread specific: no + +# CHECK-LABEL: Name: .tdata +# CHECK-NEXT: Type: data +# CHECK: Thread specific: yes + +# CHECK-LABEL: Name: .tbss +# CHECK-NEXT: Type: zero-fill +# CHECK: Thread specific: yes + --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB - Type: ET_DYN + Type: ET_REL Machine: EM_X86_64 Entry: 0x00000000000007A0 Sections: @@ -59,4 +63,19 @@ Sections: Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] Content: DEADBEEFBAADF00D + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + AddressAlign: 0x0000000000000004 + Content: 2F000000 + - Name: .tdata + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] + AddressAlign: 0x0000000000000004 + Content: 2F000000 + - Name: .tbss + Type: SHT_NOBITS + Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] + AddressAlign: 0x0000000000000004 + Size: 0x0000000000000004 ... diff --git a/lit/Modules/short-build-id.yaml b/lit/Modules/ELF/short-build-id.yaml index 907813473920..907813473920 100644 --- a/lit/Modules/short-build-id.yaml +++ b/lit/Modules/ELF/short-build-id.yaml diff --git a/lit/Modules/MachO/lc_build_version.yaml b/lit/Modules/MachO/lc_build_version.yaml new file mode 100644 index 000000000000..4479662627ff --- /dev/null +++ b/lit/Modules/MachO/lc_build_version.yaml @@ -0,0 +1,209 @@ +# RUN: yaml2obj %s > %t.out +# RUN: lldb-test symbols %t.out | FileCheck %s +# Test that the deployment target is parsed from the load commands. +# CHECK: x86_64-apple-macosx10.14.0 +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x01000007 + cpusubtype: 0x80000003 + filetype: 0x00000002 + ncmds: 14 + sizeofcmds: 744 + flags: 0x00200085 + reserved: 0x00000000 +LoadCommands: + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __PAGEZERO + vmaddr: 0 + vmsize: 4294967296 + fileoff: 0 + filesize: 0 + maxprot: 0 + initprot: 0 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 232 + segname: __TEXT + vmaddr: 4294967296 + vmsize: 4096 + fileoff: 0 + filesize: 4096 + maxprot: 7 + initprot: 5 + nsects: 2 + flags: 0 + Sections: + - sectname: __text + segname: __TEXT + addr: 0x0000000100000FB0 + size: 8 + offset: 0x00000FB0 + align: 4 + reloff: 0x00000000 + nreloc: 0 + flags: 0x80000400 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - sectname: __unwind_info + segname: __TEXT + addr: 0x0000000100000FB8 + size: 72 + offset: 0x00000FB8 + align: 2 + reloff: 0x00000000 + nreloc: 0 + flags: 0x00000000 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __LINKEDIT + vmaddr: 4294971392 + vmsize: 4096 + fileoff: 4096 + filesize: 152 + maxprot: 7 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_DYLD_INFO_ONLY + cmdsize: 48 + rebase_off: 0 + rebase_size: 0 + bind_off: 0 + bind_size: 0 + weak_bind_off: 0 + weak_bind_size: 0 + lazy_bind_off: 0 + lazy_bind_size: 0 + export_off: 4096 + export_size: 48 + - cmd: LC_SYMTAB + cmdsize: 24 + symoff: 4152 + nsyms: 3 + stroff: 4200 + strsize: 48 + - cmd: LC_DYSYMTAB + cmdsize: 80 + ilocalsym: 0 + nlocalsym: 0 + iextdefsym: 0 + nextdefsym: 2 + iundefsym: 2 + nundefsym: 1 + tocoff: 0 + ntoc: 0 + modtaboff: 0 + nmodtab: 0 + extrefsymoff: 0 + nextrefsyms: 0 + indirectsymoff: 0 + nindirectsyms: 0 + extreloff: 0 + nextrel: 0 + locreloff: 0 + nlocrel: 0 + - cmd: LC_LOAD_DYLINKER + cmdsize: 32 + name: 12 + PayloadString: /usr/lib/dyld + ZeroPadBytes: 7 + - cmd: LC_UUID + cmdsize: 24 + uuid: 8F41E140-23B9-3720-AC28-4E7AF9D159BA + - cmd: LC_BUILD_VERSION + cmdsize: 32 + platform: 1 + minos: 658944 + sdk: 658944 + ntools: 1 + Tools: + - tool: 3 + version: 26738944 + - cmd: LC_SOURCE_VERSION + cmdsize: 16 + version: 0 + - cmd: LC_MAIN + cmdsize: 24 + entryoff: 4016 + stacksize: 0 + - cmd: LC_LOAD_DYLIB + cmdsize: 56 + dylib: + name: 24 + timestamp: 2 + current_version: 82102276 + compatibility_version: 65536 + PayloadString: /usr/lib/libSystem.B.dylib + ZeroPadBytes: 6 + - cmd: LC_FUNCTION_STARTS + cmdsize: 16 + dataoff: 4144 + datasize: 8 + - cmd: LC_DATA_IN_CODE + cmdsize: 16 + dataoff: 4152 + datasize: 0 +LinkEditData: + ExportTrie: + TerminalSize: 0 + NodeOffset: 0 + Name: '' + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 0 + NodeOffset: 5 + Name: _ + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 2 + NodeOffset: 33 + Name: _mh_execute_header + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + - TerminalSize: 3 + NodeOffset: 37 + Name: main + Flags: 0x0000000000000000 + Address: 0x0000000000000FB0 + Other: 0x0000000000000000 + ImportName: '' + NameList: + - n_strx: 2 + n_type: 0x0F + n_sect: 1 + n_desc: 16 + n_value: 4294967296 + - n_strx: 22 + n_type: 0x0F + n_sect: 1 + n_desc: 0 + n_value: 4294971312 + - n_strx: 28 + n_type: 0x01 + n_sect: 0 + n_desc: 256 + n_value: 0 + StringTable: + - ' ' + - __mh_execute_header + - _main + - dyld_stub_binder + - '' + - '' + - '' +... diff --git a/lit/Modules/MachO/lc_build_version_notools.yaml b/lit/Modules/MachO/lc_build_version_notools.yaml new file mode 100644 index 000000000000..f84c71aff6aa --- /dev/null +++ b/lit/Modules/MachO/lc_build_version_notools.yaml @@ -0,0 +1,206 @@ +# RUN: yaml2obj %s > %t.out +# RUN: lldb-test symbols %t.out | FileCheck %s +# Test that the deployment target is parsed from the load commands. +# CHECK: x86_64-apple-macosx10.14.0 +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x01000007 + cpusubtype: 0x80000003 + filetype: 0x00000002 + ncmds: 14 + sizeofcmds: 738 + flags: 0x00200085 + reserved: 0x00000000 +LoadCommands: + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __PAGEZERO + vmaddr: 0 + vmsize: 4294967296 + fileoff: 0 + filesize: 0 + maxprot: 0 + initprot: 0 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 232 + segname: __TEXT + vmaddr: 4294967296 + vmsize: 4096 + fileoff: 0 + filesize: 4096 + maxprot: 7 + initprot: 5 + nsects: 2 + flags: 0 + Sections: + - sectname: __text + segname: __TEXT + addr: 0x0000000100000FB0 + size: 8 + offset: 0x00000FB0 + align: 4 + reloff: 0x00000000 + nreloc: 0 + flags: 0x80000400 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - sectname: __unwind_info + segname: __TEXT + addr: 0x0000000100000FB8 + size: 72 + offset: 0x00000FB8 + align: 2 + reloff: 0x00000000 + nreloc: 0 + flags: 0x00000000 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __LINKEDIT + vmaddr: 4294971392 + vmsize: 4096 + fileoff: 4096 + filesize: 152 + maxprot: 7 + initprot: 1 + nsects: 0 + flags: 0 + - cmd: LC_DYLD_INFO_ONLY + cmdsize: 48 + rebase_off: 0 + rebase_size: 0 + bind_off: 0 + bind_size: 0 + weak_bind_off: 0 + weak_bind_size: 0 + lazy_bind_off: 0 + lazy_bind_size: 0 + export_off: 4096 + export_size: 48 + - cmd: LC_SYMTAB + cmdsize: 24 + symoff: 4152 + nsyms: 3 + stroff: 4200 + strsize: 48 + - cmd: LC_DYSYMTAB + cmdsize: 80 + ilocalsym: 0 + nlocalsym: 0 + iextdefsym: 0 + nextdefsym: 2 + iundefsym: 2 + nundefsym: 1 + tocoff: 0 + ntoc: 0 + modtaboff: 0 + nmodtab: 0 + extrefsymoff: 0 + nextrefsyms: 0 + indirectsymoff: 0 + nindirectsyms: 0 + extreloff: 0 + nextrel: 0 + locreloff: 0 + nlocrel: 0 + - cmd: LC_LOAD_DYLINKER + cmdsize: 32 + name: 12 + PayloadString: /usr/lib/dyld + ZeroPadBytes: 7 + - cmd: LC_UUID + cmdsize: 24 + uuid: 8F41E140-23B9-3720-AC28-4E7AF9D159BA + - cmd: LC_BUILD_VERSION + cmdsize: 24 + platform: 1 + minos: 658944 + sdk: 658944 + ntools: 0 + - cmd: LC_SOURCE_VERSION + cmdsize: 16 + version: 0 + - cmd: LC_MAIN + cmdsize: 24 + entryoff: 4016 + stacksize: 0 + - cmd: LC_LOAD_DYLIB + cmdsize: 56 + dylib: + name: 24 + timestamp: 2 + current_version: 82102276 + compatibility_version: 65536 + PayloadString: /usr/lib/libSystem.B.dylib + ZeroPadBytes: 6 + - cmd: LC_FUNCTION_STARTS + cmdsize: 16 + dataoff: 4144 + datasize: 8 + - cmd: LC_DATA_IN_CODE + cmdsize: 16 + dataoff: 4152 + datasize: 0 +LinkEditData: + ExportTrie: + TerminalSize: 0 + NodeOffset: 0 + Name: '' + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 0 + NodeOffset: 5 + Name: _ + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + Children: + - TerminalSize: 2 + NodeOffset: 33 + Name: _mh_execute_header + Flags: 0x0000000000000000 + Address: 0x0000000000000000 + Other: 0x0000000000000000 + ImportName: '' + - TerminalSize: 3 + NodeOffset: 37 + Name: main + Flags: 0x0000000000000000 + Address: 0x0000000000000FB0 + Other: 0x0000000000000000 + ImportName: '' + NameList: + - n_strx: 2 + n_type: 0x0F + n_sect: 1 + n_desc: 16 + n_value: 4294967296 + - n_strx: 22 + n_type: 0x0F + n_sect: 1 + n_desc: 0 + n_value: 4294971312 + - n_strx: 28 + n_type: 0x01 + n_sect: 0 + n_desc: 256 + n_value: 0 + StringTable: + - ' ' + - __mh_execute_header + - _main + - dyld_stub_binder + - '' + - '' + - '' +... diff --git a/lit/Modules/lc_version_min.yaml b/lit/Modules/MachO/lc_version_min.yaml index e79107069f33..e79107069f33 100644 --- a/lit/Modules/lc_version_min.yaml +++ b/lit/Modules/MachO/lc_version_min.yaml diff --git a/lit/Modules/MachO/subsections.yaml b/lit/Modules/MachO/subsections.yaml new file mode 100644 index 000000000000..a92ef41d79fc --- /dev/null +++ b/lit/Modules/MachO/subsections.yaml @@ -0,0 +1,126 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +#CHECK: Showing 2 sections +#CHECK-NEXT: Index: 0 +#CHECK-NEXT: ID: 0x100 +#CHECK-NEXT: Name: __PAGEZERO +#CHECK-NEXT: Type: container +#CHECK-NEXT: Permissions: --- +#CHECK-NEXT: Thread specific: no +#CHECK-NEXT: VM address: 0x0 +#CHECK-NEXT: VM size: 4294967296 +#CHECK-NEXT: File size: 0 +#CHECK-NEXT: There are no subsections +#CHECK-EMPTY: +#CHECK-NEXT: Index: 1 +#CHECK-NEXT: ID: 0x200 +#CHECK-NEXT: Name: __TEXT +#CHECK-NEXT: Type: container +#CHECK-NEXT: Permissions: r-x +#CHECK-NEXT: Thread specific: no +#CHECK-NEXT: VM address: 0x100000000 +#CHECK-NEXT: VM size: 4096 +#CHECK-NEXT: File size: 4096 +#CHECK-NEXT: Showing 3 subsections +#CHECK-NEXT: Index: 0 +#CHECK-NEXT: ID: 0x1 +#CHECK-NEXT: Name: __text +#CHECK-NEXT: Type: code +#CHECK-NEXT: Permissions: r-x +#CHECK-NEXT: Thread specific: no +#CHECK-NEXT: VM address: 0x100000f30 +#CHECK-NEXT: VM size: 22 +#CHECK-NEXT: File size: 22 +#CHECK-EMPTY: +#CHECK-NEXT: Index: 1 +#CHECK-NEXT: ID: 0x2 +#CHECK-NEXT: Name: __unwind_info +#CHECK-NEXT: Type: compact-unwind +#CHECK-NEXT: Permissions: r-x +#CHECK-NEXT: Thread specific: no +#CHECK-NEXT: VM address: 0x100000f48 +#CHECK-NEXT: VM size: 76 +#CHECK-NEXT: File size: 76 +#CHECK-EMPTY: +#CHECK-NEXT: Index: 2 +#CHECK-NEXT: ID: 0x3 +#CHECK-NEXT: Name: __eh_frame +#CHECK-NEXT: Type: eh-frame +#CHECK-NEXT: Permissions: r-x +#CHECK-NEXT: Thread specific: no +#CHECK-NEXT: VM address: 0x100000f98 +#CHECK-NEXT: VM size: 104 +#CHECK-NEXT: File size: 104 + +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x01000007 + cpusubtype: 0x00000003 + filetype: 0x00000002 + ncmds: 12 + sizeofcmds: 728 + flags: 0x00000085 + reserved: 0x00000000 +LoadCommands: + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __PAGEZERO + vmaddr: 0 + vmsize: 4294967296 + fileoff: 0 + filesize: 0 + maxprot: 0 + initprot: 0 + nsects: 0 + flags: 0 + - cmd: LC_SEGMENT_64 + cmdsize: 312 + segname: __TEXT + vmaddr: 4294967296 + vmsize: 4096 + fileoff: 0 + filesize: 4096 + maxprot: 7 + initprot: 5 + nsects: 3 + flags: 0 + Sections: + - sectname: __text + segname: __TEXT + addr: 0x0000000100000F30 + size: 22 + offset: 0x00000F30 + align: 4 + reloff: 0x00000000 + nreloc: 0 + flags: 0x80000400 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - sectname: __unwind_info + segname: __TEXT + addr: 0x0000000100000F48 + size: 76 + offset: 0x00000F48 + align: 2 + reloff: 0x00000000 + nreloc: 0 + flags: 0x00000000 + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 + - sectname: __eh_frame + segname: __TEXT + addr: 0x0000000100000F98 + size: 104 + offset: 0x00000F98 + align: 3 + reloff: 0x00000000 + nreloc: 0 + flags: 0x0000000B + reserved1: 0x00000000 + reserved2: 0x00000000 + reserved3: 0x00000000 +... diff --git a/lit/Modules/PECOFF/dep-modules.yaml b/lit/Modules/PECOFF/dep-modules.yaml new file mode 100644 index 000000000000..75a27e895234 --- /dev/null +++ b/lit/Modules/PECOFF/dep-modules.yaml @@ -0,0 +1,170 @@ +# REQUIRES: system-windows +# RUN: yaml2obj < %p/export-dllfunc.yaml > %t.export-dllfunc.obj +# RUN: yaml2obj < %s > %t.obj +# +# RUN: lld-link /machine:x64 /out:%t.export-dllfunc.dll /noentry /nodefaultlib /dll %t.export-dllfunc.obj /export:DllFunc +# RUN: lld-link /out:%t.exe %t.obj %t.export-dllfunc.lib /nodefaultlib /entry:main /include:DllFunc +# +# RUN: lldb-test object-file -dep-modules %t.exe | FileCheck -check-prefix=DEPS %s + + +# DEPS: Showing 1 dependent module(s) + +# Ignore checking the directory and any tentative string in the path. +# DEPS: Name: {{.*}}dep-modules.yaml.{{.*}}export-dllfunc.dll + + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 4883EC48C7442444000000004889542438894C2434B904000000E80000000089442430B908000000E8000000008944242C8B4424300344242C4883C448C3 + Relocations: + - VirtualAddress: 27 + SymbolName: 'DllFunc' + Type: IMAGE_REL_AMD64_REL32 + - VirtualAddress: 41 + SymbolName: 'DllFunc' + Type: IMAGE_REL_AMD64_REL32 + - Name: .data + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: '' + - Name: .bss + Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: '' + - Name: .xdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '0104010004820000' + - Name: .drectve + Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: 202F44454641554C544C49423A6C6962636D742E6C6962202F44454641554C544C49423A6F6C646E616D65732E6C6962 + - Name: .pdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '000000003E00000000000000' + Relocations: + - VirtualAddress: 0 + SymbolName: main + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 4 + SymbolName: main + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 8 + SymbolName: .xdata + Type: IMAGE_REL_AMD64_ADDR32NB + - Name: .llvm_addrsig + Characteristics: [ IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: '10' +symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 62 + NumberOfRelocations: 2 + NumberOfLinenumbers: 0 + CheckSum: 373303044 + Number: 1 + - Name: .data + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 2 + - Name: .bss + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 3 + - Name: .xdata + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 2657791889 + Number: 4 + - Name: .drectve + Value: 0 + SectionNumber: 5 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 48 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 149686238 + Number: 5 + - Name: .pdata + Value: 0 + SectionNumber: 6 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 12 + NumberOfRelocations: 3 + NumberOfLinenumbers: 0 + CheckSum: 2420588879 + Number: 6 + - Name: .llvm_addrsig + Value: 0 + SectionNumber: 7 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 1 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 498536548 + Number: 7 + - Name: '@feat.00' + Value: 0 + SectionNumber: -1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: main + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: 'DllFunc' + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/lit/Modules/PECOFF/export-dllfunc.yaml b/lit/Modules/PECOFF/export-dllfunc.yaml new file mode 100644 index 000000000000..55156e8c792f --- /dev/null +++ b/lit/Modules/PECOFF/export-dllfunc.yaml @@ -0,0 +1,172 @@ +# REQUIRES: system-windows +# RUN: yaml2obj < %s > %t.obj +# +# RUN: lld-link /machine:x64 /out:%t.dll /noentry /nodefaultlib /dll %t.obj /export:DllFunc +# +# RUN: lldb-test object-file %t.dll | FileCheck -check-prefix=BASIC-CHECK %s +# RUN: lldb-test object-file -dep-modules %t.dll | FileCheck -check-prefix=DEPS %s + + +# BASIC-CHECK: Showing 3 sections +# BASIC-CHECK: Index: 0 +# BASIC-CHECK: Name: .text +# BASIC-CHECK: Type: code +# BASIC-CHECK: VM size: 22 +# BASIC-CHECK: File size: 512 +# +# BASIC-CHECK: Index: 1 +# BASIC-CHECK: Name: .rdata +# BASIC-CHECK: Type: data +# BASIC-CHECK: VM size: {{.}} +# BASIC-CHECK: File size: 512 +# +# BASIC-CHECK: Index: 2 +# BASIC-CHECK: Name: .pdata +# BASIC-CHECK: Type: data +# BASIC-CHECK: VM size: 12 +# BASIC-CHECK: File size: 512 +# +# DEPS: Showing 0 dependent module(s) + + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + Alignment: 16 + SectionData: 50894C24048B4C24040FAF4C2404890C248B042459C3 + - Name: .data + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: '' + - Name: .bss + Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] + Alignment: 4 + SectionData: '' + - Name: .xdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '0101010001020000' + - Name: .drectve + Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: 202F44454641554C544C49423A6C6962636D742E6C6962202F44454641554C544C49423A6F6C646E616D65732E6C6962 + - Name: .pdata + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + Alignment: 4 + SectionData: '000000001600000000000000' + Relocations: + - VirtualAddress: 0 + SymbolName: 'DllFunc' + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 4 + SymbolName: 'DllFunc' + Type: IMAGE_REL_AMD64_ADDR32NB + - VirtualAddress: 8 + SymbolName: .xdata + Type: IMAGE_REL_AMD64_ADDR32NB + - Name: .llvm_addrsig + Characteristics: [ IMAGE_SCN_LNK_REMOVE ] + Alignment: 1 + SectionData: '' +symbols: + - Name: .text + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 22 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 3054557294 + Number: 1 + - Name: .data + Value: 0 + SectionNumber: 2 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 2 + - Name: .bss + Value: 0 + SectionNumber: 3 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 3 + - Name: .xdata + Value: 0 + SectionNumber: 4 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 8 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 448359300 + Number: 4 + - Name: .drectve + Value: 0 + SectionNumber: 5 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 48 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 149686238 + Number: 5 + - Name: .pdata + Value: 0 + SectionNumber: 6 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 12 + NumberOfRelocations: 3 + NumberOfLinenumbers: 0 + CheckSum: 3134470316 + Number: 6 + - Name: .llvm_addrsig + Value: 0 + SectionNumber: 7 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + SectionDefinition: + Length: 0 + NumberOfRelocations: 0 + NumberOfLinenumbers: 0 + CheckSum: 0 + Number: 7 + - Name: '@feat.00' + Value: 0 + SectionNumber: -1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + - Name: 'DllFunc' + Value: 0 + SectionNumber: 1 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_FUNCTION + StorageClass: IMAGE_SYM_CLASS_EXTERNAL +... diff --git a/lit/Modules/PECOFF/lit.local.cfg b/lit/Modules/PECOFF/lit.local.cfg new file mode 100644 index 000000000000..9ef350be1dee --- /dev/null +++ b/lit/Modules/PECOFF/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.yaml', '.test'] diff --git a/lit/Modules/PECOFF/sections-names.yaml b/lit/Modules/PECOFF/sections-names.yaml new file mode 100644 index 000000000000..b62c0bc0426f --- /dev/null +++ b/lit/Modules/PECOFF/sections-names.yaml @@ -0,0 +1,52 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Name: .text{{$}} +# CHECK: Name: 1234567{{$}} +# CHECK: Name: 12345678{{$}} +# CHECK: Name: 123456789{{$}} + +--- !COFF +OptionalHeader: + AddressOfEntryPoint: 4616 + ImageBase: 1073741824 + SectionAlignment: 4096 + FileAlignment: 512 + MajorOperatingSystemVersion: 6 + MinorOperatingSystemVersion: 0 + MajorImageVersion: 0 + MinorImageVersion: 0 + MajorSubsystemVersion: 6 + MinorSubsystemVersion: 0 + Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI + DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ] + SizeOfStackReserve: 1048576 + SizeOfStackCommit: 4096 + SizeOfHeapReserve: 1048576 + SizeOfHeapCommit: 4096 +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ] +sections: + - Name: .text + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] + VirtualAddress: 4096 + VirtualSize: 64 # '@', if it makes its way into the name field + SectionData: DEADBEEFBAADF00D + - Name: 1234567 + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + VirtualAddress: 442368 + VirtualSize: 64 + SectionData: DEADBEEFBAADF00D + - Name: 12345678 + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + VirtualAddress: 446464 + VirtualSize: 64 + SectionData: DEADBEEFBAADF00D + - Name: 123456789 + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] + VirtualAddress: 450560 + VirtualSize: 64 + SectionData: DEADBEEFBAADF00D +symbols: [] +... diff --git a/lit/Python/crashlog.test b/lit/Python/crashlog.test new file mode 100644 index 000000000000..93d9cbabbe2d --- /dev/null +++ b/lit/Python/crashlog.test @@ -0,0 +1,99 @@ +# -*- python -*- +# REQUIRES: system-darwin +# RUN: cd %S/../../examples/python && %lldb -S %s | FileCheck %s +# CHECK-LABEL: {{S}}KIP BEYOND CHECKS +script +import crashlog +cl = crashlog.CrashLog +images = [ +"0x10b60b000 - 0x10f707fff com.apple.LLDB.framework (1.1000.11.38.2 - 1000.11.38.2) <96E36F5C-1A83-39A1-8713-5FDD9701C3F1> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB", +# CHECK: 0x10b60b000 +# CHECK: 0x10f707fff +# CHECK: com.apple.LLDB.framework +# CHECK: 96E36F5C-1A83-39A1-8713-5FDD9701C3F1 +# CHECK: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB + +"0x104591000 - 0x1055cfff7 +llvm-dwarfdump (0) <B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3> /Users/USER 1/Documents/*/llvm-dwarfdump", +# CHECK: 0x104591000 +# CHECK: 0x1055cfff7 +# CHECK: llvm-dwarfdump +# CHECK: (0) +# CHECK: B104CFA1-046A-36A6-8EB4-07DDD7CC2DF3 +# CHECK: /Users/USER 1/Documents/*/llvm-dwarfdump + +"0x7fff63f20000 - 0x7fff63f77ff7 libc++.1.dylib (400.9.4) <D4AB366F-48A9-3C7D-91BD-41198F69DD57> /usr/lib/libc++.1.dylib", +# CHECK: 0x7fff63f20000 +# CHECK: 0x7fff63f77ff7 +# CHECK: libc++.1.dylib +# CHECK: (400.9.4) +# CHECK: D4AB366F-48A9-3C7D-91BD-41198F69DD57 +# CHECK: /usr/lib/libc++.1.dylib + +"0x1111111 - 0x22222 +MyApp Pro arm64 <01234> /tmp/MyApp Pro.app/MyApp Pro", +# CHECK: 0x1111111 +# CHECK: 0x22222 +# CHECK: MyApp Pro arm64 +# CHECK: None +# CHECK: 01234 +# CHECK: /tmp/MyApp Pro.app/MyApp Pro + +"0x1111111 - 0x22222 +MyApp Pro (0) <01234> /tmp/MyApp Pro.app/MyApp Pro", +# CHECK: 0x1111111 +# CHECK: 0x22222 +# CHECK: MyApp Pro +# CHECK: (0) +# CHECK: 01234 +# CHECK: /tmp/MyApp Pro.app/MyApp Pro + +"0x7fff63f20000 - 0x7fff63f77ff7 libc++.1.dylib (400.9.4) /usr/lib/libc++.1.dylib" +# CHECK: 0x7fff63f20000 +# CHECK: 0x7fff63f77ff7 +# CHECK: libc++.1.dylib +# CHECK: (400.9.4) +# CHECK: None +# CHECK: /usr/lib/libc++.1.dylib +] +# CHECK-LABEL: FRAMES +frames = [ +"0 libsystem_kernel.dylib 0x00007fff684b78a6 read + 10", +# CHECK: 0 +# CHECK: libsystem_kernel.dylib +# CHECK: 0x00007fff684b78a6 +# CHECK: read + 10 +"1 com.apple.LLDB.framework 0x000000010f7954af lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105", +# CHECK: 1 +# CHECK: com.apple.LLDB.framework +# CHECK: 0x000000010f7954af +# CHECK: lldb_private{{.*}} + 105 +"2 MyApp Pro arm64 0x000000019b0db3a8 foo + 72", +# CHECK: 2 +# CHECK: MyApp Pro arm64 +# CHECK: 0x000000019b0db3a8 +# CHECK: foo + 72 +"3 He 0x1 0x000000019b0db3a8 foo + 72" +# CHECK: 3 +# CHECK: He 0x1 +# CHECK: 0x000000019b0db3a8 +# CHECK: foo + 72 +] + + +# Avoid matching the text inside the input. +print("SKIP BEYOND CHECKS") +for image in images: + print('"%s"'%image) + print("--------------") + match = cl.image_regex_uuid.search(image) + for group in match.groups(): + print(group) + +print("FRAMES") +for frame in frames: + print('"%s"'%frame) + print("--------------") + match = cl.frame_regex.search(frame) + for group in match.groups(): + print(group) + +exit() +quit diff --git a/lit/Quit/TestQuitExitCode-30.test b/lit/Quit/TestQuitExitCode-30.test index 0f6eff927f0c..5e74c9db79c4 100644 --- a/lit/Quit/TestQuitExitCode-30.test +++ b/lit/Quit/TestQuitExitCode-30.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 226 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 226 %lldb -b -s %s q -30 diff --git a/lit/Quit/TestQuitExitCode30.test b/lit/Quit/TestQuitExitCode30.test index b5249400ec2f..687d048c480d 100644 --- a/lit/Quit/TestQuitExitCode30.test +++ b/lit/Quit/TestQuitExitCode30.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 30 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 30 %lldb -b -s %s q 30 diff --git a/lit/Quit/TestQuitExitCodeHexA.test b/lit/Quit/TestQuitExitCodeHexA.test index e06c25b0619f..43cfd591961e 100644 --- a/lit/Quit/TestQuitExitCodeHexA.test +++ b/lit/Quit/TestQuitExitCodeHexA.test @@ -1,3 +1,3 @@ # UNSUPPORTED: windows -# RUN: python %S/expect_exit_code.py 10 %lldb -b -s %s +# RUN: %python %S/expect_exit_code.py 10 %lldb -b -s %s q 0xA diff --git a/lit/Quit/lit.local.cfg b/lit/Quit/lit.local.cfg deleted file mode 100644 index df9b335dd131..000000000000 --- a/lit/Quit/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] diff --git a/lit/Reproducer/Inputs/GDBRemoteCapture.in b/lit/Reproducer/Inputs/GDBRemoteCapture.in new file mode 100644 index 000000000000..8df7ca42fee0 --- /dev/null +++ b/lit/Reproducer/Inputs/GDBRemoteCapture.in @@ -0,0 +1,6 @@ +breakpoint set -f simple.c -l 13 +run +bt +cont +reproducer status +reproducer generate diff --git a/lit/Reproducer/Inputs/GDBRemoteReplay.in b/lit/Reproducer/Inputs/GDBRemoteReplay.in new file mode 100644 index 000000000000..1364c7e72764 --- /dev/null +++ b/lit/Reproducer/Inputs/GDBRemoteReplay.in @@ -0,0 +1,5 @@ +reproducer status +breakpoint set -f simple.c -l 13 +run +bt +cont diff --git a/lit/Reproducer/Inputs/simple.c b/lit/Reproducer/Inputs/simple.c new file mode 100644 index 000000000000..a4585b380ca6 --- /dev/null +++ b/lit/Reproducer/Inputs/simple.c @@ -0,0 +1,19 @@ +//===-- main.c --------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> + +void foo() { + printf("testing\n"); +} + +int main (int argc, char const *argv[]) { + foo(); + return 0; +} diff --git a/lit/Reproducer/TestDriverOptions.test b/lit/Reproducer/TestDriverOptions.test new file mode 100644 index 000000000000..c0713295685d --- /dev/null +++ b/lit/Reproducer/TestDriverOptions.test @@ -0,0 +1,7 @@ +# Check that errors are propagated to the driver. + +# RUN: not %lldb --capture %t/bogus/bogus 2>&1 | FileCheck %s --check-prefix CAPTURE +# RUN: not %lldb --replay %t/bogus/bogus 2>&1 | FileCheck %s --check-prefix REPLAY + +# CAPTURE: unable to create reproducer directory +# REPLAY: unable to load reproducer index diff --git a/lit/Reproducer/TestGDBRemoteRepro.test b/lit/Reproducer/TestGDBRemoteRepro.test new file mode 100644 index 000000000000..6a6bdd780a85 --- /dev/null +++ b/lit/Reproducer/TestGDBRemoteRepro.test @@ -0,0 +1,26 @@ +# UNSUPPORTED: system-windows, system-freebsd + +# This tests the replaying of GDB remote packets. +# +# We issue the same commands and ensure the output is identical to the original +# process. To ensure we're not actually running the original binary we check +# that the string "testing" is not printed. + +# RUN: %clang %S/Inputs/simple.c -g -o %t.out +# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture %T/reproducer -- %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE +# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteReplay.in --replay %T/reproducer -- %t.out | FileCheck %s --check-prefix CHECK --check-prefix REPLAY + +# CHECK: Breakpoint 1 +# CHECK: Process {{.*}} stopped +# CHECK: Process {{.*}} launched +# CHECK: thread {{.*}} stop reason = breakpoint +# CHECK: frame {{.*}} simple.c + +# CAPTURE: testing +# REPLAY-NOT: testing + +# CHECK: Process {{.*}} resuming +# CHECK: Process {{.*}} exited + +# CAPTURE: Reproducer is in capture mode. +# CAPTURE: Reproducer written diff --git a/lit/Settings/Inputs/EchoCommandsAll.out b/lit/Settings/Inputs/EchoCommandsAll.out new file mode 100644 index 000000000000..45b772919760 --- /dev/null +++ b/lit/Settings/Inputs/EchoCommandsAll.out @@ -0,0 +1,6 @@ +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK-NEXT: Executing commands in {{.*\n}} +# CHECK-NEXT: Evaluate expr 1+2 +# CHECK-NEXT: expr 1+2 +# CHECK-NEXT: (int) $0 = 3 diff --git a/lit/Settings/Inputs/EchoCommandsNoComments.out b/lit/Settings/Inputs/EchoCommandsNoComments.out new file mode 100644 index 000000000000..a0b653a8f4cc --- /dev/null +++ b/lit/Settings/Inputs/EchoCommandsNoComments.out @@ -0,0 +1,5 @@ +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK-NEXT: Executing commands in {{.*\n}} +# CHECK-NEXT: expr 1+2 +# CHECK-NEXT: (int) $0 = 3 diff --git a/lit/Settings/Inputs/EchoCommandsNone.out b/lit/Settings/Inputs/EchoCommandsNone.out new file mode 100644 index 000000000000..fca1bbb50ca0 --- /dev/null +++ b/lit/Settings/Inputs/EchoCommandsNone.out @@ -0,0 +1,4 @@ +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK: (lldb) command source -s {{.*\n}} +# CHECK-NEXT: Executing commands in {{.*\n}} +# CHECK-NEXT: (int) $0 = 3 diff --git a/lit/Settings/Inputs/EchoCommandsQuiet.out b/lit/Settings/Inputs/EchoCommandsQuiet.out new file mode 100644 index 000000000000..12ad094292de --- /dev/null +++ b/lit/Settings/Inputs/EchoCommandsQuiet.out @@ -0,0 +1,2 @@ +# CHECK: (lldb) command source -s 1 {{.*\n}} +# CHECK-NEXT: (lldb) command source -s 1 {{.*\n}} diff --git a/lit/Settings/Inputs/EchoCommandsTest.in b/lit/Settings/Inputs/EchoCommandsTest.in new file mode 100644 index 000000000000..304648e81e10 --- /dev/null +++ b/lit/Settings/Inputs/EchoCommandsTest.in @@ -0,0 +1,2 @@ +# Evaluate expr 1+2 +expr 1+2 diff --git a/lit/Settings/TestDisableColor.test b/lit/Settings/TestDisableColor.test new file mode 100644 index 000000000000..659e2073fa21 --- /dev/null +++ b/lit/Settings/TestDisableColor.test @@ -0,0 +1,7 @@ +# RUN: %lldb -x -b -s %s | FileCheck %s +settings show use-color +q +# This tests that LLDB turns off use-color if the output file is not an +# interactive terminal. In this example, use-color should be off because LLDB +# is run just by the non-interactive lit test runner. +# CHECK: use-color (boolean) = false diff --git a/lit/Settings/TestDisassemblyFormat.test b/lit/Settings/TestDisassemblyFormat.test new file mode 100644 index 000000000000..29975a1b0163 --- /dev/null +++ b/lit/Settings/TestDisassemblyFormat.test @@ -0,0 +1,2 @@ +# RUN: %lldb -x -b -o "settings show disassembly-format" | FileCheck %s +# CHECK: disassembly-format (format-string) = "{${function.initial-function}{${module.file.basename}\`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}\`}{${function.name-without-args}}:\n}{${current-pc-arrow} }${addr-file-or-load}{ <${function.concrete-only-addr-offset-no-padding}>}: " diff --git a/lit/Settings/TestEchoCommands.test b/lit/Settings/TestEchoCommands.test new file mode 100644 index 000000000000..67547eaabf89 --- /dev/null +++ b/lit/Settings/TestEchoCommands.test @@ -0,0 +1,4 @@ +# RUN: %lldb -x -b -o 'settings set interpreter.echo-comment-commands true' -s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsAll.out +# RUN: %lldb -x -b -o 'settings set interpreter.echo-comment-commands false' -s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsNoComments.out +# RUN: %lldb -x -b -o 'settings set interpreter.echo-commands false' -s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsNone.out +# RUN: %lldb -x -b --source-quietly -s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsQuiet.out diff --git a/lit/Settings/TestSettingsSet.test b/lit/Settings/TestSettingsSet.test new file mode 100644 index 000000000000..0def3faaadbb --- /dev/null +++ b/lit/Settings/TestSettingsSet.test @@ -0,0 +1,15 @@ +# This tests setting setting values. + +# Check that setting an empty value with -f(orce) clears the value. +# RUN: %lldb -b -s %s 2>&1 | FileCheck %s + +settings set tab-size 16 +settings show tab-size +# CHECK: tab-size (unsigned) = 16 + +settings set -f tab-size +settings show tab-size +# CHECK: tab-size (unsigned) = 4 + +settings set tab-size +# CHECK: error: 'settings set' takes more arguments diff --git a/lit/Settings/TestSettingsWrite.test b/lit/Settings/TestSettingsWrite.test new file mode 100644 index 000000000000..72dcd73e33f0 --- /dev/null +++ b/lit/Settings/TestSettingsWrite.test @@ -0,0 +1,32 @@ +# This tests writing and reading settings from LLDB. + +# Check that the settings can be written to file and read again without +# altering the values. +# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings write -f %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: diff -w %t.foo %t.bar +# SUCCESS-NOT: error: + +# Check that exporting target settings only export target settings and nothing else. +# RUN: %lldb -b -o 'settings write -f %t.target target' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: cat %t.target | FileCheck %s --check-prefix TARGET +# TARGET: settings set -f target +# TARGET-NOT: settings set -f platform +# TARGET-NOT: settings set -f symbols +# TARGET-NOT: settings set -f interpreter +# TARGET-NOT: settings set -f plugin + +# Check that settings appear twice when appending. +# RUN: %lldb -b -o 'settings write -a -f %t.append target' -o 'settings write -a -f %t.append target' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: cat %t.append | FileCheck %s --check-prefix APPEND +# APPEND: settings set -f target.language +# APPEND: settings set -f target.language + +# Check that an error is printed for non-existing setting. +# RUN: echo "settings set -f bogus" > %t.bogus_setting +# RUN: %lldb -b -o 'settings read -f %t.bogus_setting' 2>&1 | FileCheck %s --check-prefix BOGUS-SETTING +# BOGUS-SETTING: error: invalid value path + +# Check that an error is printed for invalid value. +# RUN: echo "settings set -f target.language bogus" > %t.bogus_value +# RUN: %lldb -b -o 'settings read -f %t.bogus_value' 2>&1 | FileCheck %s --check-prefix BOGUS-VALUE +# BOGUS-VALUE: error: invalid language type diff --git a/lit/Suite/lit.cfg b/lit/Suite/lit.cfg index eb0fac9541ac..7bc16e9a08f4 100644 --- a/lit/Suite/lit.cfg +++ b/lit/Suite/lit.cfg @@ -19,6 +19,19 @@ config.test_source_root = os.path.join(config.lldb_src_root, 'packages', 'Python', 'lldbsuite', 'test') config.test_exec_root = config.test_source_root +# macOS flags needed for LLDB built with address sanitizer. +if 'Address' in config.llvm_use_sanitizer and \ + 'Darwin' in config.host_os and \ + 'x86' in config.host_triple: + import subprocess + resource_dir = subprocess.check_output( + config.cmake_cxx_compiler +' -print-resource-dir', shell=True).strip() + runtime = os.path.join(resource_dir, 'lib', 'darwin', + 'libclang_rt.asan_osx_dynamic.dylib') + config.environment['ASAN_OPTIONS'] = \ + 'detect_stack_use_after_return=1' + config.environment['DYLD_INSERT_LIBRARIES'] = runtime + # Build dotest command. dotest_cmd = [config.dotest_path, '-q'] dotest_cmd.extend(config.dotest_args_str.split(';')) diff --git a/lit/Suite/lit.site.cfg.in b/lit/Suite/lit.site.cfg.in index 40f3310c6129..1a24f8c24c2d 100644 --- a/lit/Suite/lit.site.cfg.in +++ b/lit/Suite/lit.site.cfg.in @@ -1,6 +1,6 @@ @LIT_SITE_CFG_IN_HEADER@ -config.test_exec_root = "@LLVM_BINARY_DIR@" +config.test_exec_root = "@LLDB_BINARY_DIR@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" @@ -9,6 +9,10 @@ config.llvm_build_mode = "@LLVM_BUILD_MODE@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" config.lldb_src_root = "@LLDB_SOURCE_DIR@" +config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@" +config.host_os = "@HOST_OS@" +config.host_triple = "@LLVM_HOST_TRIPLE@" +config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py" diff --git a/lit/Suite/lldbtest.py b/lit/Suite/lldbtest.py index fbdab183a4a3..12591f3ba505 100644 --- a/lit/Suite/lldbtest.py +++ b/lit/Suite/lldbtest.py @@ -9,6 +9,24 @@ import lit.TestRunner import lit.util from lit.formats.base import TestFormat +def getBuildDir(cmd): + found = False + for arg in cmd: + if found: + return arg + if arg == '--build-dir': + found = True + return None + +def mkdir_p(path): + import errno + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + if not os.path.isdir(path): + raise OSError(errno.ENOTDIR, "%s is not a directory"%path) class LLDBTest(TestFormat): def __init__(self, dotest_cmd): @@ -44,11 +62,28 @@ class LLDBTest(TestFormat): return (lit.Test.UNSUPPORTED, 'Test is unsupported') testPath, testFile = os.path.split(test.getSourcePath()) - # On Windows, the system does not always correctly interpret shebang lines. - # To make sure we can execute the tests, add python exe as the first parameter - # of the command. + # On Windows, the system does not always correctly interpret + # shebang lines. To make sure we can execute the tests, add + # python exe as the first parameter of the command. cmd = [sys.executable] + self.dotest_cmd + [testPath, '-p', testFile] + # The macOS system integrity protection (SIP) doesn't allow injecting + # libraries into system binaries, but this can be worked around by + # copying the binary into a different location. + if 'DYLD_INSERT_LIBRARIES' in test.config.environment and \ + (sys.executable.startswith('/System/') or \ + sys.executable.startswith('/usr/')): + builddir = getBuildDir(cmd) + mkdir_p(builddir) + copied_python = os.path.join(builddir, 'copied-system-python') + if not os.path.isfile(copied_python): + import shutil, subprocess + python = subprocess.check_output([ + '/usr/bin/python2.7', '-c', + 'import sys; print sys.executable']).strip() + shutil.copy(python, copied_python) + cmd[0] = copied_python + try: out, err, exitCode = lit.util.executeCommand( cmd, @@ -59,7 +94,10 @@ class LLDBTest(TestFormat): litConfig.maxIndividualTestTime)) if exitCode: - return lit.Test.FAIL, out + err + if 'FAIL:' in out or 'FAIL:' in err: + return lit.Test.FAIL, out + err + if 'XPASS:' in out or 'XPASS:' in err: + return lit.Test.XPASS, out + err passing_test_line = 'RESULT: PASSED' if passing_test_line not in out and passing_test_line not in err: diff --git a/lit/SymbolFile/Breakpad/Inputs/basic-elf.yaml b/lit/SymbolFile/Breakpad/Inputs/basic-elf.yaml new file mode 100644 index 000000000000..4d6a1e15b604 --- /dev/null +++ b/lit/SymbolFile/Breakpad/Inputs/basic-elf.yaml @@ -0,0 +1,33 @@ +# A very basic ELF file to serve as a recipient of breakpad info + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x00000000004000D0 +Sections: + - Name: .text1 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400000 + AddressAlign: 0x0000000000001000 + Size: 0xb0 + - Name: .text2 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x00000000004000B0 + AddressAlign: 0x0000000000000010 + Size: 0x42 +Symbols: +DynamicSymbols: +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0x400000 + Align: 0x1000 + Sections: + - Section: .text1 + - Section: .text2 +... diff --git a/lit/SymbolFile/Breakpad/Inputs/symtab.syms b/lit/SymbolFile/Breakpad/Inputs/symtab.syms new file mode 100644 index 000000000000..ab03b50a75a9 --- /dev/null +++ b/lit/SymbolFile/Breakpad/Inputs/symtab.syms @@ -0,0 +1,7 @@ +MODULE Linux x86_64 761550E08086333960A9074A9CE2895C0 a.out +INFO CODE_ID E05015768680393360A9074A9CE2895C +FILE 0 /tmp/a.c +PUBLIC b0 0 f1 +PUBLIC m c0 0 f2 +PUBLIC d0 0 _start +PUBLIC ff 0 _out_of_range_ignored diff --git a/lit/SymbolFile/Breakpad/symtab.test b/lit/SymbolFile/Breakpad/symtab.test new file mode 100644 index 000000000000..6bb26eb108c9 --- /dev/null +++ b/lit/SymbolFile/Breakpad/symtab.test @@ -0,0 +1,23 @@ +# RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/symtab.out +# RUN: %lldb %T/symtab.out -o "target symbols add -s symtab.out %S/Inputs/symtab.syms" \ +# RUN: -s %s | FileCheck %s + +# CHECK-LABEL: (lldb) image dump symtab symtab.out +# CHECK: Symtab, file = {{.*}}symtab.out, num_symbols = 3: +# CHECK: Index UserID DSX Type File Address/Value Load Address Size Flags Name +# CHECK: [ 0] 0 X Code 0x00000000004000b0 0x0000000000000010 0x00000000 f1 +# CHECK: [ 1] 0 X Code 0x00000000004000c0 0x0000000000000010 0x00000000 f2 +# CHECK: [ 2] 0 X Code 0x00000000004000d0 0x0000000000000022 0x00000000 _start + +# CHECK-LABEL: (lldb) image lookup -a 0x4000b0 -v +# CHECK: Address: symtab.out[0x00000000004000b0] (symtab.out.PT_LOAD[0]..text2 + 0) +# CHECK: Symbol: id = {0x00000000}, range = [0x00000000004000b0-0x00000000004000c0), name="f1" + +# CHECK-LABEL: (lldb) image lookup -n f2 -v +# CHECK: Address: symtab.out[0x00000000004000c0] (symtab.out.PT_LOAD[0]..text2 + 16) +# CHECK: Symbol: id = {0x00000000}, range = [0x00000000004000c0-0x00000000004000d0), name="f2" + +image dump symtab symtab.out +image lookup -a 0x4000b0 -v +image lookup -n f2 -v +exit diff --git a/lit/SymbolFile/DWARF/apple-index-is-used.cpp b/lit/SymbolFile/DWARF/apple-index-is-used.cpp index 104d86756e48..00440531e99f 100644 --- a/lit/SymbolFile/DWARF/apple-index-is-used.cpp +++ b/lit/SymbolFile/DWARF/apple-index-is-used.cpp @@ -1,5 +1,5 @@ // Test that we use the apple indexes. -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols %t | FileCheck %s // CHECK: .apple_names index present diff --git a/lit/SymbolFile/DWARF/array-sizes.s b/lit/SymbolFile/DWARF/array-sizes.s new file mode 100644 index 000000000000..c472d54a489c --- /dev/null +++ b/lit/SymbolFile/DWARF/array-sizes.s @@ -0,0 +1,147 @@ +# This tests a bug where we would incorrectly parse the size of an array if that +# size happened to match an existing DIE offset. This happened because we +# misinterpreted that value as a reference to a DIE specifying the VLA size even +# though the form was a data form (as it should be). + +# REQUIRES: lld + +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o +# RUN: ld.lld %t.o -o %t +# RUN: lldb-test symbols %t | FileCheck %s + +# CHECK: Variable{0xffffffff0000001e}, name = "X" +# CHECK-SAME: type = {ffffffff00000033} 0x{{[0-9a-f]*}} (char [56]) + + +# Generated from "char X[47];" +# The array size was modified by hand. + + .text + .file "-" + .file 1 "/tmp" "<stdin>" + .type X,@object # @X + .comm X,63,16 + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 8.0.0 (trunk 349604) (llvm/trunk 349608)" # string offset=0 +.Linfo_string1: + .asciz "-" # string offset=55 +.Linfo_string2: + .asciz "/tmp" # string offset=57 +.Linfo_string3: + .asciz "X" # string offset=62 +.Linfo_string4: + .asciz "char" # string offset=64 +.Linfo_string5: + .asciz "__ARRAY_SIZE_TYPE__" # string offset=69 + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 1 # DW_TAG_array_type + .byte 1 # DW_CHILDREN_yes + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 33 # DW_TAG_subrange_type + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 55 # DW_AT_count + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + .byte 1 # Abbrev [1] 0xb:0x43 DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 12 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long 0 # DW_AT_stmt_list + .long .Linfo_string2 # DW_AT_comp_dir + .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable + .long .Linfo_string3 # DW_AT_name + .long 51 # DW_AT_type + # DW_AT_external + .byte 1 # DW_AT_decl_file + .byte 1 # DW_AT_decl_line + .byte 9 # DW_AT_location + .byte 3 + .quad X + .byte 3 # Abbrev [3] 0x33:0xc DW_TAG_array_type + .long 63 # DW_AT_type +.Ldie: + .byte 4 # Abbrev [4] 0x38:0x6 DW_TAG_subrange_type + .long 70 # DW_AT_type + .byte .Ldie-.Lcu_begin0 # DW_AT_count - should match the offset of an existing die + .byte 0 # End Of Children Mark + .byte 5 # Abbrev [5] 0x3f:0x7 DW_TAG_base_type + .long .Linfo_string4 # DW_AT_name + .byte 6 # DW_AT_encoding + .byte 1 # DW_AT_byte_size + .byte 6 # Abbrev [6] 0x46:0x7 DW_TAG_base_type + .long .Linfo_string5 # DW_AT_name + .byte 8 # DW_AT_byte_size + .byte 7 # DW_AT_encoding + .byte 0 # End Of Children Mark +.Ldebug_info_end0: diff --git a/lit/SymbolFile/DWARF/childless-compile-unit.s b/lit/SymbolFile/DWARF/childless-compile-unit.s new file mode 100644 index 000000000000..d167e0503c52 --- /dev/null +++ b/lit/SymbolFile/DWARF/childless-compile-unit.s @@ -0,0 +1,45 @@ +# Test that we don't crash when parsing slightly invalid DWARF. The compile +# unit in this file sets DW_CHILDREN_no, but it still includes an +# end-of-children marker in its contribution. + +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o +# RUN: lldb-test symbols %t.o + + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "Hand-written DWARF" +.Linfo_string1: + .asciz "-" +.Linfo_string2: + .asciz "/tmp" + + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 0 # DW_CHILDREN_no + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Lcu_length_end-.Lcu_length_start # Length of Unit +.Lcu_length_start: + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + .byte 1 # Abbrev [1] 0xb:0x30 DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 12 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long .Linfo_string2 # DW_AT_comp_dir + .byte 0 # Bogus End Of Children Mark +.Lcu_length_end: diff --git a/lit/SymbolFile/DWARF/debug-names-compressed.cpp b/lit/SymbolFile/DWARF/debug-names-compressed.cpp index 076cac192522..aeb0ff1d01b1 100644 --- a/lit/SymbolFile/DWARF/debug-names-compressed.cpp +++ b/lit/SymbolFile/DWARF/debug-names-compressed.cpp @@ -3,7 +3,7 @@ // REQUIRES: lld, zlib -// RUN: clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s +// RUN: %clang -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s // RUN: ld.lld %t.o -o %t --compress-debug-sections=zlib // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s diff --git a/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp b/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp index 14d2bc076d78..f5122ebadae2 100644 --- a/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp +++ b/lit/SymbolFile/DWARF/dwarf5-index-is-used.cpp @@ -2,7 +2,7 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf -gpubnames // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols %t | FileCheck %s diff --git a/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp b/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp index 3a2cf0122951..84e3b62e17bb 100644 --- a/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp +++ b/lit/SymbolFile/DWARF/dwarf5-partial-index.cpp @@ -3,8 +3,8 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf -// RUN: clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t-1.o --target=x86_64-pc-linux -DONE -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t-2.o --target=x86_64-pc-linux -DTWO -mllvm -accel-tables=Dwarf // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --find=variable --name=foo %t | FileCheck %s diff --git a/lit/SymbolFile/DWARF/find-basic-function.cpp b/lit/SymbolFile/DWARF/find-basic-function.cpp index d04c94b38547..3d175f63e047 100644 --- a/lit/SymbolFile/DWARF/find-basic-function.cpp +++ b/lit/SymbolFile/DWARF/find-basic-function.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s @@ -15,7 +15,7 @@ // RUN: lldb-test symbols --name=not_there --find=function %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ @@ -29,7 +29,7 @@ // RUN: lldb-test symbols --name=not_there --find=function %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=BASE %s diff --git a/lit/SymbolFile/DWARF/find-basic-namespace.cpp b/lit/SymbolFile/DWARF/find-basic-namespace.cpp index 11a660bfba9f..e7655a37053c 100644 --- a/lit/SymbolFile/DWARF/find-basic-namespace.cpp +++ b/lit/SymbolFile/DWARF/find-basic-namespace.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s @@ -9,7 +9,7 @@ // RUN: lldb-test symbols --name=not_there --find=namespace %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \ @@ -17,7 +17,7 @@ // RUN: lldb-test symbols --name=not_there --find=namespace %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=namespace %t | \ // RUN: FileCheck --check-prefix=FOO %s diff --git a/lit/SymbolFile/DWARF/find-basic-type.cpp b/lit/SymbolFile/DWARF/find-basic-type.cpp index a470ef762e61..060a5b41eebc 100644 --- a/lit/SymbolFile/DWARF/find-basic-type.cpp +++ b/lit/SymbolFile/DWARF/find-basic-type.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s @@ -9,7 +9,7 @@ // RUN: lldb-test symbols --name=not_there --find=type %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s // RUN: lldb-test symbols --name=foo --context=context --find=type %t | \ @@ -17,7 +17,7 @@ // RUN: lldb-test symbols --name=not_there --find=type %t | \ // RUN: FileCheck --check-prefix=EMPTY %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s diff --git a/lit/SymbolFile/DWARF/find-basic-variable.cpp b/lit/SymbolFile/DWARF/find-basic-variable.cpp index 222ad420d400..bca8f27e1d4e 100644 --- a/lit/SymbolFile/DWARF/find-basic-variable.cpp +++ b/lit/SymbolFile/DWARF/find-basic-variable.cpp @@ -1,6 +1,6 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s @@ -11,7 +11,7 @@ // RUN: lldb-test symbols --name=not_there --find=variable %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=foo --find=variable %t | \ @@ -21,7 +21,7 @@ // RUN: lldb-test symbols --name=not_there --find=variable %t | \ // RUN: FileCheck --check-prefix=EMPTY %s // -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s diff --git a/lit/SymbolFile/DWARF/find-function-regex.cpp b/lit/SymbolFile/DWARF/find-function-regex.cpp index 2e099eb4fd74..b1e9d10e82ac 100644 --- a/lit/SymbolFile/DWARF/find-function-regex.cpp +++ b/lit/SymbolFile/DWARF/find-function-regex.cpp @@ -1,13 +1,13 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=f.o --regex --find=function %t | FileCheck %s diff --git a/lit/SymbolFile/DWARF/find-method-local-struct.cpp b/lit/SymbolFile/DWARF/find-method-local-struct.cpp index 19b41e77c17d..3da4a4a23f8a 100644 --- a/lit/SymbolFile/DWARF/find-method-local-struct.cpp +++ b/lit/SymbolFile/DWARF/find-method-local-struct.cpp @@ -1,4 +1,4 @@ -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s diff --git a/lit/SymbolFile/DWARF/find-method.cpp b/lit/SymbolFile/DWARF/find-method.cpp index 013e13435b9f..7e7710fd472b 100644 --- a/lit/SymbolFile/DWARF/find-method.cpp +++ b/lit/SymbolFile/DWARF/find-method.cpp @@ -1,11 +1,11 @@ // REQUIRES: lld -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s // -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ // RUN: FileCheck %s diff --git a/lit/SymbolFile/DWARF/find-qualified-variable.cpp b/lit/SymbolFile/DWARF/find-qualified-variable.cpp index ca1b3184fbe7..1ad3e7fbadf5 100644 --- a/lit/SymbolFile/DWARF/find-qualified-variable.cpp +++ b/lit/SymbolFile/DWARF/find-qualified-variable.cpp @@ -1,4 +1,4 @@ -// RUN: clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx // RUN: lldb-test symbols --name=A::foo --find=variable %t | FileCheck %s // CHECK: Found 1 variables: diff --git a/lit/SymbolFile/DWARF/find-type-in-function.cpp b/lit/SymbolFile/DWARF/find-type-in-function.cpp index a0894284fa26..5c1b4b44523d 100644 --- a/lit/SymbolFile/DWARF/find-type-in-function.cpp +++ b/lit/SymbolFile/DWARF/find-type-in-function.cpp @@ -2,7 +2,7 @@ // XFAIL: * -// RUN: clang %s -g -c -o %t.o --target=x86_64-pc-linux +// RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux // RUN: ld.lld %t.o -o %t // RUN: lldb-test symbols --name=foo --find=type %t | \ // RUN: FileCheck --check-prefix=NAME %s diff --git a/lit/SymbolFile/DWARF/find-variable-dwo.cpp b/lit/SymbolFile/DWARF/find-variable-dwo.cpp index 142ddc82cdab..b2fb1a375cf2 100644 --- a/lit/SymbolFile/DWARF/find-variable-dwo.cpp +++ b/lit/SymbolFile/DWARF/find-variable-dwo.cpp @@ -1,9 +1,9 @@ // REQUIRES: lld -// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \ +// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DONE | \ // RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-1.dwo -o %t-1.o // RUN: llvm-objcopy --split-dwo=%t-1.dwo %t-1.o -// RUN: clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \ +// RUN: %clang %s -g -gsplit-dwarf -c -emit-llvm -o - --target=x86_64-pc-linux -DTWO | \ // RUN: llc -accel-tables=Dwarf -filetype=obj -split-dwarf-file=%t-2.dwo -o %t-2.o // RUN: llvm-objcopy --split-dwo=%t-2.dwo %t-2.o // RUN: ld.lld %t-1.o %t-2.o -o %t diff --git a/lit/SymbolFile/DWARF/find-variable-file.cpp b/lit/SymbolFile/DWARF/find-variable-file.cpp index f71d4a2b09b6..5a95c5338f8f 100644 --- a/lit/SymbolFile/DWARF/find-variable-file.cpp +++ b/lit/SymbolFile/DWARF/find-variable-file.cpp @@ -1,15 +1,15 @@ // REQUIRES: lld -// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s -// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp +// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %s +// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Disable %S/Inputs/find-variable-file-2.cpp // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=ONE %s // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=TWO %s -// RUN: clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s -// RUN: clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp +// RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %s +// RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -mllvm -accel-tables=Dwarf %S/Inputs/find-variable-file-2.cpp // RUN: ld.lld %t-1.o %t-2.o -o %t // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ // RUN: FileCheck --check-prefix=ONE %s diff --git a/lit/SymbolFile/NativePDB/Inputs/ast-functions.lldbinit b/lit/SymbolFile/NativePDB/Inputs/ast-functions.lldbinit new file mode 100644 index 000000000000..c25d96c531d5 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/ast-functions.lldbinit @@ -0,0 +1,8 @@ + +break set -n main +break set -n static_fn +break set -n varargs_fn + +target modules dump ast + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/ast-types.lldbinit b/lit/SymbolFile/NativePDB/Inputs/ast-types.lldbinit new file mode 100644 index 000000000000..3c0cf6d3cdfd --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/ast-types.lldbinit @@ -0,0 +1,20 @@ +target variable TC +target variable TS +target variable TU +target variable TE + +target variable ABCInt +target variable ABCFloat +target variable ABCVoid + +target variable AC0 +target variable ACNeg1 + +target variable AC0D +target variable ACNeg1D +target variable AD +target variable ADE + +target modules dump ast + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit b/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit new file mode 100644 index 000000000000..cf06c494e678 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit @@ -0,0 +1,5 @@ +settings set auto-one-line-summaries false + +target variable -T TheStruct + +target modules dump ast diff --git a/lit/SymbolFile/NativePDB/Inputs/break-by-function.lldbinit b/lit/SymbolFile/NativePDB/Inputs/break-by-function.lldbinit new file mode 100644 index 000000000000..ff9bf21a8864 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/break-by-function.lldbinit @@ -0,0 +1,6 @@ +break set -n main +break set -n OvlGlobalFn +break set -n StaticFn +break set -n DoesntExist +break list +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/break-by-line.lldbinit b/lit/SymbolFile/NativePDB/Inputs/break-by-line.lldbinit new file mode 100644 index 000000000000..7daa53ba24e0 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/break-by-line.lldbinit @@ -0,0 +1,3 @@ +break set -f break-by-line.cpp -l 14 +break list +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit b/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit new file mode 100644 index 000000000000..2b552a0b01dd --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit @@ -0,0 +1,2 @@ +disassemble --flavor=intel -m -n main +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit b/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit new file mode 100644 index 000000000000..fe29896b5f52 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit @@ -0,0 +1,70 @@ +command alias dv target variable + +dv aa +dv ab +dv ac +dv ad +dv ae +dv af +dv ag +dv ah +dv ai +dv aj +dv ak +dv al +dv am +dv an +dv ao +dv aq +dv ar +dv as +dv at +dv au +dv av +dv aw +dv ax +dv ay +dv az +dv aaa +dv aab +dv aac +dv aad +dv ra +dv rb +dv rc +dv rd +dv re +dv rf +dv rg +dv rh +dv ri +dv rj +dv rk +dv rl +dv rm +dv rn +dv ro +dv rq +dv rr +dv rs +dv rt +dv ru +dv rv +dv rw +dv rx +dv ry +dv rz +dv raa +dv rab +dv rac +dv rad +dv ref +dv ref2 +dv ref3 +dv binp +dv binr +dv null +dv rae +dv aae + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit b/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit new file mode 100644 index 000000000000..8664881b262a --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit @@ -0,0 +1,7 @@ +target variable sfn +target variable ffn +target variable tfn +target variable cfn +target variable vfn + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit b/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit new file mode 100644 index 000000000000..c06c650e1c45 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit @@ -0,0 +1,14 @@ +target variable a +target variable b +target variable c +target variable d +target variable e +target variable f +target variable g +target variable h +target variable i +target variable incomplete + +target modules dump ast + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit b/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit new file mode 100644 index 000000000000..9bf066ee2af9 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit @@ -0,0 +1,3 @@ +target variable GlobalVariable + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit b/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit new file mode 100644 index 000000000000..cafb863d85fe --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit @@ -0,0 +1,16 @@ +settings set auto-one-line-summaries false + +target variable -T ClassWithPaddingInstance +target variable -T ClassNoPaddingInstance +target variable -T DC +target variable -T EBOC +target variable -T PBC + +target variable -T UnnamedClassInstance + +target variable -T PointersInstance +target variable -T ReferencesInstance + +target modules dump ast + +quit
\ No newline at end of file diff --git a/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit b/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit new file mode 100644 index 000000000000..4af8b658742b --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit @@ -0,0 +1,222 @@ +target variable BFalse +target variable BTrue +target variable CA +target variable CZ +target variable SCa +target variable SCz +target variable UC24 +target variable UC42 +target variable C16_24 +target variable C32_42 +target variable WC1 +target variable WCP +target variable SMax +target variable SMin +target variable USMax +target variable USMin +target variable IMax +target variable IMin +target variable UIMax +target variable UIMin +target variable LMax +target variable LMin +target variable ULMax +target variable ULMin +target variable LLMax +target variable LLMin +target variable ULLMax +target variable ULLMin +target variable F +target variable D + +target variable CBFalse +target variable CBTrue +target variable CCA +target variable CCZ +target variable CSCa +target variable CSCz +target variable CUC24 +target variable CUC42 +target variable CC16_24 +target variable CC32_42 +target variable CWC1 +target variable CWCP +target variable CSMax +target variable CSMin +target variable CUSMax +target variable CUSMin +target variable CIMax +target variable CIMin +target variable CUIMax +target variable CUIMin +target variable CLMax +target variable CLMin +target variable CULMax +target variable CULMin +target variable CLLMax +target variable CLLMin +target variable CULLMax +target variable CULLMin +target variable CF +target variable CD + +target variable ConstexprBFalse +target variable ConstexprBTrue +target variable ConstexprCA +target variable ConstexprCZ +target variable ConstexprSCa +target variable ConstexprSCz +target variable ConstexprUC24 +target variable ConstexprUC42 +target variable ConstexprC16_24 +target variable ConstexprC32_42 +target variable ConstexprWC1 +target variable ConstexprWCP +target variable ConstexprSMax +target variable ConstexprSMin +target variable ConstexprUSMax +target variable ConstexprUSMin +target variable ConstexprIMax +target variable ConstexprIMin +target variable ConstexprUIMax +target variable ConstexprUIMin +target variable ConstexprLMax +target variable ConstexprLMin +target variable ConstexprULMax +target variable ConstexprULMin +target variable ConstexprLLMax +target variable ConstexprLLMin +target variable ConstexprULLMax +target variable ConstexprULLMin +target variable ConstexprF +target variable ConstexprD + +target variable PBFalse +target variable PBTrue +target variable PCA +target variable PCZ +target variable PSCa +target variable PSCz +target variable PUC24 +target variable PUC42 +target variable PC16_24 +target variable PC32_42 +target variable PWC1 +target variable PWCP +target variable PSMax +target variable PSMin +target variable PUSMax +target variable PUSMin +target variable PIMax +target variable PIMin +target variable PUIMax +target variable PUIMin +target variable PLMax +target variable PLMin +target variable PULMax +target variable PULMin +target variable PLLMax +target variable PLLMin +target variable PULLMax +target variable PULLMin +target variable PF +target variable PD + +target variable CPBFalse +target variable CPBTrue +target variable CPCA +target variable CPCZ +target variable CPSCa +target variable CPSCz +target variable CPUC24 +target variable CPUC42 +target variable CPC16_24 +target variable CPC32_42 +target variable CPWC1 +target variable CPWCP +target variable CPSMax +target variable CPSMin +target variable CPUSMax +target variable CPUSMin +target variable CPIMax +target variable CPIMin +target variable CPUIMax +target variable CPUIMin +target variable CPLMax +target variable CPLMin +target variable CPULMax +target variable CPULMin +target variable CPLLMax +target variable CPLLMin +target variable CPULLMax +target variable CPULLMin +target variable CPF +target variable CPD + +target variable RBFalse +target variable RBTrue +target variable RCA +target variable RCZ +target variable RSCa +target variable RSCz +target variable RUC24 +target variable RUC42 +target variable RSMax +target variable RSMin +target variable RUSMax +target variable RUSMin +target variable RIMax +target variable RIMin +target variable RUIMax +target variable RUIMin +target variable RLMax +target variable RLMin +target variable RULMax +target variable RULMin +target variable RLLMax +target variable RLLMin +target variable RULLMax +target variable RULLMin +target variable RF +target variable RD + +target variable CRBFalse +target variable CRBTrue +target variable CRCA +target variable CRCZ +target variable CRSCa +target variable CRSCz +target variable CRUC24 +target variable CRUC42 +target variable CRSMax +target variable CRSMin +target variable CRUSMax +target variable CRUSMin +target variable CRIMax +target variable CRIMin +target variable CRUIMax +target variable CRUIMin +target variable CRLMax +target variable CRLMin +target variable CRULMax +target variable CRULMin +target variable CRLLMax +target variable CRLLMin +target variable CRULLMax +target variable CRULLMin +target variable CRF +target variable CRD + +target variable RC16_24 +target variable RC32_42 +target variable RWC1 +target variable RWCP +target variable CRC16_24 +target variable CRC32_42 +target variable CRWC1 +target variable CRWCP + +target modules dump ast + + +quit
\ No newline at end of file diff --git a/lit/SymbolFile/NativePDB/Inputs/local-variables.lldbinit b/lit/SymbolFile/NativePDB/Inputs/local-variables.lldbinit new file mode 100644 index 000000000000..0d7371e86f1c --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/local-variables.lldbinit @@ -0,0 +1,32 @@ +break set -n main +run a b c d e f g +p argc +step +p SomeLocal +step +p Param1 +p Param2 +step +p Param1 +p Param2 +p Local1 +step +p Param1 +p Param2 +p Local1 +p Local2 +step +p Param1 +p Param2 +p Local1 +p Local2 +step +p Param1 +p Param2 +p Local1 +p Local2 +continue + +target modules dump ast + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit b/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit new file mode 100644 index 000000000000..466df81fc421 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/nested-types.lldbinit @@ -0,0 +1,13 @@ +settings set auto-one-line-summaries false + +target variable -T GlobalA +target variable -T GlobalB +target variable -T GlobalC +target variable -T GlobalD +target variable -T GlobalE +target variable -T GlobalF +target variable -T GlobalG +target variable -T GlobalH +target variable -T GlobalEnum + +target modules dump ast diff --git a/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit b/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit new file mode 100644 index 000000000000..1a50d808cdc2 --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit @@ -0,0 +1,25 @@ +target variable GlobalLUEA +target variable GlobalLUEB +target variable GlobalLUEC + +target variable GlobalLSEA +target variable GlobalLSEB +target variable GlobalLSEC + +target variable GlobalUEA +target variable GlobalUEB +target variable GlobalUEC + +target variable GlobalSEA +target variable GlobalSEB +target variable GlobalSEC + +target variable GlobalSUEA +target variable GlobalSUEB +target variable GlobalSUEC + +target variable GlobalSSEA +target variable GlobalSSEB +target variable GlobalSSEC + +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/s_constant.s b/lit/SymbolFile/NativePDB/Inputs/s_constant.s new file mode 100644 index 000000000000..553a5ce06dbf --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/s_constant.s @@ -0,0 +1,971 @@ + .text + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 +.set @feat.00, 0 + .intel_syntax noprefix + .def main; + .scl 2; + .type 32; + .endef + .globl main # -- Begin function main + .p2align 4, 0x90 +main: # @main +.Lfunc_begin0: + .cv_func_id 0 + .cv_file 1 "D:\\src\\llvm-mono\\lldb\\lit\\SymbolFile\\NativePDB\\s_constant.cpp" "7F1DA683A9B72A1360C1FDEDD7550E06" 1 + .cv_loc 0 1 79 0 # D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp:79:0 +.seh_proc main +# %bb.0: # %entry + sub rsp, 24 + .seh_stackalloc 24 + .seh_endprologue + xor eax, eax + mov dword ptr [rsp + 20], 0 + mov qword ptr [rsp + 8], rdx + mov dword ptr [rsp + 4], ecx +.Ltmp0: + .cv_loc 0 1 80 0 # D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp:80:0 + add rsp, 24 + ret +.Ltmp1: +.Lfunc_end0: + .seh_handlerdata + .text + .seh_endproc + # -- End function + .section .rdata,"dr" + .p2align 3 # @GlobalLUEA +GlobalLUEA: + .quad 0 # 0x0 + + .p2align 3 # @GlobalLUEB +GlobalLUEB: + .quad 1000 # 0x3e8 + + .p2align 3 # @GlobalLUEC +GlobalLUEC: + .quad -16 # 0xfffffffffffffff0 + + .p2align 3 # @GlobalLSEA +GlobalLSEA: + .quad 0 # 0x0 + + .p2align 3 # @GlobalLSEB +GlobalLSEB: + .quad 9223372036854775000 # 0x7ffffffffffffcd8 + + .p2align 3 # @GlobalLSEC +GlobalLSEC: + .quad -9223372036854775000 # 0x8000000000000328 + + .p2align 2 # @GlobalUEA +GlobalUEA: + .long 0 # 0x0 + + .p2align 2 # @GlobalUEB +GlobalUEB: + .long 1000 # 0x3e8 + + .p2align 2 # @GlobalUEC +GlobalUEC: + .long 4294000000 # 0xfff13d80 + + .p2align 2 # @GlobalSEA +GlobalSEA: + .long 0 # 0x0 + + .p2align 2 # @GlobalSEB +GlobalSEB: + .long 2147000000 # 0x7ff89ec0 + + .p2align 2 # @GlobalSEC +GlobalSEC: + .long 2147967296 # 0x80076140 + +GlobalSUEA: # @GlobalSUEA + .byte 0 # 0x0 + +GlobalSUEB: # @GlobalSUEB + .byte 100 # 0x64 + +GlobalSUEC: # @GlobalSUEC + .byte 200 # 0xc8 + +GlobalSSEA: # @GlobalSSEA + .byte 0 # 0x0 + +GlobalSSEB: # @GlobalSSEB + .byte 100 # 0x64 + +GlobalSSEC: # @GlobalSSEC + .byte 156 # 0x9c + + .section .drectve,"yn" + .ascii " /DEFAULTLIB:libcmt.lib" + .ascii " /DEFAULTLIB:oldnames.lib" + .section .debug$S,"dr" + .p2align 2 + .long 4 # Debug section magic + .long 241 + .long .Ltmp3-.Ltmp2 # Subsection size +.Ltmp2: + .short .Ltmp5-.Ltmp4 # Record length +.Ltmp4: + .short 4412 # Record kind: S_COMPILE3 + .long 1 # Flags and language + .short 208 # CPUType + .short 8 # Frontend version + .short 0 + .short 0 + .short 0 + .short 8000 # Backend version + .short 0 + .short 0 + .short 0 + .asciz "clang version 8.0.0 " # Null-terminated compiler version string +.Ltmp5: +.Ltmp3: + .p2align 2 + .long 241 # Symbol subsection for main + .long .Ltmp7-.Ltmp6 # Subsection size +.Ltmp6: + .short .Ltmp9-.Ltmp8 # Record length +.Ltmp8: + .short 4423 # Record kind: S_GPROC32_ID + .long 0 # PtrParent + .long 0 # PtrEnd + .long 0 # PtrNext + .long .Lfunc_end0-main # Code size + .long 0 # Offset after prologue + .long 0 # Offset before epilogue + .long 4099 # Function type index + .secrel32 main # Function section relative address + .secidx main # Function section index + .byte 0 # Flags + .asciz "main" # Function name +.Ltmp9: + .short .Ltmp11-.Ltmp10 # Record length +.Ltmp10: + .short 4114 # Record kind: S_FRAMEPROC + .long 24 # FrameSize + .long 0 # Padding + .long 0 # Offset of padding + .long 0 # Bytes of callee saved registers + .long 0 # Exception handler offset + .short 0 # Exception handler section + .long 81920 # Flags (defines frame register) +.Ltmp11: + .short .Ltmp13-.Ltmp12 # Record length +.Ltmp12: + .short 4414 # Record kind: S_LOCAL + .long 116 # TypeIndex + .short 1 # Flags + .asciz "argc" +.Ltmp13: + .cv_def_range .Ltmp0 .Ltmp1, "B\021\004\000\000\000" + .short .Ltmp15-.Ltmp14 # Record length +.Ltmp14: + .short 4414 # Record kind: S_LOCAL + .long 4096 # TypeIndex + .short 1 # Flags + .asciz "argv" +.Ltmp15: + .cv_def_range .Ltmp0 .Ltmp1, "B\021\b\000\000\000" + .short 2 # Record length + .short 4431 # Record kind: S_PROC_ID_END +.Ltmp7: + .p2align 2 + .cv_linetable 0, main, .Lfunc_end0 + .long 241 # Symbol subsection for globals + .long .Ltmp17-.Ltmp16 # Subsection size +.Ltmp16: + .short .Ltmp19-.Ltmp18 # Record length +.Ltmp18: + .short 4359 # Record kind: S_CONSTANT + .long 4104 # Type + .short 0 # Value + .asciz "GlobalLUEA" # Name +.Ltmp19: + .short .Ltmp21-.Ltmp20 # Record length +.Ltmp20: + .short 4359 # Record kind: S_CONSTANT + .long 4104 # Type + .short 1000 # Value + .asciz "GlobalLUEB" # Name +.Ltmp21: + .short .Ltmp23-.Ltmp22 # Record length +.Ltmp22: + .short 4359 # Record kind: S_CONSTANT + .long 4104 # Type + .byte 0x00, 0x80, 0xf0 # Value + .asciz "GlobalLUEC" # Name +.Ltmp23: + .short .Ltmp25-.Ltmp24 # Record length +.Ltmp24: + .short 4359 # Record kind: S_CONSTANT + .long 4108 # Type + .byte 0x00, 0x00 # Value + .asciz "GlobalLSEA" # Name +.Ltmp25: + .short .Ltmp27-.Ltmp26 # Record length +.Ltmp26: + .short 4359 # Record kind: S_CONSTANT + .long 4108 # Type + .byte 0x0A, 0x80, 0xD8, 0xFC # Value + .byte 0xFF, 0xFF, 0xFF, 0xFF + .byte 0xFF, 0x7F + .asciz "GlobalLSEB" # Name +.Ltmp27: + .short .Ltmp29-.Ltmp28 # Record length +.Ltmp28: + .short 4359 # Record kind: S_CONSTANT + .long 4108 # Type + .byte 0x09, 0x80, 0x28, 0x03 # Value + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x80 + .asciz "GlobalLSEC" # Name +.Ltmp29: + .short .Ltmp31-.Ltmp30 # Record length +.Ltmp30: + .short 4359 # Record kind: S_CONSTANT + .long 4112 # Type + .byte 0x00, 0x00 # Value + .asciz "GlobalUEA" # Name +.Ltmp31: + .short .Ltmp33-.Ltmp32 # Record length +.Ltmp32: + .short 4359 # Record kind: S_CONSTANT + .long 4112 # Type + .byte 0xe8, 0x03 # Value + .asciz "GlobalUEB" # Name +.Ltmp33: + .short .Ltmp35-.Ltmp34 # Record length +.Ltmp34: + .short 4359 # Record kind: S_CONSTANT + .long 4112 # Type + .byte 0x04, 0x80, 0x80, 0x3d # Value + .byte 0xf1, 0xff + .asciz "GlobalUEC" # Name +.Ltmp35: + .short .Ltmp37-.Ltmp36 # Record length +.Ltmp36: + .short 4359 # Record kind: S_CONSTANT + .long 4116 # Type + .byte 0x00, 0x00 # Value + .asciz "GlobalSEA" # Name +.Ltmp37: + .short .Ltmp39-.Ltmp38 # Record length +.Ltmp38: + .short 4359 # Record kind: S_CONSTANT + .long 4116 # Type + .byte 0x04, 0x80, 0xc0, 0x9e # Value + .byte 0xf8, 0x7f + .asciz "GlobalSEB" # Name +.Ltmp39: + .short .Ltmp41-.Ltmp40 # Record length +.Ltmp40: + .short 4359 # Record kind: S_CONSTANT + .long 4116 # Type + .byte 0x03, 0x80, 0x40, 0x61 # Value + .byte 0x07, 0x80 + .asciz "GlobalSEC" # Name +.Ltmp41: + .short .Ltmp43-.Ltmp42 # Record length +.Ltmp42: + .short 4359 # Record kind: S_CONSTANT + .long 4120 # Type + .byte 0x00, 0x00 # Value + .asciz "GlobalSUEA" # Name +.Ltmp43: + .short .Ltmp45-.Ltmp44 # Record length +.Ltmp44: + .short 4359 # Record kind: S_CONSTANT + .long 4120 # Type + .byte 0x64, 0x00 # Value + .asciz "GlobalSUEB" # Name +.Ltmp45: + .short .Ltmp47-.Ltmp46 # Record length +.Ltmp46: + .short 4359 # Record kind: S_CONSTANT + .long 4120 # Type + .byte 0xc8, 0x00 # Value + .asciz "GlobalSUEC" # Name +.Ltmp47: + .short .Ltmp49-.Ltmp48 # Record length +.Ltmp48: + .short 4359 # Record kind: S_CONSTANT + .long 4124 # Type + .byte 0x00, 0x00 # Value + .asciz "GlobalSSEA" # Name +.Ltmp49: + .short .Ltmp51-.Ltmp50 # Record length +.Ltmp50: + .short 4359 # Record kind: S_CONSTANT + .long 4124 # Type + .byte 0x64, 0x00 # Value + .asciz "GlobalSSEB" # Name +.Ltmp51: + .short .Ltmp53-.Ltmp52 # Record length +.Ltmp52: + .short 4359 # Record kind: S_CONSTANT + .long 4124 # Type + .byte 0x00, 0x80, 0x9c # Value + .asciz "GlobalSSEC" # Name +.Ltmp53: +.Ltmp17: + .p2align 2 + .cv_filechecksums # File index to string table offset subsection + .cv_stringtable # String table + .long 241 + .long .Ltmp55-.Ltmp54 # Subsection size +.Ltmp54: + .short 6 # Record length + .short 4428 # Record kind: S_BUILDINFO + .long 4127 # LF_BUILDINFO index +.Ltmp55: + .p2align 2 + .section .debug$T,"dr" + .p2align 2 + .long 4 # Debug section magic + # Pointer (0x1000) { + # TypeLeafKind: LF_POINTER (0x1002) + # PointeeType: char* (0x670) + # PointerAttributes: 0x1000C + # PtrType: Near64 (0xC) + # PtrMode: Pointer (0x0) + # IsFlat: 0 + # IsConst: 0 + # IsVolatile: 0 + # IsUnaligned: 0 + # IsRestrict: 0 + # SizeOf: 8 + # } + .byte 0x0a, 0x00, 0x02, 0x10 + .byte 0x70, 0x06, 0x00, 0x00 + .byte 0x0c, 0x00, 0x01, 0x00 + # ArgList (0x1001) { + # TypeLeafKind: LF_ARGLIST (0x1201) + # NumArgs: 2 + # Arguments [ + # ArgType: int (0x74) + # ArgType: char** (0x1000) + # ] + # } + .byte 0x0e, 0x00, 0x01, 0x12 + .byte 0x02, 0x00, 0x00, 0x00 + .byte 0x74, 0x00, 0x00, 0x00 + .byte 0x00, 0x10, 0x00, 0x00 + # Procedure (0x1002) { + # TypeLeafKind: LF_PROCEDURE (0x1008) + # ReturnType: int (0x74) + # CallingConvention: NearC (0x0) + # FunctionOptions [ (0x0) + # ] + # NumParameters: 2 + # ArgListType: (int, char**) (0x1001) + # } + .byte 0x0e, 0x00, 0x08, 0x10 + .byte 0x74, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x02, 0x00 + .byte 0x01, 0x10, 0x00, 0x00 + # FuncId (0x1003) { + # TypeLeafKind: LF_FUNC_ID (0x1601) + # ParentScope: 0x0 + # FunctionType: int (int, char**) (0x1002) + # Name: main + # } + .byte 0x12, 0x00, 0x01, 0x16 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x10, 0x00, 0x00 + .byte 0x6d, 0x61, 0x69, 0x6e + .byte 0x00, 0xf3, 0xf2, 0xf1 + # FieldList (0x1004) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: LUE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 1000 + # Name: LUE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 18446744073709551600 + # Name: LUE_C + # } + # } + .byte 0x2e, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x4c, 0x55 + .byte 0x45, 0x5f, 0x41, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0xe8, 0x03, 0x4c, 0x55 + .byte 0x45, 0x5f, 0x42, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x0a, 0x80, 0xf0, 0xff + .byte 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0x4c, 0x55 + .byte 0x45, 0x5f, 0x43, 0x00 + # Enum (0x1005) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: unsigned __int64 (0x23) + # FieldListType: <field list> (0x1004) + # Name: A::B::C::LargeUnsignedEnum + # LinkageName: .?AW4LargeUnsignedEnum@C@B@A@@ + # } + .byte 0x4a, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x23, 0x00, 0x00, 0x00 + .byte 0x04, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x4c, 0x61, 0x72 + .byte 0x67, 0x65, 0x55, 0x6e + .byte 0x73, 0x69, 0x67, 0x6e + .byte 0x65, 0x64, 0x45, 0x6e + .byte 0x75, 0x6d, 0x00, 0x2e + .byte 0x3f, 0x41, 0x57, 0x34 + .byte 0x4c, 0x61, 0x72, 0x67 + .byte 0x65, 0x55, 0x6e, 0x73 + .byte 0x69, 0x67, 0x6e, 0x65 + .byte 0x64, 0x45, 0x6e, 0x75 + .byte 0x6d, 0x40, 0x43, 0x40 + .byte 0x42, 0x40, 0x41, 0x40 + .byte 0x40, 0x00, 0xf2, 0xf1 + # StringId (0x1006) { + # TypeLeafKind: LF_STRING_ID (0x1605) + # Id: 0x0 + # StringData: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp + # } + .byte 0x46, 0x00, 0x05, 0x16 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x44, 0x3a, 0x5c, 0x73 + .byte 0x72, 0x63, 0x5c, 0x6c + .byte 0x6c, 0x76, 0x6d, 0x2d + .byte 0x6d, 0x6f, 0x6e, 0x6f + .byte 0x5c, 0x6c, 0x6c, 0x64 + .byte 0x62, 0x5c, 0x6c, 0x69 + .byte 0x74, 0x5c, 0x53, 0x79 + .byte 0x6d, 0x62, 0x6f, 0x6c + .byte 0x46, 0x69, 0x6c, 0x65 + .byte 0x5c, 0x4e, 0x61, 0x74 + .byte 0x69, 0x76, 0x65, 0x50 + .byte 0x44, 0x42, 0x5c, 0x73 + .byte 0x5f, 0x63, 0x6f, 0x6e + .byte 0x73, 0x74, 0x61, 0x6e + .byte 0x74, 0x2e, 0x63, 0x70 + .byte 0x70, 0x00, 0xf2, 0xf1 + # UdtSourceLine (0x1007) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::LargeUnsignedEnum (0x1005) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 14 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x05, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00 + # Modifier (0x1008) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::LargeUnsignedEnum (0x1005) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x05, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # FieldList (0x1009) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: LSE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 9223372036854775000 + # Name: LSE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 9223372036854776616 + # Name: LSE_C + # } + # } + .byte 0x36, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x4c, 0x53 + .byte 0x45, 0x5f, 0x41, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x0a, 0x80, 0xd8, 0xfc + .byte 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0x7f, 0x4c, 0x53 + .byte 0x45, 0x5f, 0x42, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x0a, 0x80, 0x28, 0x03 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x80, 0x4c, 0x53 + .byte 0x45, 0x5f, 0x43, 0x00 + # Enum (0x100A) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: __int64 (0x13) + # FieldListType: <field list> (0x1009) + # Name: A::B::C::LargeSignedEnum + # LinkageName: .?AW4LargeSignedEnum@C@B@A@@ + # } + .byte 0x46, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x13, 0x00, 0x00, 0x00 + .byte 0x09, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x4c, 0x61, 0x72 + .byte 0x67, 0x65, 0x53, 0x69 + .byte 0x67, 0x6e, 0x65, 0x64 + .byte 0x45, 0x6e, 0x75, 0x6d + .byte 0x00, 0x2e, 0x3f, 0x41 + .byte 0x57, 0x34, 0x4c, 0x61 + .byte 0x72, 0x67, 0x65, 0x53 + .byte 0x69, 0x67, 0x6e, 0x65 + .byte 0x64, 0x45, 0x6e, 0x75 + .byte 0x6d, 0x40, 0x43, 0x40 + .byte 0x42, 0x40, 0x41, 0x40 + .byte 0x40, 0x00, 0xf2, 0xf1 + # UdtSourceLine (0x100B) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::LargeSignedEnum (0x100A) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 20 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x0a, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x14, 0x00, 0x00, 0x00 + # Modifier (0x100C) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::LargeSignedEnum (0x100A) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x0a, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # FieldList (0x100D) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: UE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 1000 + # Name: UE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 4294000000 + # Name: UE_C + # } + # } + .byte 0x2a, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x55, 0x45 + .byte 0x5f, 0x41, 0x00, 0xf1 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0xe8, 0x03, 0x55, 0x45 + .byte 0x5f, 0x42, 0x00, 0xf1 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x04, 0x80, 0x80, 0x3d + .byte 0xf1, 0xff, 0x55, 0x45 + .byte 0x5f, 0x43, 0x00, 0xf1 + # Enum (0x100E) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: unsigned (0x75) + # FieldListType: <field list> (0x100D) + # Name: A::B::C::UnsignedEnum + # LinkageName: .?AW4UnsignedEnum@C@B@A@@ + # } + .byte 0x3e, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x75, 0x00, 0x00, 0x00 + .byte 0x0d, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x55, 0x6e, 0x73 + .byte 0x69, 0x67, 0x6e, 0x65 + .byte 0x64, 0x45, 0x6e, 0x75 + .byte 0x6d, 0x00, 0x2e, 0x3f + .byte 0x41, 0x57, 0x34, 0x55 + .byte 0x6e, 0x73, 0x69, 0x67 + .byte 0x6e, 0x65, 0x64, 0x45 + .byte 0x6e, 0x75, 0x6d, 0x40 + .byte 0x43, 0x40, 0x42, 0x40 + .byte 0x41, 0x40, 0x40, 0x00 + # UdtSourceLine (0x100F) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::UnsignedEnum (0x100E) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 26 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x0e, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x1a, 0x00, 0x00, 0x00 + # Modifier (0x1010) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::UnsignedEnum (0x100E) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x0e, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # FieldList (0x1011) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: SE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 2147000000 + # Name: SE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 18446744071562551616 + # Name: SE_C + # } + # } + .byte 0x32, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x53, 0x45 + .byte 0x5f, 0x41, 0x00, 0xf1 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x04, 0x80, 0xc0, 0x9e + .byte 0xf8, 0x7f, 0x53, 0x45 + .byte 0x5f, 0x42, 0x00, 0xf1 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x0a, 0x80, 0x40, 0x61 + .byte 0x07, 0x80, 0xff, 0xff + .byte 0xff, 0xff, 0x53, 0x45 + .byte 0x5f, 0x43, 0x00, 0xf1 + # Enum (0x1012) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: int (0x74) + # FieldListType: <field list> (0x1011) + # Name: A::B::C::SignedEnum + # LinkageName: .?AW4SignedEnum@C@B@A@@ + # } + .byte 0x3a, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x74, 0x00, 0x00, 0x00 + .byte 0x11, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x53, 0x69, 0x67 + .byte 0x6e, 0x65, 0x64, 0x45 + .byte 0x6e, 0x75, 0x6d, 0x00 + .byte 0x2e, 0x3f, 0x41, 0x57 + .byte 0x34, 0x53, 0x69, 0x67 + .byte 0x6e, 0x65, 0x64, 0x45 + .byte 0x6e, 0x75, 0x6d, 0x40 + .byte 0x43, 0x40, 0x42, 0x40 + .byte 0x41, 0x40, 0x40, 0x00 + # UdtSourceLine (0x1013) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::SignedEnum (0x1012) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 32 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x12, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x20, 0x00, 0x00, 0x00 + # Modifier (0x1014) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::SignedEnum (0x1012) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x12, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # FieldList (0x1015) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: SUE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 100 + # Name: SUE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 200 + # Name: SUE_C + # } + # } + .byte 0x26, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x53, 0x55 + .byte 0x45, 0x5f, 0x41, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x64, 0x00, 0x53, 0x55 + .byte 0x45, 0x5f, 0x42, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0xc8, 0x00, 0x53, 0x55 + .byte 0x45, 0x5f, 0x43, 0x00 + # Enum (0x1016) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: unsigned char (0x20) + # FieldListType: <field list> (0x1015) + # Name: A::B::C::SmallUnsignedEnum + # LinkageName: .?AW4SmallUnsignedEnum@C@B@A@@ + # } + .byte 0x4a, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x20, 0x00, 0x00, 0x00 + .byte 0x15, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x53, 0x6d, 0x61 + .byte 0x6c, 0x6c, 0x55, 0x6e + .byte 0x73, 0x69, 0x67, 0x6e + .byte 0x65, 0x64, 0x45, 0x6e + .byte 0x75, 0x6d, 0x00, 0x2e + .byte 0x3f, 0x41, 0x57, 0x34 + .byte 0x53, 0x6d, 0x61, 0x6c + .byte 0x6c, 0x55, 0x6e, 0x73 + .byte 0x69, 0x67, 0x6e, 0x65 + .byte 0x64, 0x45, 0x6e, 0x75 + .byte 0x6d, 0x40, 0x43, 0x40 + .byte 0x42, 0x40, 0x41, 0x40 + .byte 0x40, 0x00, 0xf2, 0xf1 + # UdtSourceLine (0x1017) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::SmallUnsignedEnum (0x1016) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 38 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x16, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x26, 0x00, 0x00, 0x00 + # Modifier (0x1018) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::SmallUnsignedEnum (0x1016) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x16, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # FieldList (0x1019) { + # TypeLeafKind: LF_FIELDLIST (0x1203) + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 0 + # Name: SSE_A + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 100 + # Name: SSE_B + # } + # Enumerator { + # TypeLeafKind: LF_ENUMERATE (0x1502) + # AccessSpecifier: Public (0x3) + # EnumValue: 18446744073709551516 + # Name: SSE_C + # } + # } + .byte 0x2e, 0x00, 0x03, 0x12 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x00, 0x00, 0x53, 0x53 + .byte 0x45, 0x5f, 0x41, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x64, 0x00, 0x53, 0x53 + .byte 0x45, 0x5f, 0x42, 0x00 + .byte 0x02, 0x15, 0x03, 0x00 + .byte 0x0a, 0x80, 0x9c, 0xff + .byte 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0x53, 0x53 + .byte 0x45, 0x5f, 0x43, 0x00 + # Enum (0x101A) { + # TypeLeafKind: LF_ENUM (0x1507) + # NumEnumerators: 3 + # Properties [ (0x200) + # HasUniqueName (0x200) + # ] + # UnderlyingType: char (0x70) + # FieldListType: <field list> (0x1019) + # Name: A::B::C::SmallSignedEnum + # LinkageName: .?AW4SmallSignedEnum@C@B@A@@ + # } + .byte 0x46, 0x00, 0x07, 0x15 + .byte 0x03, 0x00, 0x00, 0x02 + .byte 0x70, 0x00, 0x00, 0x00 + .byte 0x19, 0x10, 0x00, 0x00 + .byte 0x41, 0x3a, 0x3a, 0x42 + .byte 0x3a, 0x3a, 0x43, 0x3a + .byte 0x3a, 0x53, 0x6d, 0x61 + .byte 0x6c, 0x6c, 0x53, 0x69 + .byte 0x67, 0x6e, 0x65, 0x64 + .byte 0x45, 0x6e, 0x75, 0x6d + .byte 0x00, 0x2e, 0x3f, 0x41 + .byte 0x57, 0x34, 0x53, 0x6d + .byte 0x61, 0x6c, 0x6c, 0x53 + .byte 0x69, 0x67, 0x6e, 0x65 + .byte 0x64, 0x45, 0x6e, 0x75 + .byte 0x6d, 0x40, 0x43, 0x40 + .byte 0x42, 0x40, 0x41, 0x40 + .byte 0x40, 0x00, 0xf2, 0xf1 + # UdtSourceLine (0x101B) { + # TypeLeafKind: LF_UDT_SRC_LINE (0x1606) + # UDT: A::B::C::SmallSignedEnum (0x101A) + # SourceFile: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\s_constant.cpp (0x1006) + # LineNumber: 44 + # } + .byte 0x0e, 0x00, 0x06, 0x16 + .byte 0x1a, 0x10, 0x00, 0x00 + .byte 0x06, 0x10, 0x00, 0x00 + .byte 0x2c, 0x00, 0x00, 0x00 + # Modifier (0x101C) { + # TypeLeafKind: LF_MODIFIER (0x1001) + # ModifiedType: A::B::C::SmallSignedEnum (0x101A) + # Modifiers [ (0x1) + # Const (0x1) + # ] + # } + .byte 0x0a, 0x00, 0x01, 0x10 + .byte 0x1a, 0x10, 0x00, 0x00 + .byte 0x01, 0x00, 0xf2, 0xf1 + # StringId (0x101D) { + # TypeLeafKind: LF_STRING_ID (0x1605) + # Id: 0x0 + # StringData: D:\\src\\llvmbuild\\ninja-x64 + # } + .byte 0x26, 0x00, 0x05, 0x16 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x44, 0x3a, 0x5c, 0x5c + .byte 0x73, 0x72, 0x63, 0x5c + .byte 0x5c, 0x6c, 0x6c, 0x76 + .byte 0x6d, 0x62, 0x75, 0x69 + .byte 0x6c, 0x64, 0x5c, 0x5c + .byte 0x6e, 0x69, 0x6e, 0x6a + .byte 0x61, 0x2d, 0x78, 0x36 + .byte 0x34, 0x00, 0xf2, 0xf1 + # StringId (0x101E) { + # TypeLeafKind: LF_STRING_ID (0x1605) + # Id: 0x0 + # StringData: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\variable.cpp + # } + .byte 0x42, 0x00, 0x05, 0x16 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x44, 0x3a, 0x5c, 0x73 + .byte 0x72, 0x63, 0x5c, 0x6c + .byte 0x6c, 0x76, 0x6d, 0x2d + .byte 0x6d, 0x6f, 0x6e, 0x6f + .byte 0x5c, 0x6c, 0x6c, 0x64 + .byte 0x62, 0x5c, 0x6c, 0x69 + .byte 0x74, 0x5c, 0x53, 0x79 + .byte 0x6d, 0x62, 0x6f, 0x6c + .byte 0x46, 0x69, 0x6c, 0x65 + .byte 0x5c, 0x4e, 0x61, 0x74 + .byte 0x69, 0x76, 0x65, 0x50 + .byte 0x44, 0x42, 0x5c, 0x76 + .byte 0x61, 0x72, 0x69, 0x61 + .byte 0x62, 0x6c, 0x65, 0x2e + .byte 0x63, 0x70, 0x70, 0x00 + # BuildInfo (0x101F) { + # TypeLeafKind: LF_BUILDINFO (0x1603) + # NumArgs: 5 + # Arguments [ + # ArgType: D:\\src\\llvmbuild\\ninja-x64 (0x101D) + # ArgType: 0x0 + # ArgType: D:\src\llvm-mono\lldb\lit\SymbolFile\NativePDB\variable.cpp (0x101E) + # ArgType: 0x0 + # ArgType: 0x0 + # ] + # } + .byte 0x1a, 0x00, 0x03, 0x16 + .byte 0x05, 0x00, 0x1d, 0x10 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x1e, 0x10 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0xf2, 0xf1 + + .addrsig + .addrsig_sym GlobalLUEA + .addrsig_sym GlobalLUEB + .addrsig_sym GlobalLUEC + .addrsig_sym GlobalLSEA + .addrsig_sym GlobalLSEB + .addrsig_sym GlobalLSEC + .addrsig_sym GlobalUEA + .addrsig_sym GlobalUEB + .addrsig_sym GlobalUEC + .addrsig_sym GlobalSEA + .addrsig_sym GlobalSEB + .addrsig_sym GlobalSEC + .addrsig_sym GlobalSUEA + .addrsig_sym GlobalSUEB + .addrsig_sym GlobalSUEC + .addrsig_sym GlobalSSEA + .addrsig_sym GlobalSSEB + .addrsig_sym GlobalSSEC diff --git a/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit b/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit new file mode 100644 index 000000000000..624ce5ba156b --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit @@ -0,0 +1,3 @@ +source list -n main +source list -n OvlGlobalFn +quit diff --git a/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit b/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit new file mode 100644 index 000000000000..c50e18101b1b --- /dev/null +++ b/lit/SymbolFile/NativePDB/Inputs/tag-types.lldbinit @@ -0,0 +1,8 @@ +type lookup -- Struct +type lookup -- Class +type lookup -- Union +type lookup -- Derived +type lookup -- Derived2 +type lookup -- EnumInt +type lookup -- EnumShort +type lookup -- InvalidType diff --git a/lit/SymbolFile/NativePDB/ast-functions-msvc.cpp b/lit/SymbolFile/NativePDB/ast-functions-msvc.cpp new file mode 100644 index 000000000000..b8154168aff3 --- /dev/null +++ b/lit/SymbolFile/NativePDB/ast-functions-msvc.cpp @@ -0,0 +1,7 @@ +// clang-format off +// REQUIRES: msvc + +// RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %S/ast-functions.cpp + +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %S/ast-functions.cpp diff --git a/lit/SymbolFile/NativePDB/ast-functions.cpp b/lit/SymbolFile/NativePDB/ast-functions.cpp new file mode 100644 index 000000000000..05c80c7298f7 --- /dev/null +++ b/lit/SymbolFile/NativePDB/ast-functions.cpp @@ -0,0 +1,29 @@ +// clang-format off +// REQUIRES: lld + +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s + +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s + +static int static_fn() { + return 42; +} + +int varargs_fn(int x, int y, ...) { + return x + y; +} + +int main(int argc, char **argv) { + return static_fn() + varargs_fn(argc, argc); +} + +// CHECK: TranslationUnitDecl +// CHECK-NEXT: |-FunctionDecl {{.*}} main 'int (int, char **)' +// CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int' +// CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **' +// CHECK-NEXT: |-FunctionDecl {{.*}} static_fn 'int ()' static +// CHECK-NEXT: |-FunctionDecl {{.*}} varargs_fn 'int (int, int, ...)' +// CHECK-NEXT: | |-ParmVarDecl {{.*}} x 'int' +// CHECK-NEXT: | `-ParmVarDecl {{.*}} y 'int' +// CHECK-NEXT: `-<undeserialized declarations> diff --git a/lit/SymbolFile/NativePDB/ast-types.cpp b/lit/SymbolFile/NativePDB/ast-types.cpp new file mode 100644 index 000000000000..224c7c26e846 --- /dev/null +++ b/lit/SymbolFile/NativePDB/ast-types.cpp @@ -0,0 +1,131 @@ +// clang-format off +// REQUIRES: lld + +// Test various interesting cases for AST reconstruction. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/ast-types.lldbinit 2>&1 | FileCheck %s + +// Test trivial versions of each tag type. +class TrivialC {}; +struct TrivialS {}; +union TrivialU {}; +enum TrivialE {TE_A}; + +// Test reconstruction of DeclContext hierarchies. +namespace A { + namespace B { + template<typename T> + struct C { + T ABCMember; + }; + + // Let's try a template specialization with a different implementation + template<> + struct C<void> { + void *ABCSpecializationMember; + }; + } + + // Let's make sure we can distinguish classes and namespaces. Also let's try + // a non-type template parameter. + template<int N> + struct C { + class D { + int ACDMember = 0; + C<N - 1> *CPtr = nullptr; + }; + }; + + struct D { + // Let's make a nested class with the same name as another nested class + // elsewhere, and confirm that they appear in the right DeclContexts in + // the AST. + struct E { + int ADDMember; + }; + }; +} + + +// Let's try an anonymous namespace. +namespace { + template<typename T> + struct Anonymous { + int AnonymousMember; + // And a nested class within an anonymous namespace + struct D { + int AnonymousDMember; + }; + }; +} + +TrivialC TC; +TrivialS TS; +TrivialU TU; +TrivialE TE; + +A::B::C<int> ABCInt; +A::B::C<float> ABCFloat; +A::B::C<void> ABCVoid; + +A::C<0> AC0; +A::C<-1> ACNeg1; + +A::C<0>::D AC0D; +A::C<-1>::D ACNeg1D; +A::D AD; +A::D::E ADE; + +// FIXME: Anonymous namespaces aren't working correctly. +Anonymous<int> AnonInt; +Anonymous<A::B::C<void>> AnonABCVoid; +Anonymous<A::B::C<int>>::D AnonABCVoidD; + +// FIXME: Enum size isn't being correctly determined. +// FIXME: Can't read memory for variable values. + +// CHECK: (TrivialC) TC = {} +// CHECK: (TrivialS) TS = {} +// CHECK: (TrivialU) TU = {} +// CHECK: (TrivialE) TE = TE_A +// CHECK: (A::B::C<int>) ABCInt = (ABCMember = 0) +// CHECK: (A::B::C<float>) ABCFloat = (ABCMember = 0) +// CHECK: (A::B::C<void>) ABCVoid = (ABCSpecializationMember = 0x{{0+}}) +// CHECK: (A::C<0>) AC0 = {} +// CHECK: (A::C<-1>) ACNeg1 = {} +// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x{{0+}}) +// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x{{0+}}) +// CHECK: (A::D) AD = {} +// CHECK: (A::D::E) ADE = (ADDMember = 0) +// CHECK: Dumping clang ast for 1 modules. +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition +// CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition +// CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition +// CHECK: |-EnumDecl {{.*}} TrivialE +// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'TrivialE' +// CHECK: |-NamespaceDecl {{.*}} A +// CHECK: | |-NamespaceDecl {{.*}} B +// CHECK: | | |-CXXRecordDecl {{.*}} struct C<int> definition +// CHECK: | | | `-FieldDecl {{.*}} ABCMember 'int' +// CHECK: | | |-CXXRecordDecl {{.*}} struct C<float> definition +// CHECK: | | | `-FieldDecl {{.*}} ABCMember 'float' +// CHECK: | | `-CXXRecordDecl {{.*}} struct C<void> definition +// CHECK: | | `-FieldDecl {{.*}} ABCSpecializationMember 'void *' +// CHECK: | |-CXXRecordDecl {{.*}} struct C<0> definition +// CHECK: | | `-CXXRecordDecl {{.*}} class D definition +// CHECK: | | |-FieldDecl {{.*}} ACDMember 'int' +// CHECK: | | `-FieldDecl {{.*}} CPtr 'A::C<-1> *' +// CHECK: | |-CXXRecordDecl {{.*}} struct C<-1> definition +// CHECK: | | `-CXXRecordDecl {{.*}} class D definition +// CHECK: | | |-FieldDecl {{.*}} ACDMember 'int' +// CHECK: | | `-FieldDecl {{.*}} CPtr 'A::C<-2> *' +// CHECK: | |-CXXRecordDecl {{.*}} struct C<-2> +// CHECK: | `-CXXRecordDecl {{.*}} struct D definition +// CHECK: | `-CXXRecordDecl {{.*}} struct E definition +// CHECK: | `-FieldDecl {{.*}} ADDMember 'int' + +int main(int argc, char **argv) { + return 0; +} diff --git a/lit/SymbolFile/NativePDB/bitfields.cpp b/lit/SymbolFile/NativePDB/bitfields.cpp new file mode 100644 index 000000000000..301ae3067d13 --- /dev/null +++ b/lit/SymbolFile/NativePDB/bitfields.cpp @@ -0,0 +1,60 @@ +// clang-format off +// REQUIRES: lld + +// Test various interesting cases for AST reconstruction. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s + +// Test trivial versions of each tag type. +struct Struct { + int A : 5 = 6; + int B : 7 = 8; + unsigned C : 3 = 2; + unsigned D : 15 = 12345; + char E : 1 = 0; + char F : 2 = 1; + char G : 3 = 2; + // H should be at offset 0 of a new byte. + char H : 3 = 3; +}; + +constexpr Struct TheStruct; + + +int main(int argc, char **argv) { + return TheStruct.A; +} + +// CHECK: (lldb) target variable -T TheStruct +// CHECK: (const Struct) TheStruct = { +// CHECK: (int:5) A = 6 +// CHECK: (int:7) B = 8 +// CHECK: (unsigned int:3) C = 2 +// CHECK: (unsigned int:15) D = 12345 +// CHECK: (char:1) E = '\0' +// CHECK: (char:2) F = '\x01' +// CHECK: (char:3) G = '\x02' +// CHECK: (char:3) H = '\x03' +// CHECK: } +// +// CHECK: target modules dump ast +// CHECK: Dumping clang ast for 1 modules. +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} struct Struct definition +// CHECK: | |-FieldDecl {{.*}} A 'int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 5 +// CHECK: | |-FieldDecl {{.*}} B 'int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 7 +// CHECK: | |-FieldDecl {{.*}} C 'unsigned int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3 +// CHECK: | |-FieldDecl {{.*}} D 'unsigned int' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 15 +// CHECK: | |-FieldDecl {{.*}} E 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 1 +// CHECK: | |-FieldDecl {{.*}} F 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 2 +// CHECK: | |-FieldDecl {{.*}} G 'char' +// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3 +// CHECK: | `-FieldDecl {{.*}} H 'char' +// CHECK: | `-IntegerLiteral {{.*}} 'int' 3 diff --git a/lit/SymbolFile/NativePDB/break-by-function.cpp b/lit/SymbolFile/NativePDB/break-by-function.cpp new file mode 100644 index 000000000000..c0c26f7617c9 --- /dev/null +++ b/lit/SymbolFile/NativePDB/break-by-function.cpp @@ -0,0 +1,57 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can set simple breakpoints using PDB on any platform. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/break-by-function.lldbinit | FileCheck %s + +// Use different indentation style for each overload so that the starting +// line is in a different place. + +int OvlGlobalFn(int X) { + return X + 42; +} + +int OvlGlobalFn(int X, int Y) { return X + Y + 42; } + +int OvlGlobalFn(int X, int Y, int Z) +{ + return X + Y + Z + 42; +} + +static int StaticFn(int X) { + return X + 42; +} + +int main(int argc, char **argv) { + // Make sure they don't get optimized out. + // Note the comments here, we want to make sure the line number reported + // for the breakpoint is the first actual line of code. + int Result = OvlGlobalFn(argc) + OvlGlobalFn(argc, argc) + + OvlGlobalFn(argc, argc, argc) + StaticFn(argc); + return Result; +} + + +// CHECK: (lldb) target create "{{.*}}break-by-function.cpp.tmp.exe" +// CHECK: Current executable set to '{{.*}}break-by-function.cpp.tmp.exe' +// CHECK: (lldb) break set -n main +// CHECK: Breakpoint 1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}} +// CHECK: (lldb) break set -n OvlGlobalFn +// CHECK: Breakpoint 2: 3 locations. +// CHECK: (lldb) break set -n StaticFn +// CHECK: Breakpoint 3: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}} +// CHECK: (lldb) break set -n DoesntExist +// CHECK: Breakpoint 4: no locations (pending). +// CHECK: (lldb) break list +// CHECK: Current breakpoints: +// CHECK: 1: name = 'main', locations = 1 +// CHECK: 1.1: where = break-by-function.cpp.tmp.exe`main + {{[0-9]+}} +// CHECK: 2: name = 'OvlGlobalFn', locations = 3 +// CHECK: 2.1: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} +// CHECK: 2.2: where = break-by-function.cpp.tmp.exe`OvlGlobalFn +// CHECK: 2.3: where = break-by-function.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} +// CHECK: 3: name = 'StaticFn', locations = 1 +// CHECK: 3.1: where = break-by-function.cpp.tmp.exe`StaticFn + {{[0-9]+}} +// CHECK: 4: name = 'DoesntExist', locations = 0 (pending) diff --git a/lit/SymbolFile/NativePDB/break-by-line.cpp b/lit/SymbolFile/NativePDB/break-by-line.cpp new file mode 100644 index 000000000000..ae3269f3719f --- /dev/null +++ b/lit/SymbolFile/NativePDB/break-by-line.cpp @@ -0,0 +1,26 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can set simple breakpoints using PDB on any platform. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/break-by-line.lldbinit | FileCheck %s + +// This is a separate test from break-by-function.cpp because this test is +// sensitive to edits in the source file. + +namespace NS { + int NamespaceFn(int X) { + return X + 42; + } +} + +int main(int argc, char **argv) { + return NS::NamespaceFn(argc); +} + + +// CHECK: (lldb) target create "{{.*}}break-by-line.cpp.tmp.exe" +// CHECK: Current executable set to '{{.*}}break-by-line.cpp.tmp.exe' +// CHECK: (lldb) break set -f break-by-line.cpp -l 14 +// CHECK: Breakpoint 1: where = break-by-line.cpp.tmp.exe`NS::NamespaceFn + {{[0-9]+}} at break-by-line.cpp:14 diff --git a/lit/SymbolFile/NativePDB/disassembly.cpp b/lit/SymbolFile/NativePDB/disassembly.cpp new file mode 100644 index 000000000000..3553f29ce55c --- /dev/null +++ b/lit/SymbolFile/NativePDB/disassembly.cpp @@ -0,0 +1,38 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can show disassembly and source. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s + +// Some context lines before +// the function. + +int foo() { return 42; } + +int main(int argc, char **argv) { + foo(); + return 0; +} + + +// CHECK: (lldb) disassemble --flavor=intel -m -n main +// CHECK: 12 int foo() { return 42; } +// CHECK-NEXT: 13 +// CHECK-NEXT: ** 14 int main(int argc, char **argv) { +// CHECK: disassembly.cpp.tmp.exe`main: +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>: sub rsp, 0x38 +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>: mov dword ptr [rsp + 0x34], 0x0 +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+12>: mov qword ptr [rsp + 0x28], rdx +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+17>: mov dword ptr [rsp + 0x24], ecx +// CHECK: ** 15 foo(); +// CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+21>: call {{.*}} ; foo at disassembly.cpp:12 +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+26>: xor ecx, ecx +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+28>: mov dword ptr [rsp + 0x20], eax +// CHECK: ** 16 return 0; +// CHECK-NEXT: 17 } +// CHECK-NEXT: 18 +// CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+32>: mov eax, ecx +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+34>: add rsp, 0x38 +// CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+38>: ret diff --git a/lit/SymbolFile/NativePDB/function-types-builtins.cpp b/lit/SymbolFile/NativePDB/function-types-builtins.cpp new file mode 100644 index 000000000000..ac76955197a2 --- /dev/null +++ b/lit/SymbolFile/NativePDB/function-types-builtins.cpp @@ -0,0 +1,214 @@ +// clang-format off +// REQUIRES: lld + +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/function-types-builtins.lldbinit | FileCheck %s + +// Test that we can display function signatures with simple builtin +// and pointer types. We do this by using `target variable` in lldb +// with global variables of type ptr-to-function or reference-to-function. +// This technique in general allows us to exercise most of LLDB's type +// system without a running process. + +template<typename T> +struct MakeResult { + static T result() { + return T{}; + } +}; + +template<typename T> +struct MakeResult<T&> { + static T& result() { + static T t; + return t; + } +}; + +template<typename T> +struct MakeResult<T&&> { + static T&& result() { + static T t; + return static_cast<T&&>(t); + } +}; + + +void nullary() {} + +template<typename Arg> +void unary(Arg) { } + +template<typename Ret, int N> +Ret unaryret() { return MakeResult<Ret>::result(); } + +template<typename A1, typename A2> +void binary(A1, A2) { } + +int varargs(int, int, ...) { return 0; } + +// Make sure to test every builtin type at least once for completeness. We +// test these in the globals-fundamentals.cpp when they are the types of +// variables but it's possible to imagine a situation where things behave +// differently as function arguments or return values than they do with +// global variables. + +// some interesting cases with argument types. +auto aa = &unary<bool>; +// CHECK: (void (*)(bool)) aa = {{.*}} +auto ab = &unary<char>; +// CHECK: (void (*)(char)) ab = {{.*}} +auto ac = &unary<signed char>; +// CHECK: (void (*)(signed char)) ac = {{.*}} +auto ad = &unary<unsigned char>; +// CHECK: (void (*)(unsigned char)) ad = {{.*}} +auto ae = &unary<char16_t>; +// CHECK: (void (*)(char16_t)) ae = {{.*}} +auto af = &unary<char32_t>; +// CHECK: (void (*)(char32_t)) af = {{.*}} +auto ag = &unary<wchar_t>; +// CHECK: (void (*)(wchar_t)) ag = {{.*}} +auto ah = &unary<short>; +// CHECK: (void (*)(short)) ah = {{.*}} +auto ai = &unary<unsigned short>; +// CHECK: (void (*)(unsigned short)) ai = {{.*}} +auto aj = &unary<int>; +// CHECK: (void (*)(int)) aj = {{.*}} +auto ak = &unary<unsigned int>; +// CHECK: (void (*)(unsigned int)) ak = {{.*}} +auto al = &unary<long>; +// CHECK: (void (*)(long)) al = {{.*}} +auto am = &unary<unsigned long>; +// CHECK: (void (*)(unsigned long)) am = {{.*}} +auto an = &unary<long long>; +// CHECK: (void (*)(long long)) an = {{.*}} +auto ao = &unary<unsigned long long>; +// CHECK: (void (*)(unsigned long long)) ao = {{.*}} +auto aq = &unary<float>; +// CHECK: (void (*)(float)) aq = {{.*}} +auto ar = &unary<double>; +// CHECK: (void (*)(double)) ar = {{.*}} + +auto as = &unary<int*>; +// CHECK: (void (*)(int *)) as = {{.*}} +auto at = &unary<int**>; +// CHECK: (void (*)(int **)) at = {{.*}} +auto au = &unary<int&>; +// CHECK: (void (*)(int &)) au = {{.*}} +auto av = &unary<int&&>; +// CHECK: (void (*)(int &&)) av = {{.*}} +auto aw = &unary<const int*>; +// CHECK: (void (*)(const int *)) aw = {{.*}} +auto ax = &unary<volatile int*>; +// CHECK: (void (*)(volatile int *)) ax = {{.*}} +auto ay = &unary<const volatile int*>; +// CHECK: (void (*)(const volatile int *)) ay = {{.*}} +auto az = &unary<void*&>; +// CHECK: (void (*)(void *&)) az = {{.*}} +auto aaa = &unary<int(&)[5]>; +// CHECK: (void (*)(int (&)[5])) aaa = {{.*}} +auto aab = &unary<int(*)[5]>; +// CHECK: (void (*)(int (*)[5])) aab = {{.*}} +auto aac = &unary<int(&&)[5]>; +// CHECK: (void (*)(int (&&)[5])) aac = {{.*}} +auto aad = &unary<int(*const)[5]>; +// CHECK: (void (*)(int (*)[5])) aad = {{.*}} + + +// same test cases with return values, note we can't overload on return type +// so we need to use a different instantiation each time. +auto ra = &unaryret<bool, 0>; +// CHECK: (bool (*)()) ra = {{.*}} +auto rb = &unaryret<char, 1>; +// CHECK: (char (*)()) rb = {{.*}} +auto rc = &unaryret<signed char, 2>; +// CHECK: (signed char (*)()) rc = {{.*}} +auto rd = &unaryret<unsigned char, 3>; +// CHECK: (unsigned char (*)()) rd = {{.*}} +auto re = &unaryret<char16_t, 4>; +// CHECK: (char16_t (*)()) re = {{.*}} +auto rf = &unaryret<char32_t, 5>; +// CHECK: (char32_t (*)()) rf = {{.*}} +auto rg = &unaryret<wchar_t, 6>; +// CHECK: (wchar_t (*)()) rg = {{.*}} +auto rh = &unaryret<short, 7>; +// CHECK: (short (*)()) rh = {{.*}} +auto ri = &unaryret<unsigned short, 8>; +// CHECK: (unsigned short (*)()) ri = {{.*}} +auto rj = &unaryret<int, 9>; +// CHECK: (int (*)()) rj = {{.*}} +auto rk = &unaryret<unsigned int, 10>; +// CHECK: (unsigned int (*)()) rk = {{.*}} +auto rl = &unaryret<long, 11>; +// CHECK: (long (*)()) rl = {{.*}} +auto rm = &unaryret<unsigned long, 12>; +// CHECK: (unsigned long (*)()) rm = {{.*}} +auto rn = &unaryret<long long, 13>; +// CHECK: (long long (*)()) rn = {{.*}} +auto ro = &unaryret<unsigned long long, 14>; +// CHECK: (unsigned long long (*)()) ro = {{.*}} +auto rq = &unaryret<float, 15>; +// CHECK: (float (*)()) rq = {{.*}} +auto rr = &unaryret<double, 16>; +// CHECK: (double (*)()) rr = {{.*}} + +auto rs = &unaryret<int*, 17>; +// CHECK: (int *(*)()) rs = {{.*}} +auto rt = &unaryret<int**, 18>; +// CHECK: (int **(*)()) rt = {{.*}} +auto ru = &unaryret<int&, 19>; +// CHECK: (int &(*)()) ru = {{.*}} +auto rv = &unaryret<int&&, 20>; +// CHECK: (int &&(*)()) rv = {{.*}} +auto rw = &unaryret<const int*, 21>; +// CHECK: (const int *(*)()) rw = {{.*}} +auto rx = &unaryret<volatile int*, 22>; +// CHECK: (volatile int *(*)()) rx = {{.*}} +auto ry = &unaryret<const volatile int*, 23>; +// CHECK: (const volatile int *(*)()) ry = {{.*}} +auto rz = &unaryret<void*&, 24>; +// CHECK: (void *&(*)()) rz = {{.*}} + +// FIXME: This output doesn't really look correct. It should probably be +// formatting this as `int(&)[5] (*)()`. +auto raa = &unaryret<int(&)[5], 25>; +// CHECK: (int (&(*)())[5]) raa = {{.*}} +auto rab = &unaryret<int(*)[5], 26>; +// CHECK: (int (*(*)())[5]) rab = {{.*}} +auto rac = &unaryret<int(&&)[5], 27>; +// CHECK: (int (&&(*)())[5]) rac = {{.*}} +auto rad = &unaryret<int(*const)[5], 28>; +// CHECK: (int (*const (*)())[5]) rad = {{.*}} + + + +// Function references, we only need a couple of these since most of the +// interesting cases are already tested. +auto &ref = unary<bool>; +// CHECK: (void (&)(bool)) ref = {{.*}} (&::ref = <Unable to determine byte size.>) +auto &ref2 = unary<volatile int*>; +// CHECK: (void (&)(volatile int *)) ref2 = {{.*}} (&::ref2 = <Unable to determine byte size.>) +auto &ref3 = varargs; +// CHECK: (int (&)(int, int, ...)) ref3 = {{.*}} (&::ref3 = <Unable to determine byte size.>) + +// Multiple arguments, as before, just something to make sure it works. +auto binp = &binary<int*, const int*>; +// CHECK: (void (*)(int *, const int *)) binp = {{.*}} +auto &binr = binary<int*, const int*>; +// CHECK: (void (&)(int *, const int *)) binr = {{.*}} (&::binr = <Unable to determine byte size.>) + +// And finally, a function with no arguments. +auto null = &nullary; +// CHECK: (void (*)()) null = {{.*}} + +// FIXME: These currently don't work because clang-cl emits incorrect debug info +// for std::nullptr_t. We should fix these in clang-cl. +auto rae = &unaryret<decltype(nullptr), 29>; +// CHECK: (nullptr_t (*)()) rae = {{.*}} +auto aae = &unary<decltype(nullptr)>; +// CHECK: (void (*)(nullptr_t)) aae = {{.*}} + +int main(int argc, char **argv) { + return 0; +} diff --git a/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp b/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp new file mode 100644 index 000000000000..cd13159d508c --- /dev/null +++ b/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp @@ -0,0 +1,32 @@ +// clang-format off +// REQUIRES: lld + +// RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s + + +void __stdcall StdcallFn() {} +void __fastcall FastcallFn() {} +void __thiscall ThiscallFn() {} +void __cdecl CdeclFn() {} +void __vectorcall VectorcallFn() {} + +auto sfn = &StdcallFn; +// CHECK: (void (*)() __attribute__((stdcall))) sfn = {{.*}} + +auto ffn = &FastcallFn; +// CHECK: (void (*)() __attribute__((fastcall))) ffn = {{.*}} + +auto tfn = &ThiscallFn; +// CHECK: (void (*)() __attribute__((thiscall))) tfn = {{.*}} + +auto cfn = &CdeclFn; +// CHECK: (void (*)()) cfn = {{.*}} + +auto vfn = &VectorcallFn; +// CHECK: (void (*)() __attribute__((vectorcall))) vfn = {{.*}} + +int main(int argc, char **argv) { + return 0; +} diff --git a/lit/SymbolFile/NativePDB/function-types-classes.cpp b/lit/SymbolFile/NativePDB/function-types-classes.cpp new file mode 100644 index 000000000000..5670f9bd1e17 --- /dev/null +++ b/lit/SymbolFile/NativePDB/function-types-classes.cpp @@ -0,0 +1,141 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can display function signatures with class types. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/function-types-classes.lldbinit | FileCheck %s + +// This is just some unimportant helpers needed so that we can get reference and +// rvalue-reference types into return values. +template<typename T> +struct MakeResult { + static T result() { + return T{}; + } +}; + +template<typename T> +struct MakeResult<T&> { + static T& result() { + static T t; + return t; + } +}; + +template<typename T> +struct MakeResult<T&&> { + static T&& result() { + static T t; + return static_cast<T&&>(t); + } +}; + + +template<typename R> +R nullary() { return MakeResult<R>::result(); } + +template<typename R, typename A, typename B> +R three(A a, B b) { return MakeResult<R>::result(); } + +template<typename R, typename A, typename B, typename C> +R four(A a, B b, C c) { return MakeResult<R>::result(); } + +struct S {}; +class C {}; +union U {}; +enum E {}; + +namespace A { + namespace B { + // NS::NS + struct S { }; + } + + struct C { + // NS::Struct + struct S {}; + }; +} + +struct B { + struct A { + // Struct::Struct + struct S {}; + }; +}; + +// clang (incorrectly) doesn't emit debug information for outer classes +// unless they are instantiated. They should also be emitted if there +// is an inner class which is instantiated. +A::C ForceInstantiateAC; +B ForceInstantiateB; +B::A ForceInstantiateBA; + +template<typename T> +struct TC {}; + +// const and volatile modifiers +auto a = &four<S, C*, U&, E&&>; +// CHECK: (S (*)(C *, U &, E &&)) a = {{.*}} +auto b = &four<E, const S*, const C&, const U&&>; +// CHECK: (E (*)(const S *, const C &, const U &&)) b = {{.*}} +auto c = &four<U, volatile E*, volatile S&, volatile C&&>; +// CHECK: (U (*)(volatile E *, volatile S &, volatile C &&)) c = {{.*}} +auto d = &four<C, const volatile U*, const volatile E&, const volatile S&&>; +// CHECK: (C (*)(const volatile U *, const volatile E &, const volatile S &&)) d = {{.*}} + +// classes nested in namespaces and inner classes + +auto e = &three<A::B::S*, B::A::S*, A::C::S&>; +// CHECK: (A::B::S *(*)(B::A::S *, A::C::S &)) e = {{.*}} +auto f = &three<A::C::S&, A::B::S*, B::A::S*>; +// CHECK: (A::C::S &(*)(A::B::S *, B::A::S *)) f = {{.*}} +auto g = &three<B::A::S*, A::C::S&, A::B::S*>; +// CHECK: (B::A::S *(*)(A::C::S &, A::B::S *)) g = {{.*}} + +// parameter types that are themselves template instantiations. +auto h = &four<TC<void>, TC<int>, TC<TC<int>>, TC<A::B::S>>; +// CHECK: (TC<void> (*)(TC<int>, TC<TC<int>>, TC<A::B::S>)) h = {{.*}} + +auto i = &nullary<A::B::S>; +// CHECK: (A::B::S (*)()) i = {{.*}} + + +// Make sure we can handle types that don't have complete debug info. +struct Incomplete; +auto incomplete = &three<Incomplete*, Incomplete**, const Incomplete*>; +// CHECK: (Incomplete *(*)(Incomplete **, const Incomplete *)) incomplete = {{.*}} + +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} class C +// CHECK: |-CXXRecordDecl {{.*}} union U +// CHECK: |-EnumDecl {{.*}} E +// CHECK: |-CXXRecordDecl {{.*}} struct S +// CHECK: |-VarDecl {{.*}} a 'S (*)(C *, U &, E &&)'
+// CHECK: |-VarDecl {{.*}} b 'E (*)(const S *, const C &, const U &&)'
+// CHECK: |-VarDecl {{.*}} c 'U (*)(volatile E *, volatile S &, volatile C &&)'
+// CHECK: |-VarDecl {{.*}} d 'C (*)(const volatile U *, const volatile E &, const volatile S &&)' +// CHECK: |-CXXRecordDecl {{.*}} struct B +// CHECK: | |-CXXRecordDecl {{.*}} struct A +// CHECK: | | |-CXXRecordDecl {{.*}} struct S +// CHECK: |-NamespaceDecl {{.*}} A +// CHECK: | |-CXXRecordDecl {{.*}} struct C +// CHECK: | | |-CXXRecordDecl {{.*}} struct S +// CHECK: | `-NamespaceDecl {{.*}} B +// CHECK: | `-CXXRecordDecl {{.*}} struct S +// CHECK: |-VarDecl {{.*}} e 'A::B::S *(*)(B::A::S *, A::C::S &)'
+// CHECK: |-VarDecl {{.*}} f 'A::C::S &(*)(A::B::S *, B::A::S *)'
+// CHECK: |-VarDecl {{.*}} g 'B::A::S *(*)(A::C::S &, A::B::S *)' +// CHECK: |-CXXRecordDecl {{.*}} struct TC<int> +// CHECK: |-CXXRecordDecl {{.*}} struct TC<TC<int>> +// CHECK: |-CXXRecordDecl {{.*}} struct TC<A::B::S> +// CHECK: |-CXXRecordDecl {{.*}} struct TC<void> +// CHECK: |-VarDecl {{.*}} h 'TC<void> (*)(TC<int>, TC<TC<int>>, TC<A::B::S>)'
+// CHECK: |-VarDecl {{.*}} i 'A::B::S (*)()' +// CHECK: |-CXXRecordDecl {{.*}} struct Incomplete +// CHECK: |-VarDecl {{.*}} incomplete 'Incomplete *(*)(Incomplete **, const Incomplete *)' + +int main(int argc, char **argv) { + return 0; +} diff --git a/lit/SymbolFile/NativePDB/global-classes.cpp b/lit/SymbolFile/NativePDB/global-classes.cpp new file mode 100644 index 000000000000..ea7cc745d74d --- /dev/null +++ b/lit/SymbolFile/NativePDB/global-classes.cpp @@ -0,0 +1,370 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can display tag types. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/globals-classes.lldbinit | FileCheck %s + +enum class EnumType : unsigned { + A = 1, + B = 2 +}; + +class ClassNoPadding { + /* [ 0] */ unsigned char a = 86; + /* [ 1] */ char b = 'a'; + /* [ 2] */ bool c = false; + /* [ 3] */ bool d = true; + /* [ 4] */ short e = -1234; + /* [ 6] */ unsigned short f = 8123; + /* [ 8] */ unsigned int g = 123908; + /* [12] */ int h = -890234; + /* [16] */ unsigned long i = 2908234; + /* [20] */ long j = 7234890; + /* [24] */ float k = 908234.12392; + /* [28] */ EnumType l = EnumType::A; + /* [32] */ double m = 23890.897423; + /* [40] */ unsigned long long n = 23490782; + /* [48] */ long long o = -923409823; + /* [56] */ int p[5] = { 2, 3, 5, 8, 13 }; +}; + +class ClassWithPadding { + /* [ 0] */ char a = '0'; + // char padding[1]; + /* [ 2] */ short b = 50; + /* [ 4] */ char c[2] = { '0', '1' }; + // char padding[2]; + /* [ 8] */ int d = 100; + /* [12] */ char e = '0'; + // char padding[3]; + /* [16] */ int f = 200; + // char padding[4]; + /* [24] */ long long g = 300; + /* [32] */ char h[3] = { '0', '1', '2' }; + // char padding[5]; + /* [40] */ long long i = 400; + /* [48] */ char j[2] = { '0', '1' }; + // char padding[6]; + /* [56] */ long long k = 500; + /* [64] */ char l = '0'; + // char padding[7]; + /* [72] */ long long m = 600; +} ; + +struct EmptyBase {}; + +template<typename T> +struct BaseClass { + constexpr BaseClass(int N) + : BaseMember(N) {} + + int BaseMember; +}; + +struct DerivedClass : public BaseClass<int> { + constexpr DerivedClass(int Base, int Derived) + : BaseClass(Base), DerivedMember(Derived) {} + + int DerivedMember; +}; + +struct EBO : public EmptyBase { + constexpr EBO(int N) : Member(N) {} + int Member; +}; + +struct PaddedBases : public BaseClass<char>, public BaseClass<short>, BaseClass<int> { + constexpr PaddedBases(char CH, short S, int N, long long D) + : BaseClass<char>(CH), BaseClass<short>(S), BaseClass<int>(N), DerivedMember(D) {} + long long DerivedMember; +}; + +struct Statics { + static char a; + static bool b; + static short c; + static unsigned short d; + static unsigned int e; + static int f; + static unsigned long g; + static long h; + static float i; + static EnumType j; + static double k; + static unsigned long long l; + static long long m; +}; + +char Statics::a = 'a'; +bool Statics::b = true; +short Statics::c = 1234; +unsigned short Statics::d = 2345; +unsigned int Statics::e = 3456; +int Statics::f = 4567; +unsigned long Statics::g = 5678; +long Statics::h = 6789; +float Statics::i = 7890.1234; +EnumType Statics::j = EnumType::A; +double Statics::k = 8901.2345; +unsigned long long Statics::l = 9012345; +long long Statics::m = 1234567; + + +struct Pointers { + void *a = nullptr; + char *b = &Statics::a; + bool *c = &Statics::b; + short *e = &Statics::c; + unsigned short *f = &Statics::d; + unsigned int *g = &Statics::e; + int *h = &Statics::f; + unsigned long *i = &Statics::g; + long *j = &Statics::h; + float *k = &Statics::i; + EnumType *l = &Statics::j; + double *m = &Statics::k; + unsigned long long *n = &Statics::l; + long long *o = &Statics::m; +}; + +struct References { + char &a = Statics::a; + bool &b = Statics::b; + short &c = Statics::c; + unsigned short &d = Statics::d; + unsigned int &e = Statics::e; + int &f = Statics::f; + unsigned long &g = Statics::g; + long &h = Statics::h; + float &i = Statics::i; + EnumType &j = Statics::j; + double &k = Statics::k; + unsigned long long &l = Statics::l; + long long &m = Statics::m; +}; + + +constexpr ClassWithPadding ClassWithPaddingInstance; +// CHECK: (lldb) target variable -T ClassWithPaddingInstance +// CHECK-NEXT: (const ClassWithPadding) ClassWithPaddingInstance = { +// CHECK-NEXT: (char) a = '0' +// CHECK-NEXT: (short) b = 50 +// CHECK-NEXT: (char [2]) c = "01" +// CHECK-NEXT: (int) d = 100 +// CHECK-NEXT: (char) e = '0' +// CHECK-NEXT: (int) f = 200 +// CHECK-NEXT: (long long) g = 300 +// CHECK-NEXT: (char [3]) h = "012" +// CHECK-NEXT: (long long) i = 400 +// CHECK-NEXT: (char [2]) j = "01" +// CHECK-NEXT: (long long) k = 500 +// CHECK-NEXT: (char) l = '0' +// CHECK-NEXT: (long long) m = 600 +// CHECK-NEXT: } + +constexpr ClassNoPadding ClassNoPaddingInstance; +// CHECK: (lldb) target variable -T ClassNoPaddingInstance +// CHECK-NEXT: (const ClassNoPadding) ClassNoPaddingInstance = { +// CHECK-NEXT: (unsigned char) a = 'V' +// CHECK-NEXT: (char) b = 'a' +// CHECK-NEXT: (bool) c = false +// CHECK-NEXT: (bool) d = true +// CHECK-NEXT: (short) e = -1234 +// CHECK-NEXT: (unsigned short) f = 8123 +// CHECK-NEXT: (unsigned int) g = 123908 +// CHECK-NEXT: (int) h = -890234 +// CHECK-NEXT: (unsigned long) i = 2908234 +// CHECK-NEXT: (long) j = 7234890 +// CHECK-NEXT: (float) k = 908234.125 +// CHECK-NEXT: (EnumType) l = A +// CHECK-NEXT: (double) m = 23890.897422999999 +// CHECK-NEXT: (unsigned long long) n = 23490782 +// CHECK-NEXT: (long long) o = -923409823 +// CHECK-NEXT: (int [5]) p = { +// CHECK-NEXT: (int) [0] = 2 +// CHECK-NEXT: (int) [1] = 3 +// CHECK-NEXT: (int) [2] = 5 +// CHECK-NEXT: (int) [3] = 8 +// CHECK-NEXT: (int) [4] = 13 +// CHECK-NEXT: } +// CHECK-NEXT: } + +constexpr DerivedClass DC(10, 20); +// CHECK: (lldb) target variable -T DC +// CHECK-NEXT: (const DerivedClass) DC = { +// CHECK-NEXT: (BaseClass<int>) BaseClass<int> = { +// CHECK-NEXT: (int) BaseMember = 10 +// CHECK-NEXT: } +// CHECK-NEXT: (int) DerivedMember = 20 +// CHECK-NEXT: } + +constexpr EBO EBOC(20); +// CHECK: (lldb) target variable -T EBOC +// CHECK-NEXT: (const EBO) EBOC = { +// CHECK-NEXT: (int) Member = 20 +// CHECK-NEXT: } + +constexpr PaddedBases PBC('a', 12, 120, 1200); +// CHECK: (lldb) target variable -T PBC +// CHECK-NEXT: (const PaddedBases) PBC = { +// CHECK-NEXT: (BaseClass<char>) BaseClass<char> = { +// CHECK-NEXT: (int) BaseMember = 97 +// CHECK-NEXT: } +// CHECK-NEXT: (BaseClass<short>) BaseClass<short> = { +// CHECK-NEXT: (int) BaseMember = 12 +// CHECK-NEXT: } +// CHECK-NEXT: (BaseClass<int>) BaseClass<int> = { +// CHECK-NEXT: (int) BaseMember = 120 +// CHECK-NEXT: } +// CHECK-NEXT: (long long) DerivedMember = 1200 +// CHECK-NEXT: } + +constexpr struct { + int x = 12; + EBO EBOC{ 42 }; +} UnnamedClassInstance; +// CHECK: (lldb) target variable -T UnnamedClassInstance +// CHECK-NEXT: (const <unnamed-type-UnnamedClassInstance>) UnnamedClassInstance = { +// CHECK-NEXT: (int) x = 12 +// CHECK-NEXT: (EBO) EBOC = { +// CHECK-NEXT: (int) Member = 42 +// CHECK-NEXT: } +// CHECK-NEXT: } + +constexpr Pointers PointersInstance; +// CHECK: (lldb) target variable -T PointersInstance +// CHECK-NEXT: (const Pointers) PointersInstance = { +// CHECK-NEXT: (void *) a = {{.*}} +// CHECK-NEXT: (char *) b = {{.*}} +// CHECK-NEXT: (bool *) c = {{.*}} +// CHECK-NEXT: (short *) e = {{.*}} +// CHECK-NEXT: (unsigned short *) f = {{.*}} +// CHECK-NEXT: (unsigned int *) g = {{.*}} +// CHECK-NEXT: (int *) h = {{.*}} +// CHECK-NEXT: (unsigned long *) i = {{.*}} +// CHECK-NEXT: (long *) j = {{.*}} +// CHECK-NEXT: (float *) k = {{.*}} +// CHECK-NEXT: (EnumType *) l = {{.*}} +// CHECK-NEXT: (double *) m = {{.*}} +// CHECK-NEXT: (unsigned long long *) n = {{.*}} +// CHECK-NEXT: (long long *) o = {{.*}} +// CHECK-NEXT: } +constexpr References ReferencesInstance; +// CHECK: (lldb) target variable -T ReferencesInstance +// CHECK-NEXT: (const References) ReferencesInstance = { +// CHECK-NEXT: (char &) a = {{.*}} +// CHECK-NEXT: (bool &) b = {{.*}} +// CHECK-NEXT: (short &) c = {{.*}} +// CHECK-NEXT: (unsigned short &) d = {{.*}} +// CHECK-NEXT: (unsigned int &) e = {{.*}} +// CHECK-NEXT: (int &) f = {{.*}} +// CHECK-NEXT: (unsigned long &) g = {{.*}} +// CHECK-NEXT: (long &) h = {{.*}} +// CHECK-NEXT: (float &) i = {{.*}} +// CHECK-NEXT: (EnumType &) j = {{.*}} +// CHECK-NEXT: (double &) k = {{.*}} +// CHECK-NEXT: (unsigned long long &) l = {{.*}} +// CHECK-NEXT: (long long &) m = {{.*}} +// CHECK-NEXT: } + +// CHECK: Dumping clang ast for 1 modules. +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} class ClassWithPadding definition +// CHECK: | |-FieldDecl {{.*}} a 'char' +// CHECK: | |-FieldDecl {{.*}} b 'short' +// CHECK: | |-FieldDecl {{.*}} c 'char [2]' +// CHECK: | |-FieldDecl {{.*}} d 'int' +// CHECK: | |-FieldDecl {{.*}} e 'char' +// CHECK: | |-FieldDecl {{.*}} f 'int' +// CHECK: | |-FieldDecl {{.*}} g 'long long' +// CHECK: | |-FieldDecl {{.*}} h 'char [3]' +// CHECK: | |-FieldDecl {{.*}} i 'long long' +// CHECK: | |-FieldDecl {{.*}} j 'char [2]' +// CHECK: | |-FieldDecl {{.*}} k 'long long' +// CHECK: | |-FieldDecl {{.*}} l 'char' +// CHECK: | `-FieldDecl {{.*}} m 'long long' +// CHECK: |-VarDecl {{.*}} ClassWithPaddingInstance 'const ClassWithPadding' +// CHECK: |-CXXRecordDecl {{.*}} class ClassNoPadding definition +// CHECK: | |-FieldDecl {{.*}} a 'unsigned char' +// CHECK: | |-FieldDecl {{.*}} b 'char' +// CHECK: | |-FieldDecl {{.*}} c 'bool' +// CHECK: | |-FieldDecl {{.*}} d 'bool' +// CHECK: | |-FieldDecl {{.*}} e 'short' +// CHECK: | |-FieldDecl {{.*}} f 'unsigned short' +// CHECK: | |-FieldDecl {{.*}} g 'unsigned int' +// CHECK: | |-FieldDecl {{.*}} h 'int' +// CHECK: | |-FieldDecl {{.*}} i 'unsigned long' +// CHECK: | |-FieldDecl {{.*}} j 'long' +// CHECK: | |-FieldDecl {{.*}} k 'float' +// CHECK: | |-FieldDecl {{.*}} l 'EnumType' +// CHECK: | |-FieldDecl {{.*}} m 'double' +// CHECK: | |-FieldDecl {{.*}} n 'unsigned long long' +// CHECK: | |-FieldDecl {{.*}} o 'long long' +// CHECK: | `-FieldDecl {{.*}} p 'int [5]' +// CHECK: |-VarDecl {{.*}} ClassNoPaddingInstance 'const ClassNoPadding' +// CHECK: |-EnumDecl {{.*}} EnumType +// CHECK: | |-EnumConstantDecl {{.*}} A 'EnumType' +// CHECK: | `-EnumConstantDecl {{.*}} B 'EnumType' +// CHECK: |-CXXRecordDecl {{.*}} struct DerivedClass definition +// CHECK: | |-public 'BaseClass<int>' +// CHECK: | `-FieldDecl {{.*}} DerivedMember 'int' +// CHECK: |-VarDecl {{.*}} DC 'const DerivedClass' +// CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<int> definition +// CHECK: | `-FieldDecl {{.*}} BaseMember 'int' +// CHECK: |-CXXRecordDecl {{.*}} struct EBO definition +// CHECK: | |-public 'EmptyBase' +// CHECK: | `-FieldDecl {{.*}} Member 'int' +// CHECK: |-VarDecl {{.*}} EBOC 'const EBO' +// CHECK: |-CXXRecordDecl {{.*}} struct EmptyBase definition +// CHECK: |-CXXRecordDecl {{.*}} struct PaddedBases definition +// CHECK: | |-public 'BaseClass<char>' +// CHECK: | |-public 'BaseClass<short>' +// CHECK: | |-public 'BaseClass<int>' +// CHECK: | `-FieldDecl {{.*}} DerivedMember 'long long' +// CHECK: |-VarDecl {{.*}} PBC 'const PaddedBases' +// CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<char> definition +// CHECK: | `-FieldDecl {{.*}} BaseMember 'int' +// CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<short> definition +// CHECK: | `-FieldDecl {{.*}} BaseMember 'int' +// CHECK: |-CXXRecordDecl {{.*}} struct <unnamed-type-UnnamedClassInstance> definition +// CHECK: | |-FieldDecl {{.*}} x 'int' +// CHECK: | `-FieldDecl {{.*}} EBOC 'EBO' +// CHECK: |-VarDecl {{.*}} UnnamedClassInstance 'const <unnamed-type-UnnamedClassInstance>' +// CHECK: |-CXXRecordDecl {{.*}} struct Pointers definition +// CHECK: | |-FieldDecl {{.*}} a 'void *' +// CHECK: | |-FieldDecl {{.*}} b 'char *' +// CHECK: | |-FieldDecl {{.*}} c 'bool *' +// CHECK: | |-FieldDecl {{.*}} e 'short *' +// CHECK: | |-FieldDecl {{.*}} f 'unsigned short *' +// CHECK: | |-FieldDecl {{.*}} g 'unsigned int *' +// CHECK: | |-FieldDecl {{.*}} h 'int *' +// CHECK: | |-FieldDecl {{.*}} i 'unsigned long *' +// CHECK: | |-FieldDecl {{.*}} j 'long *' +// CHECK: | |-FieldDecl {{.*}} k 'float *' +// CHECK: | |-FieldDecl {{.*}} l 'EnumType *' +// CHECK: | |-FieldDecl {{.*}} m 'double *' +// CHECK: | |-FieldDecl {{.*}} n 'unsigned long long *' +// CHECK: | `-FieldDecl {{.*}} o 'long long *' +// CHECK: |-VarDecl {{.*}} PointersInstance 'const Pointers' +// CHECK: |-CXXRecordDecl {{.*}} struct References definition +// CHECK: | |-FieldDecl {{.*}} a 'char &' +// CHECK: | |-FieldDecl {{.*}} b 'bool &' +// CHECK: | |-FieldDecl {{.*}} c 'short &' +// CHECK: | |-FieldDecl {{.*}} d 'unsigned short &' +// CHECK: | |-FieldDecl {{.*}} e 'unsigned int &' +// CHECK: | |-FieldDecl {{.*}} f 'int &' +// CHECK: | |-FieldDecl {{.*}} g 'unsigned long &' +// CHECK: | |-FieldDecl {{.*}} h 'long &' +// CHECK: | |-FieldDecl {{.*}} i 'float &' +// CHECK: | |-FieldDecl {{.*}} j 'EnumType &' +// CHECK: | |-FieldDecl {{.*}} k 'double &' +// CHECK: | |-FieldDecl {{.*}} l 'unsigned long long &' +// CHECK: | `-FieldDecl {{.*}} m 'long long &' +// CHECK: |-VarDecl {{.*}} ReferencesInstance 'const References' +// CHECK: `-<undeserialized declarations> + +int main(int argc, char **argv) { + return 0; +} diff --git a/lit/SymbolFile/NativePDB/globals-bss.cpp b/lit/SymbolFile/NativePDB/globals-bss.cpp new file mode 100644 index 000000000000..c10c3c196286 --- /dev/null +++ b/lit/SymbolFile/NativePDB/globals-bss.cpp @@ -0,0 +1,34 @@ +// clang-format off +// REQUIRES: lld + +// Make sure we can read variables from BSS +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s + +int GlobalVariable = 0; + +int main(int argc, char **argv) { + return 0; +} + +// BSS: Section { +// BSS: Number: 3 +// BSS: Name: .data +// BSS-NEXT: VirtualSize: 0x4 +// BSS-NEXT: VirtualAddress: +// BSS-NEXT: RawDataSize: 0 +// BSS-NEXT: PointerToRawData: 0x0 +// BSS-NEXT: PointerToRelocations: 0x0 +// BSS-NEXT: PointerToLineNumbers: 0x0 +// BSS-NEXT: RelocationCount: 0 +// BSS-NEXT: LineNumberCount: 0 +// BSS-NEXT: Characteristics [ (0xC0000040) +// BSS-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40) +// BSS-NEXT: IMAGE_SCN_MEM_READ (0x40000000) +// BSS-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000) +// BSS-NEXT: ] +// BSS-NEXT: } + +// CHECK: (int) GlobalVariable = 0 diff --git a/lit/SymbolFile/NativePDB/globals-fundamental.cpp b/lit/SymbolFile/NativePDB/globals-fundamental.cpp new file mode 100644 index 000000000000..8891eddf6689 --- /dev/null +++ b/lit/SymbolFile/NativePDB/globals-fundamental.cpp @@ -0,0 +1,880 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can display tag types. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/globals-fundamental.lldbinit | FileCheck %s + + +// Fundamental data types +bool BFalse = false; +// CHECK: (lldb) target variable BFalse +// CHECK-NEXT: (bool) BFalse = false +bool BTrue = true; +// CHECK-NEXT: (lldb) target variable BTrue +// CHECK-NEXT: (bool) BTrue = true +char CA = 'A'; +// CHECK-NEXT: (lldb) target variable CA +// CHECK-NEXT: (char) CA = 'A' +char CZ = 'Z'; +// CHECK-NEXT: (lldb) target variable CZ +// CHECK-NEXT: (char) CZ = 'Z' +signed char SCa = 'a'; +// CHECK-NEXT: (lldb) target variable SCa +// CHECK-NEXT: (signed char) SCa = 'a' +signed char SCz = 'z'; +// CHECK-NEXT: (lldb) target variable SCz +// CHECK-NEXT: (signed char) SCz = 'z' +unsigned char UC24 = 24; +// CHECK-NEXT: (lldb) target variable UC24 +// CHECK-NEXT: (unsigned char) UC24 = '\x18' +unsigned char UC42 = 42; +// CHECK-NEXT: (lldb) target variable UC42 +// CHECK-NEXT: (unsigned char) UC42 = '*' +char16_t C16_24 = u'\24'; +// CHECK-NEXT: (lldb) target variable C16_24 +// CHECK-NEXT: (char16_t) C16_24 = U+0014 +char32_t C32_42 = U'\42'; +// CHECK-NEXT: (lldb) target variable C32_42 +// CHECK-NEXT: (char32_t) C32_42 = U+0x00000022 +wchar_t WC1 = L'1'; +// CHECK-NEXT: (lldb) target variable WC1 +// CHECK-NEXT: (wchar_t) WC1 = L'1' +wchar_t WCP = L'P'; +// CHECK-NEXT: (lldb) target variable WCP +// CHECK-NEXT: (wchar_t) WCP = L'P' +short SMax = 32767; +// CHECK-NEXT: (lldb) target variable SMax +// CHECK-NEXT: (short) SMax = 32767 +short SMin = -32768; +// CHECK-NEXT: (lldb) target variable SMin +// CHECK-NEXT: (short) SMin = -32768 +unsigned short USMax = 65535; +// CHECK-NEXT: (lldb) target variable USMax +// CHECK-NEXT: (unsigned short) USMax = 65535 +unsigned short USMin = 0; +// CHECK-NEXT: (lldb) target variable USMin +// CHECK-NEXT: (unsigned short) USMin = 0 +int IMax = 2147483647; +// CHECK-NEXT: (lldb) target variable IMax +// CHECK-NEXT: (int) IMax = 2147483647 +int IMin = -2147483648; +// CHECK-NEXT: (lldb) target variable IMin +// CHECK-NEXT: (int) IMin = -2147483648 +unsigned int UIMax = 4294967295; +// CHECK-NEXT: (lldb) target variable UIMax +// CHECK-NEXT: (unsigned int) UIMax = 4294967295 +unsigned int UIMin = 0; +// CHECK-NEXT: (lldb) target variable UIMin +// CHECK-NEXT: (unsigned int) UIMin = 0 +long LMax = 2147483647; +// CHECK-NEXT: (lldb) target variable LMax +// CHECK-NEXT: (long) LMax = 2147483647 +long LMin = -2147483648; +// CHECK-NEXT: (lldb) target variable LMin +// CHECK-NEXT: (long) LMin = -2147483648 +unsigned long ULMax = 4294967295; +// CHECK-NEXT: (lldb) target variable ULMax +// CHECK-NEXT: (unsigned long) ULMax = 4294967295 +unsigned long ULMin = 0; +// CHECK-NEXT: (lldb) target variable ULMin +// CHECK-NEXT: (unsigned long) ULMin = 0 +long long LLMax = 9223372036854775807LL; +// CHECK-NEXT: (lldb) target variable LLMax +// CHECK-NEXT: (long long) LLMax = 9223372036854775807 +long long LLMin = -9223372036854775807i64 - 1; +// CHECK-NEXT: (lldb) target variable LLMin +// CHECK-NEXT: (long long) LLMin = -9223372036854775808 +unsigned long long ULLMax = 18446744073709551615ULL; +// CHECK-NEXT: (lldb) target variable ULLMax +// CHECK-NEXT: (unsigned long long) ULLMax = 18446744073709551615 +unsigned long long ULLMin = 0; +// CHECK-NEXT: (lldb) target variable ULLMin +// CHECK-NEXT: (unsigned long long) ULLMin = 0 +float F = 3.1415f; +// CHECK-NEXT: (lldb) target variable F +// CHECK-NEXT: (float) F = 3.1415 +double D = 3.1415; +// CHECK-NEXT: (lldb) target variable D +// CHECK-NEXT: (double) D = 3.1415 + +const bool CBFalse = false; +// CHECK-NEXT: (lldb) target variable CBFalse +// CHECK-NEXT: (const bool) CBFalse = false +const bool CBTrue = true; +// CHECK-NEXT: (lldb) target variable CBTrue +// CHECK-NEXT: (const bool) CBTrue = true +const char CCA = 'A'; +// CHECK-NEXT: (lldb) target variable CCA +// CHECK-NEXT: (const char) CCA = 'A' +const char CCZ = 'Z'; +// CHECK-NEXT: (lldb) target variable CCZ +// CHECK-NEXT: (const char) CCZ = 'Z' +const signed char CSCa = 'a'; +// CHECK-NEXT: (lldb) target variable CSCa +// CHECK-NEXT: (const signed char) CSCa = 'a' +const signed char CSCz = 'z'; +// CHECK-NEXT: (lldb) target variable CSCz +// CHECK-NEXT: (const signed char) CSCz = 'z' +const unsigned char CUC24 = 24; +// CHECK-NEXT: (lldb) target variable CUC24 +// CHECK-NEXT: (const unsigned char) CUC24 = '\x18' +const unsigned char CUC42 = 42; +// CHECK-NEXT: (lldb) target variable CUC42 +// CHECK-NEXT: (const unsigned char) CUC42 = '*' +const char16_t CC16_24 = u'\24'; +// CHECK-NEXT: (lldb) target variable CC16_24 +// CHECK-NEXT: (const char16_t) CC16_24 = U+0014 +const char32_t CC32_42 = U'\42'; +// CHECK-NEXT: (lldb) target variable CC32_42 +// CHECK-NEXT: (const char32_t) CC32_42 = U+0x00000022 +const wchar_t CWC1 = L'1'; +// CHECK-NEXT: (lldb) target variable CWC1 +// CHECK-NEXT: (const wchar_t) CWC1 = L'1' +const wchar_t CWCP = L'P'; +// CHECK-NEXT: (lldb) target variable CWCP +// CHECK-NEXT: (const wchar_t) CWCP = L'P' +const short CSMax = 32767; +// CHECK-NEXT: (lldb) target variable CSMax +// CHECK-NEXT: (const short) CSMax = 32767 +const short CSMin = -32768; +// CHECK-NEXT: (lldb) target variable CSMin +// CHECK-NEXT: (const short) CSMin = -32768 +const unsigned short CUSMax = 65535; +// CHECK-NEXT: (lldb) target variable CUSMax +// CHECK-NEXT: (const unsigned short) CUSMax = 65535 +const unsigned short CUSMin = 0; +// CHECK-NEXT: (lldb) target variable CUSMin +// CHECK-NEXT: (const unsigned short) CUSMin = 0 +const int CIMax = 2147483647; +// CHECK-NEXT: (lldb) target variable CIMax +// CHECK-NEXT: (const int) CIMax = 2147483647 +const int CIMin = -2147483648; +// CHECK-NEXT: (lldb) target variable CIMin +// CHECK-NEXT: (const int) CIMin = -2147483648 +const unsigned int CUIMax = 4294967295; +// CHECK-NEXT: (lldb) target variable CUIMax +// CHECK-NEXT: (const unsigned int) CUIMax = 4294967295 +const unsigned int CUIMin = 0; +// CHECK-NEXT: (lldb) target variable CUIMin +// CHECK-NEXT: (const unsigned int) CUIMin = 0 +const long CLMax = 2147483647; +// CHECK-NEXT: (lldb) target variable CLMax +// CHECK-NEXT: (const long) CLMax = 2147483647 +const long CLMin = -2147483648; +// CHECK-NEXT: (lldb) target variable CLMin +// CHECK-NEXT: (const long) CLMin = -2147483648 +const unsigned long CULMax = 4294967295; +// CHECK-NEXT: (lldb) target variable CULMax +// CHECK-NEXT: (const unsigned long) CULMax = 4294967295 +const unsigned long CULMin = 0; +// CHECK-NEXT: (lldb) target variable CULMin +// CHECK-NEXT: (const unsigned long) CULMin = 0 +const long long CLLMax = 9223372036854775807i64; +// CHECK-NEXT: (lldb) target variable CLLMax +// CHECK-NEXT: (const long long) CLLMax = 9223372036854775807 +const long long CLLMin = -9223372036854775807i64 - 1; +// CHECK-NEXT: (lldb) target variable CLLMin +// CHECK-NEXT: (const long long) CLLMin = -9223372036854775808 +const unsigned long long CULLMax = 18446744073709551615ULL; +// CHECK-NEXT: (lldb) target variable CULLMax +// CHECK-NEXT: (const unsigned long long) CULLMax = 18446744073709551615 +const unsigned long long CULLMin = 0; +// CHECK-NEXT: (lldb) target variable CULLMin +// CHECK-NEXT: (const unsigned long long) CULLMin = 0 +const float CF = 3.1415f; +// CHECK-NEXT: (lldb) target variable CF +// CHECK-NEXT: (const float) CF = 3.1415 +const double CD = 3.1415; +// CHECK-NEXT: (lldb) target variable CD +// CHECK-NEXT: (const double) CD = 3.1415 + +// constexpr fundamental data types. +constexpr bool ConstexprBFalse = false; +// CHECK-NEXT: (lldb) target variable ConstexprBFalse +// CHECK-NEXT: (const bool) ConstexprBFalse = false +constexpr bool ConstexprBTrue = true; +// CHECK-NEXT: (lldb) target variable ConstexprBTrue +// CHECK-NEXT: (const bool) ConstexprBTrue = true +constexpr char ConstexprCA = 'A'; +// CHECK-NEXT: (lldb) target variable ConstexprCA +// CHECK-NEXT: (const char) ConstexprCA = 'A' +constexpr char ConstexprCZ = 'Z'; +// CHECK-NEXT: (lldb) target variable ConstexprCZ +// CHECK-NEXT: (const char) ConstexprCZ = 'Z' +constexpr signed char ConstexprSCa = 'a'; +// CHECK-NEXT: (lldb) target variable ConstexprSCa +// CHECK-NEXT: (const signed char) ConstexprSCa = 'a' +constexpr signed char ConstexprSCz = 'z'; +// CHECK-NEXT: (lldb) target variable ConstexprSCz +// CHECK-NEXT: (const signed char) ConstexprSCz = 'z' +constexpr unsigned char ConstexprUC24 = 24; +// CHECK-NEXT: (lldb) target variable ConstexprUC24 +// CHECK-NEXT: (const unsigned char) ConstexprUC24 = '\x18' +constexpr unsigned char ConstexprUC42 = 42; +// CHECK-NEXT: (lldb) target variable ConstexprUC42 +// CHECK-NEXT: (const unsigned char) ConstexprUC42 = '*' +constexpr char16_t ConstexprC16_24 = u'\24'; +// CHECK-NEXT: (lldb) target variable ConstexprC16_24 +// CHECK-NEXT: (const char16_t) ConstexprC16_24 = U+0014 +constexpr char32_t ConstexprC32_42 = U'\42'; +// CHECK-NEXT: (lldb) target variable ConstexprC32_42 +// CHECK-NEXT: (const char32_t) ConstexprC32_42 = U+0x00000022 +constexpr wchar_t ConstexprWC1 = L'1'; +// CHECK-NEXT: (lldb) target variable ConstexprWC1 +// CHECK-NEXT: (const wchar_t) ConstexprWC1 = L'1' +constexpr wchar_t ConstexprWCP = L'P'; +// CHECK-NEXT: (lldb) target variable ConstexprWCP +// CHECK-NEXT: (const wchar_t) ConstexprWCP = L'P' +constexpr short ConstexprSMax = 32767; +// CHECK-NEXT: (lldb) target variable ConstexprSMax +// CHECK-NEXT: (const short) ConstexprSMax = 32767 +constexpr short ConstexprSMin = -32768; +// CHECK-NEXT: (lldb) target variable ConstexprSMin +// CHECK-NEXT: (const short) ConstexprSMin = -32768 +constexpr unsigned short ConstexprUSMax = 65535; +// CHECK-NEXT: (lldb) target variable ConstexprUSMax +// CHECK-NEXT: (const unsigned short) ConstexprUSMax = 65535 +constexpr unsigned short ConstexprUSMin = 0; +// CHECK-NEXT: (lldb) target variable ConstexprUSMin +// CHECK-NEXT: (const unsigned short) ConstexprUSMin = 0 +constexpr int ConstexprIMax = 2147483647; +// CHECK-NEXT: (lldb) target variable ConstexprIMax +// CHECK-NEXT: (const int) ConstexprIMax = 2147483647 +constexpr int ConstexprIMin = -2147483648; +// CHECK-NEXT: (lldb) target variable ConstexprIMin +// CHECK-NEXT: (const int) ConstexprIMin = -2147483648 +constexpr unsigned int ConstexprUIMax = 4294967295; +// CHECK-NEXT: (lldb) target variable ConstexprUIMax +// CHECK-NEXT: (const unsigned int) ConstexprUIMax = 4294967295 +constexpr unsigned int ConstexprUIMin = 0; +// CHECK-NEXT: (lldb) target variable ConstexprUIMin +// CHECK-NEXT: (const unsigned int) ConstexprUIMin = 0 +constexpr long ConstexprLMax = 2147483647; +// CHECK-NEXT: (lldb) target variable ConstexprLMax +// CHECK-NEXT: (const long) ConstexprLMax = 2147483647 +constexpr long ConstexprLMin = -2147483648; +// CHECK-NEXT: (lldb) target variable ConstexprLMin +// CHECK-NEXT: (const long) ConstexprLMin = -2147483648 +constexpr unsigned long ConstexprULMax = 4294967295; +// CHECK-NEXT: (lldb) target variable ConstexprULMax +// CHECK-NEXT: (const unsigned long) ConstexprULMax = 4294967295 +constexpr unsigned long ConstexprULMin = 0; +// CHECK-NEXT: (lldb) target variable ConstexprULMin +// CHECK-NEXT: (const unsigned long) ConstexprULMin = 0 +constexpr long long ConstexprLLMax = 9223372036854775807i64; +// CHECK-NEXT: (lldb) target variable ConstexprLLMax +// CHECK-NEXT: (const long long) ConstexprLLMax = 9223372036854775807 +constexpr long long ConstexprLLMin = -9223372036854775807i64 - 1; +// CHECK-NEXT: (lldb) target variable ConstexprLLMin +// CHECK-NEXT: (const long long) ConstexprLLMin = -9223372036854775808 +constexpr unsigned long long ConstexprULLMax = 18446744073709551615ULL; +// CHECK-NEXT: (lldb) target variable ConstexprULLMax +// CHECK-NEXT: (const unsigned long long) ConstexprULLMax = 18446744073709551615 +constexpr unsigned long long ConstexprULLMin = 0; +// CHECK-NEXT: (lldb) target variable ConstexprULLMin +// CHECK-NEXT: (const unsigned long long) ConstexprULLMin = 0 +constexpr float ConstexprF = 3.1415f; +// CHECK-NEXT: (lldb) target variable ConstexprF +// CHECK-NEXT: (const float) ConstexprF = 3.1415 +constexpr double ConstexprD = 3.1415; +// CHECK-NEXT: (lldb) target variable ConstexprD +// CHECK-NEXT: (const double) ConstexprD = 3.1415 + + +// FIXME: LLDB currently doesn't resolve pointers within the target without a +// running process (I haven't checked whether or not it can with a running +// process). So currently it will just print an address, which is unstable and +// should not be relied upon for testing. So for now we're just checking that +// the variable name and type is correct. We should fix this in LLDB and then +// update the tests. +bool *PBFalse = &BFalse; +// CHECK-NEXT: (lldb) target variable PBFalse +// CHECK-NEXT: (bool *) PBFalse = {{.*}} +bool *PBTrue = &BTrue; +// CHECK-NEXT: (lldb) target variable PBTrue +// CHECK-NEXT: (bool *) PBTrue = {{.*}} +char *PCA = &CA; +// CHECK-NEXT: (lldb) target variable PCA +// CHECK-NEXT: (char *) PCA = {{.*}} +char *PCZ = &CZ; +// CHECK-NEXT: (lldb) target variable PCZ +// CHECK-NEXT: (char *) PCZ = {{.*}} +signed char *PSCa = &SCa; +// CHECK-NEXT: (lldb) target variable PSCa +// CHECK-NEXT: (signed char *) PSCa = {{.*}} +signed char *PSCz = &SCz; +// CHECK-NEXT: (lldb) target variable PSCz +// CHECK-NEXT: (signed char *) PSCz = {{.*}} +unsigned char *PUC24 = &UC24; +// CHECK-NEXT: (lldb) target variable PUC24 +// CHECK-NEXT: (unsigned char *) PUC24 = {{.*}} +unsigned char *PUC42 = &UC42; +// CHECK-NEXT: (lldb) target variable PUC42 +// CHECK-NEXT: (unsigned char *) PUC42 = {{.*}} +char16_t *PC16_24 = &C16_24; +// CHECK-NEXT: (lldb) target variable PC16_24 +// CHECK-NEXT: (char16_t *) PC16_24 = {{.*}} +char32_t *PC32_42 = &C32_42; +// CHECK-NEXT: (lldb) target variable PC32_42 +// CHECK-NEXT: (char32_t *) PC32_42 = {{.*}} +wchar_t *PWC1 = &WC1; +// CHECK-NEXT: (lldb) target variable PWC1 +// CHECK-NEXT: (wchar_t *) PWC1 = {{.*}} +wchar_t *PWCP = &WCP; +// CHECK-NEXT: (lldb) target variable PWCP +// CHECK-NEXT: (wchar_t *) PWCP = {{.*}} +short *PSMax = &SMax; +// CHECK-NEXT: (lldb) target variable PSMax +// CHECK-NEXT: (short *) PSMax = {{.*}} +short *PSMin = &SMin; +// CHECK-NEXT: (lldb) target variable PSMin +// CHECK-NEXT: (short *) PSMin = {{.*}} +unsigned short *PUSMax = &USMax; +// CHECK-NEXT: (lldb) target variable PUSMax +// CHECK-NEXT: (unsigned short *) PUSMax = {{.*}} +unsigned short *PUSMin = &USMin; +// CHECK-NEXT: (lldb) target variable PUSMin +// CHECK-NEXT: (unsigned short *) PUSMin = {{.*}} +int *PIMax = &IMax; +// CHECK-NEXT: (lldb) target variable PIMax +// CHECK-NEXT: (int *) PIMax = {{.*}} +int *PIMin = &IMin; +// CHECK-NEXT: (lldb) target variable PIMin +// CHECK-NEXT: (int *) PIMin = {{.*}} +unsigned int *PUIMax = &UIMax; +// CHECK-NEXT: (lldb) target variable PUIMax +// CHECK-NEXT: (unsigned int *) PUIMax = {{.*}} +unsigned int *PUIMin = &UIMin; +// CHECK-NEXT: (lldb) target variable PUIMin +// CHECK-NEXT: (unsigned int *) PUIMin = {{.*}} +long *PLMax = &LMax; +// CHECK-NEXT: (lldb) target variable PLMax +// CHECK-NEXT: (long *) PLMax = {{.*}} +long *PLMin = &LMin; +// CHECK-NEXT: (lldb) target variable PLMin +// CHECK-NEXT: (long *) PLMin = {{.*}} +unsigned long *PULMax = &ULMax; +// CHECK-NEXT: (lldb) target variable PULMax +// CHECK-NEXT: (unsigned long *) PULMax = {{.*}} +unsigned long *PULMin = &ULMin; +// CHECK-NEXT: (lldb) target variable PULMin +// CHECK-NEXT: (unsigned long *) PULMin = {{.*}} +long long *PLLMax = &LLMax; +// CHECK-NEXT: (lldb) target variable PLLMax +// CHECK-NEXT: (long long *) PLLMax = {{.*}} +long long *PLLMin = &LLMin; +// CHECK-NEXT: (lldb) target variable PLLMin +// CHECK-NEXT: (long long *) PLLMin = {{.*}} +unsigned long long *PULLMax = &ULLMax; +// CHECK-NEXT: (lldb) target variable PULLMax +// CHECK-NEXT: (unsigned long long *) PULLMax = {{.*}} +unsigned long long *PULLMin = &ULLMin; +// CHECK-NEXT: (lldb) target variable PULLMin +// CHECK-NEXT: (unsigned long long *) PULLMin = {{.*}} +float *PF = &F; +// CHECK-NEXT: (lldb) target variable PF +// CHECK-NEXT: (float *) PF = {{.*}} +double *PD = &D; +// CHECK-NEXT: (lldb) target variable PD +// CHECK-NEXT: (double *) PD = {{.*}} + +// Const pointers to fundamental data types +const bool *CPBFalse = &BFalse; +// CHECK-NEXT: (lldb) target variable CPBFalse +// CHECK-NEXT: (const bool *) CPBFalse = {{.*}} +const bool *CPBTrue = &BTrue; +// CHECK-NEXT: (lldb) target variable CPBTrue +// CHECK-NEXT: (const bool *) CPBTrue = {{.*}} +const char *CPCA = &CA; +// CHECK-NEXT: (lldb) target variable CPCA +// CHECK-NEXT: (const char *) CPCA = {{.*}} +const char *CPCZ = &CZ; +// CHECK-NEXT: (lldb) target variable CPCZ +// CHECK-NEXT: (const char *) CPCZ = {{.*}} +const signed char *CPSCa = &SCa; +// CHECK-NEXT: (lldb) target variable CPSCa +// CHECK-NEXT: (const signed char *) CPSCa = {{.*}} +const signed char *CPSCz = &SCz; +// CHECK-NEXT: (lldb) target variable CPSCz +// CHECK-NEXT: (const signed char *) CPSCz = {{.*}} +const unsigned char *CPUC24 = &UC24; +// CHECK-NEXT: (lldb) target variable CPUC24 +// CHECK-NEXT: (const unsigned char *) CPUC24 = {{.*}} +const unsigned char *CPUC42 = &UC42; +// CHECK-NEXT: (lldb) target variable CPUC42 +// CHECK-NEXT: (const unsigned char *) CPUC42 = {{.*}} +const char16_t *CPC16_24 = &C16_24; +// CHECK-NEXT: (lldb) target variable CPC16_24 +// CHECK-NEXT: (const char16_t *) CPC16_24 = {{.*}} +const char32_t *CPC32_42 = &C32_42; +// CHECK-NEXT: (lldb) target variable CPC32_42 +// CHECK-NEXT: (const char32_t *) CPC32_42 = {{.*}} +const wchar_t *CPWC1 = &WC1; +// CHECK-NEXT: (lldb) target variable CPWC1 +// CHECK-NEXT: (const wchar_t *) CPWC1 = {{.*}} +const wchar_t *CPWCP = &WCP; +// CHECK-NEXT: (lldb) target variable CPWCP +// CHECK-NEXT: (const wchar_t *) CPWCP = {{.*}} +const short *CPSMax = &SMax; +// CHECK-NEXT: (lldb) target variable CPSMax +// CHECK-NEXT: (const short *) CPSMax = {{.*}} +const short *CPSMin = &SMin; +// CHECK-NEXT: (lldb) target variable CPSMin +// CHECK-NEXT: (const short *) CPSMin = {{.*}} +const unsigned short *CPUSMax = &USMax; +// CHECK-NEXT: (lldb) target variable CPUSMax +// CHECK-NEXT: (const unsigned short *) CPUSMax = {{.*}} +const unsigned short *CPUSMin = &USMin; +// CHECK-NEXT: (lldb) target variable CPUSMin +// CHECK-NEXT: (const unsigned short *) CPUSMin = {{.*}} +const int *CPIMax = &IMax; +// CHECK-NEXT: (lldb) target variable CPIMax +// CHECK-NEXT: (const int *) CPIMax = {{.*}} +const int *CPIMin = &IMin; +// CHECK-NEXT: (lldb) target variable CPIMin +// CHECK-NEXT: (const int *) CPIMin = {{.*}} +const unsigned int *CPUIMax = &UIMax; +// CHECK-NEXT: (lldb) target variable CPUIMax +// CHECK-NEXT: (const unsigned int *) CPUIMax = {{.*}} +const unsigned int *CPUIMin = &UIMin; +// CHECK-NEXT: (lldb) target variable CPUIMin +// CHECK-NEXT: (const unsigned int *) CPUIMin = {{.*}} +const long *CPLMax = &LMax; +// CHECK-NEXT: (lldb) target variable CPLMax +// CHECK-NEXT: (const long *) CPLMax = {{.*}} +const long *CPLMin = &LMin; +// CHECK-NEXT: (lldb) target variable CPLMin +// CHECK-NEXT: (const long *) CPLMin = {{.*}} +const unsigned long *CPULMax = &ULMax; +// CHECK-NEXT: (lldb) target variable CPULMax +// CHECK-NEXT: (const unsigned long *) CPULMax = {{.*}} +const unsigned long *CPULMin = &ULMin; +// CHECK-NEXT: (lldb) target variable CPULMin +// CHECK-NEXT: (const unsigned long *) CPULMin = {{.*}} +const long long *CPLLMax = &LLMax; +// CHECK-NEXT: (lldb) target variable CPLLMax +// CHECK-NEXT: (const long long *) CPLLMax = {{.*}} +const long long *CPLLMin = &LLMin; +// CHECK-NEXT: (lldb) target variable CPLLMin +// CHECK-NEXT: (const long long *) CPLLMin = {{.*}} +const unsigned long long *CPULLMax = &ULLMax; +// CHECK-NEXT: (lldb) target variable CPULLMax +// CHECK-NEXT: (const unsigned long long *) CPULLMax = {{.*}} +const unsigned long long *CPULLMin = &ULLMin; +// CHECK-NEXT: (lldb) target variable CPULLMin +// CHECK-NEXT: (const unsigned long long *) CPULLMin = {{.*}} +const float *CPF = &F; +// CHECK-NEXT: (lldb) target variable CPF +// CHECK-NEXT: (const float *) CPF = {{.*}} +const double *CPD = &D; +// CHECK-NEXT: (lldb) target variable CPD +// CHECK-NEXT: (const double *) CPD = {{.*}} + + +// References to fundamental data types + +bool &RBFalse = BFalse; +// CHECK-NEXT: (lldb) target variable RBFalse +// CHECK-NEXT: (bool &) RBFalse = {{.*}} (&::RBFalse = false) +bool &RBTrue = BTrue; +// CHECK-NEXT: (lldb) target variable RBTrue +// CHECK-NEXT: (bool &) RBTrue = {{.*}} (&::RBTrue = true) +char &RCA = CA; +// CHECK-NEXT: (lldb) target variable RCA +// CHECK-NEXT: (char &) RCA = {{.*}} (&::RCA = 'A') +char &RCZ = CZ; +// CHECK-NEXT: (lldb) target variable RCZ +// CHECK-NEXT: (char &) RCZ = {{.*}} (&::RCZ = 'Z') +signed char &RSCa = SCa; +// CHECK-NEXT: (lldb) target variable RSCa +// CHECK-NEXT: (signed char &) RSCa = {{.*}} (&::RSCa = 'a') +signed char &RSCz = SCz; +// CHECK-NEXT: (lldb) target variable RSCz +// CHECK-NEXT: (signed char &) RSCz = {{.*}} (&::RSCz = 'z') +unsigned char &RUC24 = UC24; +// CHECK-NEXT: (lldb) target variable RUC24 +// CHECK-NEXT: (unsigned char &) RUC24 = {{.*}} (&::RUC24 = '\x18') +unsigned char &RUC42 = UC42; +// CHECK-NEXT: (lldb) target variable RUC42 +// CHECK-NEXT: (unsigned char &) RUC42 = {{.*}} (&::RUC42 = '*') +short &RSMax = SMax; +// CHECK-NEXT: (lldb) target variable RSMax +// CHECK-NEXT: (short &) RSMax = {{.*}} (&::RSMax = 32767) +short &RSMin = SMin; +// CHECK-NEXT: (lldb) target variable RSMin +// CHECK-NEXT: (short &) RSMin = {{.*}} (&::RSMin = -32768) +unsigned short &RUSMax = USMax; +// CHECK-NEXT: (lldb) target variable RUSMax +// CHECK-NEXT: (unsigned short &) RUSMax = {{.*}} (&::RUSMax = 65535) +unsigned short &RUSMin = USMin; +// CHECK-NEXT: (lldb) target variable RUSMin +// CHECK-NEXT: (unsigned short &) RUSMin = {{.*}} (&::RUSMin = 0) +int &RIMax = IMax; +// CHECK-NEXT: (lldb) target variable RIMax +// CHECK-NEXT: (int &) RIMax = {{.*}} (&::RIMax = 2147483647) +int &RIMin = IMin; +// CHECK-NEXT: (lldb) target variable RIMin +// CHECK-NEXT: (int &) RIMin = {{.*}} (&::RIMin = -2147483648) +unsigned int &RUIMax = UIMax; +// CHECK-NEXT: (lldb) target variable RUIMax +// CHECK-NEXT: (unsigned int &) RUIMax = {{.*}} (&::RUIMax = 4294967295) +unsigned int &RUIMin = UIMin; +// CHECK-NEXT: (lldb) target variable RUIMin +// CHECK-NEXT: (unsigned int &) RUIMin = {{.*}} (&::RUIMin = 0) +long &RLMax = LMax; +// CHECK-NEXT: (lldb) target variable RLMax +// CHECK-NEXT: (long &) RLMax = {{.*}} (&::RLMax = 2147483647) +long &RLMin = LMin; +// CHECK-NEXT: (lldb) target variable RLMin +// CHECK-NEXT: (long &) RLMin = {{.*}} (&::RLMin = -2147483648) +unsigned long &RULMax = ULMax; +// CHECK-NEXT: (lldb) target variable RULMax +// CHECK-NEXT: (unsigned long &) RULMax = {{.*}} (&::RULMax = 4294967295) +unsigned long &RULMin = ULMin; +// CHECK-NEXT: (lldb) target variable RULMin +// CHECK-NEXT: (unsigned long &) RULMin = {{.*}} (&::RULMin = 0) +long long &RLLMax = LLMax; +// CHECK-NEXT: (lldb) target variable RLLMax +// CHECK-NEXT: (long long &) RLLMax = {{.*}} (&::RLLMax = 9223372036854775807) +long long &RLLMin = LLMin; +// CHECK-NEXT: (lldb) target variable RLLMin +// CHECK-NEXT: (long long &) RLLMin = {{.*}} (&::RLLMin = -9223372036854775808) +unsigned long long &RULLMax = ULLMax; +// CHECK-NEXT: (lldb) target variable RULLMax +// CHECK-NEXT: (unsigned long long &) RULLMax = {{.*}} (&::RULLMax = 18446744073709551615) +unsigned long long &RULLMin = ULLMin; +// CHECK-NEXT: (lldb) target variable RULLMin +// CHECK-NEXT: (unsigned long long &) RULLMin = {{.*}} (&::RULLMin = 0) +float &RF = F; +// CHECK-NEXT: (lldb) target variable RF +// CHECK-NEXT: (float &) RF = {{.*}} (&::RF = 3.1415) +double &RD = D; +// CHECK-NEXT: (lldb) target variable RD +// CHECK-NEXT: (double &) RD = {{.*}} (&::RD = 3.1415000000000002) + +// const references to fundamental data types +const bool &CRBFalse = BFalse; +// CHECK-NEXT: (lldb) target variable CRBFalse +// CHECK-NEXT: (const bool &) CRBFalse = {{.*}} (&::CRBFalse = false) +const bool &CRBTrue = BTrue; +// CHECK-NEXT: (lldb) target variable CRBTrue +// CHECK-NEXT: (const bool &) CRBTrue = {{.*}} (&::CRBTrue = true) +const char &CRCA = CA; +// CHECK-NEXT: (lldb) target variable CRCA +// CHECK-NEXT: (const char &) CRCA = {{.*}} (&::CRCA = 'A') +const char &CRCZ = CZ; +// CHECK-NEXT: (lldb) target variable CRCZ +// CHECK-NEXT: (const char &) CRCZ = {{.*}} (&::CRCZ = 'Z') +const signed char &CRSCa = SCa; +// CHECK-NEXT: (lldb) target variable CRSCa +// CHECK-NEXT: (const signed char &) CRSCa = {{.*}} (&::CRSCa = 'a') +const signed char &CRSCz = SCz; +// CHECK-NEXT: (lldb) target variable CRSCz +// CHECK-NEXT: (const signed char &) CRSCz = {{.*}} (&::CRSCz = 'z') +const unsigned char &CRUC24 = UC24; +// CHECK-NEXT: (lldb) target variable CRUC24 +// CHECK-NEXT: (const unsigned char &) CRUC24 = {{.*}} (&::CRUC24 = '\x18') +const unsigned char &CRUC42 = UC42; +// CHECK-NEXT: (lldb) target variable CRUC42 +// CHECK-NEXT: (const unsigned char &) CRUC42 = {{.*}} (&::CRUC42 = '*') +const short &CRSMax = SMax; +// CHECK-NEXT: (lldb) target variable CRSMax +// CHECK-NEXT: (const short &) CRSMax = {{.*}} (&::CRSMax = 32767) +const short &CRSMin = SMin; +// CHECK-NEXT: (lldb) target variable CRSMin +// CHECK-NEXT: (const short &) CRSMin = {{.*}} (&::CRSMin = -32768) +const unsigned short &CRUSMax = USMax; +// CHECK-NEXT: (lldb) target variable CRUSMax +// CHECK-NEXT: (const unsigned short &) CRUSMax = {{.*}} (&::CRUSMax = 65535) +const unsigned short &CRUSMin = USMin; +// CHECK-NEXT: (lldb) target variable CRUSMin +// CHECK-NEXT: (const unsigned short &) CRUSMin = {{.*}} (&::CRUSMin = 0) +const int &CRIMax = IMax; +// CHECK-NEXT: (lldb) target variable CRIMax +// CHECK-NEXT: (const int &) CRIMax = {{.*}} (&::CRIMax = 2147483647) +const int &CRIMin = IMin; +// CHECK-NEXT: (lldb) target variable CRIMin +// CHECK-NEXT: (const int &) CRIMin = {{.*}} (&::CRIMin = -2147483648) +const unsigned int &CRUIMax = UIMax; +// CHECK-NEXT: (lldb) target variable CRUIMax +// CHECK-NEXT: (const unsigned int &) CRUIMax = {{.*}} (&::CRUIMax = 4294967295) +const unsigned int &CRUIMin = UIMin; +// CHECK-NEXT: (lldb) target variable CRUIMin +// CHECK-NEXT: (const unsigned int &) CRUIMin = {{.*}} (&::CRUIMin = 0) +const long &CRLMax = LMax; +// CHECK-NEXT: (lldb) target variable CRLMax +// CHECK-NEXT: (const long &) CRLMax = {{.*}} (&::CRLMax = 2147483647) +const long &CRLMin = LMin; +// CHECK-NEXT: (lldb) target variable CRLMin +// CHECK-NEXT: (const long &) CRLMin = {{.*}} (&::CRLMin = -2147483648) +const unsigned long &CRULMax = ULMax; +// CHECK-NEXT: (lldb) target variable CRULMax +// CHECK-NEXT: (const unsigned long &) CRULMax = {{.*}} (&::CRULMax = 4294967295) +const unsigned long &CRULMin = ULMin; +// CHECK-NEXT: (lldb) target variable CRULMin +// CHECK-NEXT: (const unsigned long &) CRULMin = {{.*}} (&::CRULMin = 0) +const long long &CRLLMax = LLMax; +// CHECK-NEXT: (lldb) target variable CRLLMax +// CHECK-NEXT: (const long long &) CRLLMax = {{.*}} (&::CRLLMax = 9223372036854775807) +const long long &CRLLMin = LLMin; +// CHECK-NEXT: (lldb) target variable CRLLMin +// CHECK-NEXT: (const long long &) CRLLMin = {{.*}} (&::CRLLMin = -9223372036854775808) +const unsigned long long &CRULLMax = ULLMax; +// CHECK-NEXT: (lldb) target variable CRULLMax +// CHECK-NEXT: (const unsigned long long &) CRULLMax = {{.*}} (&::CRULLMax = 18446744073709551615) +const unsigned long long &CRULLMin = ULLMin; +// CHECK-NEXT: (lldb) target variable CRULLMin +// CHECK-NEXT: (const unsigned long long &) CRULLMin = {{.*}} (&::CRULLMin = 0) +const float &CRF = F; +// CHECK-NEXT: (lldb) target variable CRF +// CHECK-NEXT: (const float &) CRF = {{.*}} (&::CRF = 3.1415) +const double &CRD = D; +// CHECK-NEXT: (lldb) target variable CRD +// CHECK-NEXT: (const double &) CRD = {{.*}} (&::CRD = 3.1415000000000002) + +char16_t &RC16_24 = C16_24; +// CHECK: (lldb) target variable RC16_24 +// FIXME: (char16_t &) RC16_24 = {{.*}} (&::RC16_24 = U+0014) +char32_t &RC32_42 = C32_42; +// CHECK: (lldb) target variable RC32_42 +// FIXME: (char32_t &) RC32_42 = {{.*}} (&::RC32_42 = U+0x00000022) +wchar_t &RWC1 = WC1; +// CHECK: (lldb) target variable RWC1 +// FIXME: (wchar_t &) RWC1 = {{.*}} (&::RWC1 = L'1') +wchar_t &RWCP = WCP; +// CHECK: (lldb) target variable RWCP +// FIXME: (wchar_t &) RWCP = {{.*}} (&::RWCP = L'P') +const char16_t &CRC16_24 = C16_24; +// CHECK: (lldb) target variable CRC16_24 +// FIXME: (const char16_t &) CRC16_24 = {{.*}} (&::CRC16_24 = U+0014) +const char32_t &CRC32_42 = C32_42; +// CHECK: (lldb) target variable CRC32_42 +// FIXME: (const char32_t &) CRC32_42 = {{.*}} (&::CRC32_42 = U+0x00000022) +const wchar_t &CRWC1 = WC1; +// CHECK: (lldb) target variable CRWC1 +// FIXME: (const wchar_t &) CRWC1 = {{.*}} (&::CRWC1 = L'1') +const wchar_t &CRWCP = WCP; +// CHECK: (lldb) target variable CRWCP +// FIXME: (const wchar_t &) CRWCP = {{.*}} (&::CRWCP = L'P') + + +// CHECK: TranslationUnitDecl {{.*}} +// CHECK-NEXT: |-VarDecl {{.*}} BFalse 'bool' +// CHECK-NEXT: |-VarDecl {{.*}} BTrue 'bool' +// CHECK-NEXT: |-VarDecl {{.*}} CA 'char' +// CHECK-NEXT: |-VarDecl {{.*}} CZ 'char' +// CHECK-NEXT: |-VarDecl {{.*}} SCa 'signed char' +// CHECK-NEXT: |-VarDecl {{.*}} SCz 'signed char' +// CHECK-NEXT: |-VarDecl {{.*}} UC24 'unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} UC42 'unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} C16_24 'char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} C32_42 'char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} WC1 'wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} WCP 'wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} SMax 'short' +// CHECK-NEXT: |-VarDecl {{.*}} SMin 'short' +// CHECK-NEXT: |-VarDecl {{.*}} USMax 'unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} USMin 'unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} IMax 'int' +// CHECK-NEXT: |-VarDecl {{.*}} IMin 'int' +// CHECK-NEXT: |-VarDecl {{.*}} UIMax 'unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} UIMin 'unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} LMax 'long' +// CHECK-NEXT: |-VarDecl {{.*}} LMin 'long' +// CHECK-NEXT: |-VarDecl {{.*}} ULMax 'unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ULMin 'unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} LLMax 'long long' +// CHECK-NEXT: |-VarDecl {{.*}} LLMin 'long long' +// CHECK-NEXT: |-VarDecl {{.*}} ULLMax 'unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ULLMin 'unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} F 'float' +// CHECK-NEXT: |-VarDecl {{.*}} D 'double' +// CHECK-NEXT: |-VarDecl {{.*}} CBFalse 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} CBTrue 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} CCA 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} CCZ 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} CSCa 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} CSCz 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} CUC24 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} CUC42 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} CC16_24 'const char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} CC32_42 'const char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} CWC1 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} CWCP 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} CSMax 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} CSMin 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} CUSMax 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} CUSMin 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} CIMax 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} CIMin 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} CUIMax 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} CUIMin 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} CLMax 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} CLMin 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} CULMax 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} CULMin 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} CLLMax 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} CLLMin 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} CULLMax 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} CULLMin 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} CF 'const float' +// CHECK-NEXT: |-VarDecl {{.*}} CD 'const double' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprBFalse 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprBTrue 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprCA 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprCZ 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSCa 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSCz 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUC24 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUC42 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprC16_24 'const char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprC32_42 'const char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprWC1 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprWCP 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSMax 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSMin 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUSMax 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUSMin 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprIMax 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprIMin 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUIMax 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUIMin 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLMax 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLMin 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULMax 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULMin 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLLMax 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLLMin 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULLMax 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULLMin 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprF 'const float' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprD 'const double' +// CHECK-NEXT: |-VarDecl {{.*}} PBFalse 'bool *' +// CHECK-NEXT: |-VarDecl {{.*}} PBTrue 'bool *' +// CHECK-NEXT: |-VarDecl {{.*}} PCA 'char *' +// CHECK-NEXT: |-VarDecl {{.*}} PCZ 'char *' +// CHECK-NEXT: |-VarDecl {{.*}} PSCa 'signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} PSCz 'signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} PUC24 'unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} PUC42 'unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} PC16_24 'char16_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PC32_42 'char32_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PWC1 'wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PWCP 'wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PSMax 'short *' +// CHECK-NEXT: |-VarDecl {{.*}} PSMin 'short *' +// CHECK-NEXT: |-VarDecl {{.*}} PUSMax 'unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} PUSMin 'unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} PIMax 'int *' +// CHECK-NEXT: |-VarDecl {{.*}} PIMin 'int *' +// CHECK-NEXT: |-VarDecl {{.*}} PUIMax 'unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} PUIMin 'unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} PLMax 'long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLMin 'long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULMax 'unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULMin 'unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLLMax 'long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLLMin 'long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULLMax 'unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULLMin 'unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PF 'float *' +// CHECK-NEXT: |-VarDecl {{.*}} PD 'double *' +// CHECK-NEXT: |-VarDecl {{.*}} CPBFalse 'const bool *' +// CHECK-NEXT: |-VarDecl {{.*}} CPBTrue 'const bool *' +// CHECK-NEXT: |-VarDecl {{.*}} CPCA 'const char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPCZ 'const char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSCa 'const signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSCz 'const signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUC24 'const unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUC42 'const unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPC16_24 'const char16_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPC32_42 'const char32_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPWC1 'const wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPWCP 'const wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSMax 'const short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSMin 'const short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUSMax 'const unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUSMin 'const unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPIMax 'const int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPIMin 'const int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUIMax 'const unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUIMin 'const unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLMax 'const long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLMin 'const long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULMax 'const unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULMin 'const unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLLMax 'const long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLLMin 'const long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULLMax 'const unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULLMin 'const unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPF 'const float *' +// CHECK-NEXT: |-VarDecl {{.*}} CPD 'const double *' +// CHECK-NEXT: |-VarDecl {{.*}} RBFalse 'bool &' +// CHECK-NEXT: |-VarDecl {{.*}} RBTrue 'bool &' +// CHECK-NEXT: |-VarDecl {{.*}} RCA 'char &' +// CHECK-NEXT: |-VarDecl {{.*}} RCZ 'char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSCa 'signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSCz 'signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} RUC24 'unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} RUC42 'unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSMax 'short &' +// CHECK-NEXT: |-VarDecl {{.*}} RSMin 'short &' +// CHECK-NEXT: |-VarDecl {{.*}} RUSMax 'unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} RUSMin 'unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} RIMax 'int &' +// CHECK-NEXT: |-VarDecl {{.*}} RIMin 'int &' +// CHECK-NEXT: |-VarDecl {{.*}} RUIMax 'unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} RUIMin 'unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} RLMax 'long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLMin 'long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULMax 'unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULMin 'unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLLMax 'long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLLMin 'long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULLMax 'unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULLMin 'unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RF 'float &' +// CHECK-NEXT: |-VarDecl {{.*}} RD 'double &' +// CHECK-NEXT: |-VarDecl {{.*}} CRBFalse 'const bool &' +// CHECK-NEXT: |-VarDecl {{.*}} CRBTrue 'const bool &' +// CHECK-NEXT: |-VarDecl {{.*}} CRCA 'const char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRCZ 'const char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSCa 'const signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSCz 'const signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUC24 'const unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUC42 'const unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSMax 'const short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSMin 'const short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUSMax 'const unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUSMin 'const unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRIMax 'const int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRIMin 'const int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUIMax 'const unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUIMin 'const unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLMax 'const long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLMin 'const long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULMax 'const unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULMin 'const unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLLMax 'const long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLLMin 'const long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULLMax 'const unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULLMin 'const unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRF 'const float &' +// CHECK-NEXT: |-VarDecl {{.*}} CRD 'const double &' +// CHECK-NEXT: |-VarDecl {{.*}} RC16_24 'char16_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RC32_42 'char32_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RWC1 'wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RWCP 'wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRC16_24 'const char16_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRC32_42 'const char32_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRWC1 'const wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRWCP 'const wchar_t &' +// CHECK-NEXT: `-<undeserialized declarations> + +// CHECK: (lldb) quit + +int main(int argc, char **argv) { + return CIMax; +} diff --git a/lit/SymbolFile/NativePDB/local-variables.cpp b/lit/SymbolFile/NativePDB/local-variables.cpp new file mode 100644 index 000000000000..5886153a27d0 --- /dev/null +++ b/lit/SymbolFile/NativePDB/local-variables.cpp @@ -0,0 +1,161 @@ +// clang-format off + +// REQUIRES: system-windows +// RUN: %build -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/local-variables.lldbinit 2>&1 | FileCheck %s + +int Function(int Param1, char Param2) { + unsigned Local1 = Param1 + 1; + char Local2 = Param2 + 1; + ++Local1; + ++Local2; + return Local1; +} + +int main(int argc, char **argv) { + int SomeLocal = argc * 2; + return Function(SomeLocal, 'a'); +} + +// CHECK: (lldb) target create "{{.*}}local-variables.cpp.tmp.exe" +// CHECK-NEXT: Current executable set to '{{.*}}local-variables.cpp.tmp.exe' +// CHECK-NEXT: (lldb) command source -s 0 '{{.*}}local-variables.lldbinit' +// CHECK-NEXT: Executing commands in '{{.*}}local-variables.lldbinit'. +// CHECK-NEXT: (lldb) break set -n main +// CHECK-NEXT: Breakpoint 1: where = local-variables.cpp.tmp.exe`main + {{.*}} at local-variables.cpp:{{.*}}, address = {{.*}} +// CHECK-NEXT: (lldb) run a b c d e f g +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = breakpoint 1.1 +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`main(argc=8, argv={{.*}}) at local-variables.cpp:{{.*}} +// CHECK-NEXT: 14 } +// CHECK-NEXT: 15 +// CHECK-NEXT: 16 int main(int argc, char **argv) { +// CHECK-NEXT: -> 17 int SomeLocal = argc * 2; +// CHECK-NEXT: 18 return Function(SomeLocal, 'a'); +// CHECK-NEXT: 19 } +// CHECK-NEXT: 20 + +// CHECK: Process {{.*}} launched: '{{.*}}local-variables.cpp.tmp.exe' +// CHECK-NEXT: (lldb) p argc +// CHECK-NEXT: (int) $0 = 8 +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`main(argc=8, argv={{.*}}) at local-variables.cpp:{{.*}} +// CHECK-NEXT: 15 +// CHECK-NEXT: 16 int main(int argc, char **argv) { +// CHECK-NEXT: 17 int SomeLocal = argc * 2; +// CHECK-NEXT: -> 18 return Function(SomeLocal, 'a'); +// CHECK-NEXT: 19 } +// CHECK-NEXT: 20 + +// CHECK: (lldb) p SomeLocal +// CHECK-NEXT: (int) $1 = 16 +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} +// CHECK-NEXT: 6 +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 int Function(int Param1, char Param2) { +// CHECK-NEXT: -> 9 unsigned Local1 = Param1 + 1; +// CHECK-NEXT: 10 char Local2 = Param2 + 1; +// CHECK-NEXT: 11 ++Local1; +// CHECK-NEXT: 12 ++Local2; + +// CHECK: (lldb) p Param1 +// CHECK-NEXT: (int) $2 = 16 +// CHECK-NEXT: (lldb) p Param2 +// CHECK-NEXT: (char) $3 = 'a' +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} +// CHECK-NEXT: 7 +// CHECK-NEXT: 8 int Function(int Param1, char Param2) { +// CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; +// CHECK-NEXT: -> 10 char Local2 = Param2 + 1; +// CHECK-NEXT: 11 ++Local1; +// CHECK-NEXT: 12 ++Local2; +// CHECK-NEXT: 13 return Local1; + +// CHECK: (lldb) p Param1 +// CHECK-NEXT: (int) $4 = 16 +// CHECK-NEXT: (lldb) p Param2 +// CHECK-NEXT: (char) $5 = 'a' +// CHECK-NEXT: (lldb) p Local1 +// CHECK-NEXT: (unsigned int) $6 = 17 +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} +// CHECK-NEXT: 8 int Function(int Param1, char Param2) { +// CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; +// CHECK-NEXT: 10 char Local2 = Param2 + 1; +// CHECK-NEXT: -> 11 ++Local1; +// CHECK-NEXT: 12 ++Local2; +// CHECK-NEXT: 13 return Local1; +// CHECK-NEXT: 14 } + +// CHECK: (lldb) p Param1 +// CHECK-NEXT: (int) $7 = 16 +// CHECK-NEXT: (lldb) p Param2 +// CHECK-NEXT: (char) $8 = 'a' +// CHECK-NEXT: (lldb) p Local1 +// CHECK-NEXT: (unsigned int) $9 = 17 +// CHECK-NEXT: (lldb) p Local2 +// CHECK-NEXT: (char) $10 = 'b' +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} +// CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; +// CHECK-NEXT: 10 char Local2 = Param2 + 1; +// CHECK-NEXT: 11 ++Local1; +// CHECK-NEXT: -> 12 ++Local2; +// CHECK-NEXT: 13 return Local1; +// CHECK-NEXT: 14 } +// CHECK-NEXT: 15 + +// CHECK: (lldb) p Param1 +// CHECK-NEXT: (int) $11 = 16 +// CHECK-NEXT: (lldb) p Param2 +// CHECK-NEXT: (char) $12 = 'a' +// CHECK-NEXT: (lldb) p Local1 +// CHECK-NEXT: (unsigned int) $13 = 18 +// CHECK-NEXT: (lldb) p Local2 +// CHECK-NEXT: (char) $14 = 'b' +// CHECK-NEXT: (lldb) step +// CHECK-NEXT: Process {{.*}} stopped +// CHECK-NEXT: * thread #1, stop reason = step in +// CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} +// CHECK-NEXT: 10 char Local2 = Param2 + 1; +// CHECK-NEXT: 11 ++Local1; +// CHECK-NEXT: 12 ++Local2; +// CHECK-NEXT: -> 13 return Local1; +// CHECK-NEXT: 14 } +// CHECK-NEXT: 15 +// CHECK-NEXT: 16 int main(int argc, char **argv) { + +// CHECK: (lldb) p Param1 +// CHECK-NEXT: (int) $15 = 16 +// CHECK-NEXT: (lldb) p Param2 +// CHECK-NEXT: (char) $16 = 'a' +// CHECK-NEXT: (lldb) p Local1 +// CHECK-NEXT: (unsigned int) $17 = 18 +// CHECK-NEXT: (lldb) p Local2 +// CHECK-NEXT: (char) $18 = 'c' +// CHECK-NEXT: (lldb) continue +// CHECK-NEXT: Process {{.*}} resuming +// CHECK-NEXT: Process {{.*}} exited with status = 18 (0x00000012) + +// CHECK: (lldb) target modules dump ast +// CHECK-NEXT: Dumping clang ast for {{.*}} modules. +// CHECK-NEXT: TranslationUnitDecl +// CHECK-NEXT: |-FunctionDecl {{.*}} main 'int (int, char **)' +// CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int' +// CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **' +// CHECK-NEXT: |-FunctionDecl {{.*}} Function 'int (int, char)' +// CHECK-NEXT: | |-ParmVarDecl {{.*}} Param1 'int' +// CHECK-NEXT: | `-ParmVarDecl {{.*}} Param2 'char' diff --git a/lit/SymbolFile/NativePDB/nested-types.cpp b/lit/SymbolFile/NativePDB/nested-types.cpp new file mode 100644 index 000000000000..e9bee690d301 --- /dev/null +++ b/lit/SymbolFile/NativePDB/nested-types.cpp @@ -0,0 +1,153 @@ +// clang-format off +// REQUIRES: lld + +// Test various interesting cases for AST reconstruction. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/nested-types.lldbinit 2>&1 | FileCheck %s + +struct S { + struct NestedStruct { + int A = 0; + int B = 1; + }; + + enum class NestedEnum { + EnumValue1 = 0, + EnumValue2 = 1, + }; + int C = 2; + int D = 3; + using VoidPtrT = void *; + VoidPtrT DD = nullptr; +}; +struct T { + using NestedTypedef = int; + using NestedTypedef2 = S; + + struct NestedStruct { + int E = 4; + int F = 5; + }; + + using NestedStructAlias = NestedStruct; + using NST = S::NestedStruct; + + NestedTypedef NT = 4; + + using U = struct { + int G = 6; + int H = 7; + }; +}; + +template<typename Param> +class U { +public: + // See llvm.org/pr39607. clang-cl currently doesn't emit an important debug + // info record for nested template instantiations, so we can't reconstruct + // a proper DeclContext hierarchy for these. As such, U<X>::V<Y> will show up + // in the global namespace. + template<typename Param> + struct V { + Param I = 8; + Param J = 9; + + using W = T::NestedTypedef; + using X = U<int>; + }; + + struct W { + Param M = 12; + Param N = 13; + }; + Param K = 10; + Param L = 11; + using Y = V<int>; + using Z = V<T>; +}; + +constexpr S GlobalA; +constexpr S::NestedStruct GlobalB; +constexpr T GlobalC; +constexpr T::NestedStruct GlobalD; +constexpr T::U GlobalE; +constexpr U<int> GlobalF; +constexpr U<int>::V<int> GlobalG; +constexpr U<int>::W GlobalH; +constexpr S::NestedEnum GlobalEnum = S::NestedEnum::EnumValue1; + + +int main(int argc, char **argv) { + return 0; +} + + + +// CHECK: (lldb) target variable -T GlobalA +// CHECK: (const S) GlobalA = { +// CHECK: (int) C = 2 +// CHECK: (int) D = 3 +// CHECK: (void *) DD = 0x00000000 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalB +// CHECK: (const S::NestedStruct) GlobalB = { +// CHECK: (int) A = 0 +// CHECK: (int) B = 1 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalC +// CHECK: (const T) GlobalC = { +// CHECK: (int) NT = 4 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalD +// CHECK: (const T::NestedStruct) GlobalD = { +// CHECK: (int) E = 4 +// CHECK: (int) F = 5 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalE +// CHECK: (const T::U) GlobalE = { +// CHECK: (int) G = 6 +// CHECK: (int) H = 7 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalF +// CHECK: (const U<int>) GlobalF = { +// CHECK: (int) K = 10 +// CHECK: (int) L = 11 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalG +// CHECK: (const U<int>::V<int>) GlobalG = { +// CHECK: (int) I = 8 +// CHECK: (int) J = 9 +// CHECK: } +// CHECK: (lldb) target variable -T GlobalEnum +// CHECK: (const S::NestedEnum) GlobalEnum = EnumValue1 +// CHECK: (lldb) target modules dump ast +// CHECK: Dumping clang ast for 1 modules. +// CHECK: TranslationUnitDecl {{.*}} +// CHECK: |-CXXRecordDecl {{.*}} struct S definition +// CHECK: | |-FieldDecl {{.*}} C 'int' +// CHECK: | |-FieldDecl {{.*}} D 'int' +// CHECK: | |-FieldDecl {{.*}} DD 'void *' +// CHECK: | |-CXXRecordDecl {{.*}} struct NestedStruct definition +// CHECK: | | |-FieldDecl {{.*}} A 'int' +// CHECK: | | `-FieldDecl {{.*}} B 'int' +// CHECK: | `-EnumDecl {{.*}} NestedEnum +// CHECK: | |-EnumConstantDecl {{.*}} EnumValue1 'S::NestedEnum' +// CHECK: | `-EnumConstantDecl {{.*}} EnumValue2 'S::NestedEnum' +// CHECK: |-CXXRecordDecl {{.*}} struct T definition +// CHECK: | |-FieldDecl {{.*}} NT 'int' +// CHECK: | |-CXXRecordDecl {{.*}} struct NestedStruct definition +// CHECK: | | |-FieldDecl {{.*}} E 'int' +// CHECK: | | `-FieldDecl {{.*}} F 'int' +// CHECK: | `-CXXRecordDecl {{.*}} struct U definition +// CHECK: | |-FieldDecl {{.*}} G 'int' +// CHECK: | `-FieldDecl {{.*}} H 'int' +// CHECK: |-CXXRecordDecl {{.*}} class U<int> definition +// CHECK: | |-FieldDecl {{.*}} K 'int' +// CHECK: | |-FieldDecl {{.*}} L 'int' +// CHECK: | `-CXXRecordDecl {{.*}} struct W definition +// CHECK: | |-FieldDecl {{.*}} M 'int' +// CHECK: | `-FieldDecl {{.*}} N 'int' +// CHECK: |-CXXRecordDecl {{.*}} struct U<int>::V<int> definition +// CHECK: | |-FieldDecl {{.*}} I 'int' +// CHECK: | `-FieldDecl {{.*}} J 'int' diff --git a/lit/SymbolFile/NativePDB/s_constant.cpp b/lit/SymbolFile/NativePDB/s_constant.cpp new file mode 100644 index 000000000000..7603a4daba40 --- /dev/null +++ b/lit/SymbolFile/NativePDB/s_constant.cpp @@ -0,0 +1,115 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can display S_CONSTANT records. + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj +// RUN: %build --compiler=clang-cl --nodefaultlib --mode=link -o %t.exe -- %t.obj +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s + +// clang-cl cannot generate S_CONSTANT records, but we need to test that we can +// handle them for compatibility with MSVC, which does emit them. This test +// case was generated by compiling this file with MSVC and copying the bytes +// that they emit for S_CONSTANT records. Then we compile the same code with +// clang to get a .s file, and replace all S_LDATA32 records with the bytes from +// the S_CONSTANT records. This way we end up with a .s file that contains +// symbol records that clang-cl won't generate. + +namespace A { +namespace B { +namespace C { + enum LargeUnsignedEnum : unsigned long long { + LUE_A = 0ULL, + LUE_B = 1000ULL, + LUE_C = 18446744073709551600ULL, + }; + + enum LargeSignedEnum : long long { + LSE_A = 0LL, + LSE_B = 9223372036854775000LL, + LSE_C = -9223372036854775000LL, + }; + + enum UnsignedEnum : unsigned int { + UE_A = 0, + UE_B = 1000, + UE_C = 4294000000, + }; + + enum SignedEnum : int { + SE_A = 0, + SE_B = 2147000000, + SE_C = -2147000000, + }; + + enum SmallUnsignedEnum : unsigned char { + SUE_A = 0, + SUE_B = 100, + SUE_C = 200, + }; + + enum SmallSignedEnum : char { + SSE_A = 0, + SSE_B = 100, + SSE_C = -100, + }; +} +} +} + +using namespace A::B::C; + +constexpr LargeUnsignedEnum GlobalLUEA = LUE_A; +constexpr LargeUnsignedEnum GlobalLUEB = LUE_B; +constexpr LargeUnsignedEnum GlobalLUEC = LUE_C; + +constexpr LargeSignedEnum GlobalLSEA = LSE_A; +constexpr LargeSignedEnum GlobalLSEB = LSE_B; +constexpr LargeSignedEnum GlobalLSEC = LSE_C; + +constexpr UnsignedEnum GlobalUEA = UE_A; +constexpr UnsignedEnum GlobalUEB = UE_B; +constexpr UnsignedEnum GlobalUEC = UE_C; + +constexpr SignedEnum GlobalSEA = SE_A; +constexpr SignedEnum GlobalSEB = SE_B; +constexpr SignedEnum GlobalSEC = SE_C; + +constexpr SmallUnsignedEnum GlobalSUEA = SUE_A; +constexpr SmallUnsignedEnum GlobalSUEB = SUE_B; +constexpr SmallUnsignedEnum GlobalSUEC = SUE_C; + +constexpr SmallSignedEnum GlobalSSEA = SSE_A; +constexpr SmallSignedEnum GlobalSSEB = SSE_B; +constexpr SmallSignedEnum GlobalSSEC = SSE_C; + +int main(int argc, char **argv) { + return 0; +} + +// CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEA = LUE_A +// CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEB = LUE_B + +// X-FAIL: Something is outputting bad debug info here, maybe cl. +// CHECK: (const A::B::C::LargeUnsignedEnum) GlobalLUEC = {{.*}} + +// CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEA = LSE_A +// CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEB = LSE_B +// CHECK: (const A::B::C::LargeSignedEnum) GlobalLSEC = LSE_C + +// CHECK: (const A::B::C::UnsignedEnum) GlobalUEA = UE_A +// CHECK: (const A::B::C::UnsignedEnum) GlobalUEB = UE_B +// CHECK: (const A::B::C::UnsignedEnum) GlobalUEC = UE_C + +// CHECK: (const A::B::C::SignedEnum) GlobalSEA = SE_A +// CHECK: (const A::B::C::SignedEnum) GlobalSEB = SE_B +// CHECK: (const A::B::C::SignedEnum) GlobalSEC = SE_C + +// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEA = SUE_A +// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEB = SUE_B +// CHECK: (const A::B::C::SmallUnsignedEnum) GlobalSUEC = SUE_C + +// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEA = SSE_A +// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEB = SSE_B +// CHECK: (const A::B::C::SmallSignedEnum) GlobalSSEC = SSE_C diff --git a/lit/SymbolFile/NativePDB/source-list.cpp b/lit/SymbolFile/NativePDB/source-list.cpp new file mode 100644 index 000000000000..6b749b082e3d --- /dev/null +++ b/lit/SymbolFile/NativePDB/source-list.cpp @@ -0,0 +1,42 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can set display source of functions. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/source-list.lldbinit | FileCheck %s + + + +// Some context lines before +// the function. + + +int main(int argc, char **argv) { + // Here are some comments. + // That we should print when listing source. + return 0; +} + +// Some context lines after +// the function. + +// check lines go at the end so that line numbers stay stable when +// changing this file. + +// CHECK: (lldb) source list -n main +// CHECK: File: {{.*}}source-list.cpp +// CHECK: 10 +// CHECK: 11 // Some context lines before +// CHECK: 12 // the function. +// CHECK: 13 +// CHECK: 14 +// CHECK: 15 int main(int argc, char **argv) { +// CHECK: 16 // Here are some comments. +// CHECK: 17 // That we should print when listing source. +// CHECK: 18 return 0; +// CHECK: 19 } +// CHECK: 20 +// CHECK: 21 // Some context lines after +// CHECK: 22 // the function. +// CHECK: 23 diff --git a/lit/SymbolFile/NativePDB/tag-types.cpp b/lit/SymbolFile/NativePDB/tag-types.cpp new file mode 100644 index 000000000000..947fe20d17d7 --- /dev/null +++ b/lit/SymbolFile/NativePDB/tag-types.cpp @@ -0,0 +1,235 @@ +// clang-format off +// REQUIRES: lld + +// Test that we can display tag types. +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +// RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s + +// Test struct +struct Struct { + // Test builtin types, which are represented by special CodeView type indices. + bool B; + char C; + signed char SC; + unsigned char UC; + char16_t C16; + char32_t C32; + wchar_t WC; + short S; + unsigned short US; + int I; + unsigned int UI; + long L; + unsigned long UL; + long long LL; + unsigned long long ULL; + float F; + double D; + long double LD; +}; + +// Test class +class Class { +public: + // Test pointers to builtin types, which are represented by different special + // CodeView type indices. + bool *PB; + char *PC; + signed char *PSC; + unsigned char *PUC; + char16_t *PC16; + char32_t *PC32; + wchar_t *PWC; + short *PS; + unsigned short *PUS; + int *PI; + unsigned int *PUI; + long *PL; + unsigned long *PUL; + long long *PLL; + unsigned long long *PULL; + float *PF; + double *PD; + long double *PLD; +}; + +// Test union +union Union { + // Test modified types. + const bool *PB; + const char *PC; + const signed char *PSC; + const unsigned char *PUC; + const char16_t *PC16; + const char32_t *PC32; + const wchar_t *PWC; + const short *PS; + const unsigned short *PUS; + const int *PI; + const unsigned int *PUI; + const long *PL; + const unsigned long *PUL; + const long long *PLL; + const unsigned long long *PULL; + const float *PF; + const double *PD; + const long double *PLD; +}; + +struct OneMember { + int N = 0; +}; + + +// Test single inheritance. +class Derived : public Class { +public: + explicit Derived() + : Reference(*this), RefMember(Member), RValueRefMember((OneMember&&)Member) {} + + // Test reference to self, to make sure we don't end up in an + // infinite cycle. + Derived &Reference; + + // Test aggregate class member. + OneMember Member; + + // And modified aggregate class member. + const OneMember ConstMember; + volatile OneMember VolatileMember; + const volatile OneMember CVMember; + + // And all types of pointers to class members + OneMember *PtrMember; + OneMember &RefMember; + OneMember &&RValueRefMember; +}; + +// Test multiple inheritance, as well as protected and private inheritance. +class Derived2 : protected Class, private Struct { +public: + // Test static data members + static unsigned StaticDataMember; +}; + +unsigned Derived2::StaticDataMember = 0; + +// Test scoped enums and unscoped enums. +enum class EnumInt { + A = 1, + B = 2 +}; + +// Test explicit underlying types +enum EnumShort : short { + ES_A = 2, + ES_B = 3 +}; + +int main(int argc, char **argv) { + Struct S; + Class C; + Union U; + Derived D; + Derived2 D2; + EnumInt EI; + EnumShort ES; + + return 0; +} + +// CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' +// CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit' +// CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'. +// CHECK-NEXT: (lldb) type lookup -- Struct +// CHECK-NEXT: struct Struct { +// CHECK-NEXT: bool B; +// CHECK-NEXT: char C; +// CHECK-NEXT: signed char SC; +// CHECK-NEXT: unsigned char UC; +// CHECK-NEXT: char16_t C16; +// CHECK-NEXT: char32_t C32; +// CHECK-NEXT: wchar_t WC; +// CHECK-NEXT: short S; +// CHECK-NEXT: unsigned short US; +// CHECK-NEXT: int I; +// CHECK-NEXT: unsigned int UI; +// CHECK-NEXT: long L; +// CHECK-NEXT: unsigned long UL; +// CHECK-NEXT: long long LL; +// CHECK-NEXT: unsigned long long ULL; +// CHECK-NEXT: float F; +// CHECK-NEXT: double D; +// CHECK-NEXT: double LD; +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- Class +// CHECK-NEXT: class Class { +// CHECK-NEXT: bool *PB; +// CHECK-NEXT: char *PC; +// CHECK-NEXT: signed char *PSC; +// CHECK-NEXT: unsigned char *PUC; +// CHECK-NEXT: char16_t *PC16; +// CHECK-NEXT: char32_t *PC32; +// CHECK-NEXT: wchar_t *PWC; +// CHECK-NEXT: short *PS; +// CHECK-NEXT: unsigned short *PUS; +// CHECK-NEXT: int *PI; +// CHECK-NEXT: unsigned int *PUI; +// CHECK-NEXT: long *PL; +// CHECK-NEXT: unsigned long *PUL; +// CHECK-NEXT: long long *PLL; +// CHECK-NEXT: unsigned long long *PULL; +// CHECK-NEXT: float *PF; +// CHECK-NEXT: double *PD; +// CHECK-NEXT: double *PLD; +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- Union +// CHECK-NEXT: union Union { +// CHECK-NEXT: const bool *PB; +// CHECK-NEXT: const char *PC; +// CHECK-NEXT: const signed char *PSC; +// CHECK-NEXT: const unsigned char *PUC; +// CHECK-NEXT: const char16_t *PC16; +// CHECK-NEXT: const char32_t *PC32; +// CHECK-NEXT: const wchar_t *PWC; +// CHECK-NEXT: const short *PS; +// CHECK-NEXT: const unsigned short *PUS; +// CHECK-NEXT: const int *PI; +// CHECK-NEXT: const unsigned int *PUI; +// CHECK-NEXT: const long *PL; +// CHECK-NEXT: const unsigned long *PUL; +// CHECK-NEXT: const long long *PLL; +// CHECK-NEXT: const unsigned long long *PULL; +// CHECK-NEXT: const float *PF; +// CHECK-NEXT: const double *PD; +// CHECK-NEXT: const double *PLD; +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- Derived +// CHECK-NEXT: class Derived : public Class { +// CHECK-NEXT: Derived &Reference; +// CHECK-NEXT: OneMember Member; +// CHECK-NEXT: const OneMember ConstMember; +// CHECK-NEXT: volatile OneMember VolatileMember; +// CHECK-NEXT: const volatile OneMember CVMember; +// CHECK-NEXT: OneMember *PtrMember; +// CHECK-NEXT: OneMember &RefMember; +// CHECK-NEXT: OneMember &&RValueRefMember; +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- Derived2 +// CHECK-NEXT: class Derived2 : protected Class, private Struct { +// CHECK-NEXT: static unsigned int StaticDataMember; +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- EnumInt +// CHECK-NEXT: enum EnumInt { +// CHECK-NEXT: A, +// CHECK-NEXT: B +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- EnumShort +// CHECK-NEXT: enum EnumShort { +// CHECK-NEXT: ES_A, +// CHECK-NEXT: ES_B +// CHECK-NEXT: } +// CHECK-NEXT: (lldb) type lookup -- InvalidType +// CHECK-NEXT: no type was found matching 'InvalidType' diff --git a/lit/SymbolFile/NativePDB/typedefs.cpp b/lit/SymbolFile/NativePDB/typedefs.cpp new file mode 100644 index 000000000000..738fbe615d90 --- /dev/null +++ b/lit/SymbolFile/NativePDB/typedefs.cpp @@ -0,0 +1,71 @@ +// clang-format off + +// REQUIRES: system-windows +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -dump-ast %t.exe | FileCheck %s + +namespace A { + namespace B { + using NamespaceTypedef = double; + } + template<typename T> + class C { + public: + using ClassTypedef = T; + }; + using ClassTypedef = C<char>::ClassTypedef; + using ClassTypedef2 = C<wchar_t>::ClassTypedef; + + template<typename T> + using AliasTemplate = typename C<T>::ClassTypedef; +} + +namespace { + using AnonNamespaceTypedef = bool; +} + +using IntTypedef = int; + +using ULongArrayTypedef = unsigned long[10]; + +using RefTypedef = long double*&; + +using FuncPtrTypedef = long long(*)(int&, unsigned char**, short[], const double, volatile bool); + +using VarArgsFuncTypedef = char(*)(void*, long, unsigned short, unsigned int, ...); + +using VarArgsFuncTypedefA = float(*)(...); + +int main(int argc, char **argv) { + long double *Ptr; + + A::B::NamespaceTypedef *X0; + A::C<char>::ClassTypedef *X1; + A::C<wchar_t>::ClassTypedef *X2; + AnonNamespaceTypedef *X3; + IntTypedef *X4; + ULongArrayTypedef *X5; + RefTypedef X6 = Ptr; + FuncPtrTypedef X7; + VarArgsFuncTypedef X8; + VarArgsFuncTypedefA X9; + A::AliasTemplate<float> X10; + return 0; +} + + +// CHECK: namespace `anonymous namespace' { +// CHECK-NEXT: typedef bool AnonNamespaceTypedef; +// CHECK-NEXT: } +// CHECK-NEXT: typedef unsigned long ULongArrayTypedef[10]; +// CHECK-NEXT: typedef double *&RefTypedef; +// CHECK-NEXT: namespace A { +// CHECK-NEXT: namespace B { +// CHECK-NEXT: typedef double NamespaceTypedef; +// CHECK-NEXT: } +// CHECK-NEXT: typedef float AliasTemplate<float>; +// CHECK-NEXT: } +// CHECK-NEXT: typedef long long (*FuncPtrTypedef)(int &, unsigned char **, short *, const double, volatile bool); +// CHECK-NEXT: typedef char (*VarArgsFuncTypedef)(void *, long, unsigned short, unsigned int, ...); +// CHECK-NEXT: typedef float (*VarArgsFuncTypedefA)(...); +// CHECK-NEXT: typedef int IntTypedef; diff --git a/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp b/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp new file mode 100644 index 000000000000..8c9e26744d5f --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp @@ -0,0 +1,55 @@ +namespace N0 { +namespace N1 { + +namespace { +enum Enum { Enum_0 = 1, Enum_1 = 2, Enum_2 = 4, Enum_3 = 8 }; +} + +Enum Global = Enum_3; + +struct Base { + Enum m_e = Enum_1; +}; + +class Class : public Base { +public: + Class(Enum e) : m_ce(e) {} + + static int StaticFunc(const Class &c) { + return c.PrivateFunc(c.m_inner) + Global + ClassStatic; + } + + const Enum m_ce; + + static int ClassStatic; + +private: + struct Inner { + char x; + short y; + int z; + }; + + int PrivateFunc(const Inner &i) const { return i.z; } + + Inner m_inner{}; +}; +int Class::ClassStatic = 7; + +template<typename T> +struct Template { + template<Enum E> + void TemplateFunc() { + T::StaticFunc(T(E)); + } +}; + +void foo() { Template<Class>().TemplateFunc<Enum_0>(); } + +} // namespace N1 +} // namespace N0 + +int main() { + N0::N1::foo(); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp b/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp new file mode 100644 index 000000000000..60854c04c60a --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp @@ -0,0 +1,20 @@ +int FuncCCall() { return 0; } +auto FuncCCallPtr = &FuncCCall; + +int __stdcall FuncStdCall() { return 0; } +auto FuncStdCallPtr = &FuncStdCall; + +int __fastcall FuncFastCall() { return 0; } +auto FuncFastCallPtr = &FuncFastCall; + +int __vectorcall FuncVectorCall() { return 0; } +auto FuncVectorCallPtr = &FuncVectorCall; + +struct S { + int FuncThisCall() { return 0; } +}; +auto FuncThisCallPtr = &S::FuncThisCall; + +int main() { + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp b/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp new file mode 100644 index 000000000000..3c4b005cdf1b --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp @@ -0,0 +1,111 @@ +// To avoid linking MSVC specific libs, we don't test virtual/override methods +// that needs vftable support in this file. + +// Enum. +enum Enum { RED, GREEN, BLUE }; +Enum EnumVar; + +// Union. +union Union { + short Row; + unsigned short Col; + int Line : 16; // Test named bitfield. + short : 8; // Unnamed bitfield symbol won't be generated in PDB. + long Table; +}; +Union UnionVar; + +// Struct. +struct Struct; +typedef Struct StructTypedef; + +struct Struct { + bool A; + unsigned char UCharVar; + unsigned int UIntVar; + long long LongLongVar; + Enum EnumVar; // Test struct has UDT member. + int array[10]; +}; +struct Struct StructVar; + +struct _List; // Forward declaration. +struct Complex { + struct _List *array[90]; + struct { // Test unnamed struct. MSVC treats it as `int x` + int x; + }; + union { // Test unnamed union. MSVC treats it as `int a; float b;` + int a; + float b; + }; +}; +struct Complex c; + +struct _List { // Test doubly linked list. + struct _List *current; + struct _List *previous; + struct _List *next; +}; +struct _List ListVar; + +typedef struct { + int a; +} UnnamedStruct; // Test unnamed typedef-ed struct. +UnnamedStruct UnnanmedVar; + +// Class. +namespace MemberTest { +class Base { +public: + Base() {} + ~Base() {} + +public: + int Get() { return 0; } + +protected: + int a; +}; +class Friend { +public: + int f() { return 3; } +}; +class Class : public Base { // Test base class. + friend Friend; + static int m_static; // Test static member variable. +public: + Class() : m_public(), m_private(), m_protected() {} + explicit Class(int a) { m_public = a; } // Test first reference of m_public. + ~Class() {} + + static int StaticMemberFunc(int a, ...) { + return 1; + } // Test static member function. + int Get() { return 1; } + int f(Friend c) { return c.f(); } + inline bool operator==(const Class &rhs) const // Test operator. + { + return (m_public == rhs.m_public); + } + +public: + int m_public; + struct Struct m_struct; + +private: + Union m_union; + int m_private; + +protected: + friend class Friend; + int m_protected; +}; +} // namespace MemberTest + +int main() { + MemberTest::Base B1; + B1.Get(); + MemberTest::Class::StaticMemberFunc(1, 10, 2); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp b/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp new file mode 100644 index 000000000000..3785cd3c64c7 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp @@ -0,0 +1,20 @@ +namespace N0 { +namespace N1 { + +char *buf0 = nullptr; +char buf1[] = {0, 1, 2, 3, 4, 5, 6, 7}; + +char sum(char *buf, int size) { + char result = 0; + for (int i = 0; i < size; i++) + result += buf[i]; + return result; +} + +} // namespace N1 +} // namespace N0 + +int main() { + char result = N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script new file mode 100644 index 000000000000..d31a2abb68a2 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script @@ -0,0 +1,7 @@ +breakpoint set --file ExpressionsTest.cpp --line 19 +run +print result +print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)) +print N1::sum(N1::buf1, sizeof(N1::buf1)) +print sum(buf1, sizeof(buf1)) +print sum(buf1, 1000000000) diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script new file mode 100644 index 000000000000..dac887faa5bb --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script @@ -0,0 +1 @@ +print sum(buf0, 1) diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script new file mode 100644 index 000000000000..b19240baf99d --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script @@ -0,0 +1,2 @@ +print sum(buf0, result - 28) +print sum(buf1 + 3, 3) diff --git a/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp b/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp new file mode 100644 index 000000000000..6612c30f00df --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp @@ -0,0 +1,23 @@ +int main() { + // Test pointer to array. + int array[2][4]; + int(*array_pointer)[2][4] = &array; + + struct ST { + int a; + int f(int x) { return 1; } + }; + + ST s = {10}; + + // Test pointer to a local. + int *p_int = &s.a; + + // Test pointer to data member. + int ST::*p_member_field = &ST::a; + + // Test pointer to member function. + int (ST::*p_member_method)(int) = &ST::f; + + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp b/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp index 8e516201644c..de13a5b430c1 100644 --- a/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ b/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,9 @@ EnumClass EnumClassVar; enum struct EnumStruct { red, blue, black }; EnumStruct EnumStructVar; +typedef signed char SCharTypedef; +SCharTypedef SCVar; + typedef char16_t WChar16Typedef; WChar16Typedef WC16Var; diff --git a/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp new file mode 100644 index 000000000000..59a4fc585d77 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp @@ -0,0 +1,61 @@ +struct A { + explicit A(int u) { _u._u3 = u; } + A(const A &) = default; + virtual ~A() = default; + +private: + union U { + char _u1; + short _u2; + int _u3; + }; + + A::U _u; +}; + +#pragma pack(push, 1) +template <int I> struct B : public virtual A { + B(char a, unsigned short b, int c) : A(a + b + c), _a(a), _b(b), _c(c) {} + +private: + char _a; + unsigned short : 3; + unsigned short _b : 6; + unsigned short : 4; + int _c; +}; +#pragma pack(pop) + +#pragma pack(push, 16) +class C : private virtual B<0>, public virtual B<1>, private B<2>, public B<3> { +public: + C(char x, char y, char z) + : A(x - y + z), B<0>(x, y, z), B<1>(x * 2, y * 2, z * 2), + B<2>(x * 3, y * 3, z * 3), B<3>(x * 4, y * 4, z * 4), _x(x * 5), + _y(y * 5), _z(z * 5) {} + + static int abc; + +private: + int _x; + short _y; + char _z; +}; +int C::abc = 123; +#pragma pack(pop) + +class List { +public: + List() = default; + List(List *p, List *n, C v) : Prev(p), Next(n), Value(v) {} + +private: + List *Prev = nullptr; + List *Next = nullptr; + C Value{1, 2, 3}; +}; + +int main() { + List ls[16]; + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script new file mode 100644 index 000000000000..91de55f4ade4 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script @@ -0,0 +1,4 @@ +breakpoint set --file UdtLayoutTest.cpp --line 60 +run +target variable +frame variable diff --git a/lit/SymbolFile/PDB/Inputs/VBases.cpp b/lit/SymbolFile/PDB/Inputs/VBases.cpp new file mode 100644 index 000000000000..a5e84bd36571 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/VBases.cpp @@ -0,0 +1,16 @@ +struct A { + char a = 1; +}; + +struct B { + int b = 2; +}; + +struct C : virtual A, virtual B { + short c = 3; +}; + +int main() { + C c{}; + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/VBases.script b/lit/SymbolFile/PDB/Inputs/VBases.script new file mode 100644 index 000000000000..8675890b76e1 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/VBases.script @@ -0,0 +1,7 @@ +breakpoint set --file VBases.cpp --line 15 + +run + +print c + +frame variable c
\ No newline at end of file diff --git a/lit/SymbolFile/PDB/ast-restore.test b/lit/SymbolFile/PDB/ast-restore.test new file mode 100644 index 000000000000..2158fc1b3d44 --- /dev/null +++ b/lit/SymbolFile/PDB/ast-restore.test @@ -0,0 +1,82 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/AstRestoreTest.cpp +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=INNER %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=TEMPLATE %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=FOO %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=MAIN %s + +ENUM: Module: {{.*}} +ENUM: namespace N0 { +ENUM: namespace N1 { +ENUM: namespace { +ENUM: enum Enum { +ENUM: Enum_0, +ENUM: Enum_1, +ENUM: Enum_2, +ENUM: Enum_3 +ENUM: }; +ENUM: } +ENUM: } +ENUM: } + +GLOBAL: Module: {{.*}} +GLOBAL: namespace N0 { +GLOBAL: namespace N1 { +GLOBAL: N0::N1::(anonymous namespace)::Enum Global; +GLOBAL: } +GLOBAL: } + +BASE: Module: {{.*}} +BASE: namespace N0 { +BASE: namespace N1 { +BASE: struct Base { +BASE: N0::N1::(anonymous namespace)::Enum m_e; +BASE: }; +BASE: } +BASE: } + +CLASS: Module: {{.*}} +CLASS: namespace N0 { +CLASS: namespace N1 { +CLASS: class Class : public N0::N1::Base { +CLASS-DAG: const N0::N1::(anonymous namespace)::Enum m_ce; +CLASS-DAG: static int ClassStatic; +CLASS-DAG: N0::N1::Class::Inner m_inner; +CLASS-DAG: {{(inline )?}}Class(N0::N1::(anonymous namespace)::Enum); +CLASS-DAG: static {{(inline )?}}int StaticFunc(const N0::N1::Class &); +CLASS-DAG: {{(inline )?}}int PrivateFunc(const N0::N1::Class::Inner &); +CLASS: }; +CLASS: } +CLASS: } + +INNER: Module: {{.*}} +INNER: namespace N0 { +INNER: namespace N1 { +INNER: class Class : public N0::N1::Base { +INNER: struct Inner { +INNER: char x; +INNER: short y; +INNER: int z; +INNER: }; +INNER: }; +INNER: } +INNER: } + +TEMPLATE: Module: {{.*}} +TEMPLATE: struct Template<N0::N1::Class> { +TEMPLATE: inline void TemplateFunc<1>(); +TEMPLATE: }; + +FOO: Module: {{.*}} +FOO: namespace N0 { +FOO: namespace N1 { +FOO: void foo(); +FOO: } +FOO: } + +MAIN: Module: {{.*}} +MAIN: int main(); diff --git a/lit/SymbolFile/PDB/calling-conventions.test b/lit/SymbolFile/PDB/calling-conventions.test new file mode 100644 index 000000000000..a85dc65ff04d --- /dev/null +++ b/lit/SymbolFile/PDB/calling-conventions.test @@ -0,0 +1,10 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe %S/Inputs/CallingConventionsTest.cpp +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s + +CHECK: Module: {{.*}} +CHECK-DAG: int (*FuncCCallPtr)(); +CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall)); +CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall)); +CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall)); +CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall)); diff --git a/lit/SymbolFile/PDB/class-layout.test b/lit/SymbolFile/PDB/class-layout.test new file mode 100644 index 000000000000..5c0194485d76 --- /dev/null +++ b/lit/SymbolFile/PDB/class-layout.test @@ -0,0 +1,92 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/ClassLayoutTest.cpp.obj %S/Inputs/ClassLayoutTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/ClassLayoutTest.cpp.exe %T/ClassLayoutTest.cpp.obj +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNION %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=STRUCT %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=COMPLEX %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=LIST %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNNAMED-STRUCT %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=BASE %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=FRIEND %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=CLASS %s + +CHECK: Module [[MOD:.*]] +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) +CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\ClassLayoutTest.cpp' + +ENUM: name = "Enum", size = 4, decl = ClassLayoutTest.cpp:5 +ENUM-SAME: enum Enum { +ENUM: RED, +ENUM: GREEN, +ENUM: BLUE +ENUM:} + +UNION: name = "Union", size = 4, decl = ClassLayoutTest.cpp:9 +UNION-SAME: union Union { +UNION: short Row; +UNION: unsigned short Col; +UNION: int Line : 16; +UNION: long Table; +UNION:} + +STRUCT: name = "Struct", size = 64, decl = ClassLayoutTest.cpp:22 +STRUCT-SAME: struct Struct { +STRUCT: bool A; +STRUCT: unsigned char UCharVar; +STRUCT: unsigned int UIntVar; +STRUCT: long long LongLongVar; +STRUCT: Enum EnumVar; +STRUCT: int array[10]; +STRUCT:} + +COMPLEX: name = "Complex", size = 368, decl = ClassLayoutTest.cpp:33 +COMPLEX-SAME: struct Complex { +COMPLEX: _List *array[90]; +COMPLEX: int x; +COMPLEX: int a; +COMPLEX: float b; +COMPLEX:} + +LIST: name = "_List", size = 12, decl = ClassLayoutTest.cpp:45 +LIST-SAME: struct _List { +LIST: _List *current; +LIST: _List *previous; +LIST: _List *next; +LIST:} + +UNNAMED-STRUCT: name = "UnnamedStruct", size = 4, decl = ClassLayoutTest.cpp:52 +UNNAMED-STRUCT-SAME: struct UnnamedStruct { +UNNAMED-STRUCT: int a; +UNNAMED-STRUCT:} + +BASE: name = "Base", size = 4, decl = ClassLayoutTest.cpp:59 +BASE-SAME: class Base { +BASE: int a; +BASE: Base(); +BASE: ~Base(); +BASE: int Get(); +BASE:} + +FRIEND: name = "Friend", size = 1, decl = ClassLayoutTest.cpp:70 +FRIEND-SAME: class Friend { +FRIEND: int f(); +FRIEND: } + +CLASS: name = "Class", size = 88, decl = ClassLayoutTest.cpp:74 +CLASS-SAME: class Class : public MemberTest::Base { +CLASS: static int m_static; +CLASS: int m_public; +CLASS: Struct m_struct; +CLASS: Union m_union; +CLASS: int m_private; +CLASS: int m_protected; +CLASS: Class(); +CLASS: Class(int); +CLASS: ~Class(); +CLASS: static int {{.*}}StaticMemberFunc(int, ...); +CLASS: int Get(); +CLASS: int f(MemberTest::Friend); +CLASS: bool operator==(const MemberTest::Class &) +CLASS:} diff --git a/lit/SymbolFile/PDB/compilands.test b/lit/SymbolFile/PDB/compilands.test index 2e7b014fe966..d719ab7669d8 100644 --- a/lit/SymbolFile/PDB/compilands.test +++ b/lit/SymbolFile/PDB/compilands.test @@ -1,9 +1,11 @@ -REQUIRES: windows -RUN: clang-cl /Z7 %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.exe -RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.obj %S/Inputs/CompilandsTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.exe %T/CompilandsTest.cpp.obj +RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s +RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s ; Link default libraries CHECK: Module [[CU:.*]] -CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[CU]]) +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[CU]]) CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\CompilandsTest.cpp' diff --git a/lit/SymbolFile/PDB/enums-layout.test b/lit/SymbolFile/PDB/enums-layout.test index ce0b23f453be..79efb259663d 100644 --- a/lit/SymbolFile/PDB/enums-layout.test +++ b/lit/SymbolFile/PDB/enums-layout.test @@ -1,45 +1,45 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj -RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe -RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%T/SimpleTypesTest.cpp.enums.exe %S/Inputs/SimpleTypesTest.cpp +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CONST %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_EMPTY %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_UCHAR %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CLASS %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_STRUCT %s ; FIXME: PDB does not have information about scoped enumeration (Enum class) so the ; compiler type used is the same as the one for unscoped enumeration. -CHECK: Module [[CU:.*]] -CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]]) -CHECK: Type{{.*}} , name = "Enum", size = 4, decl = SimpleTypesTest.cpp:19, compiler_type = {{.*}} enum Enum { -CHECK-NEXT: RED, -CHECK-NEXT: GREEN, -CHECK-NEXT: BLUE -CHECK-NEXT:} +ENUM: Type{{.*}} , name = "Enum", size = 4, decl = simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum { +ENUM_NEXT: RED, +ENUM_NEXT: GREEN, +ENUM_NEXT: BLUE +ENUM_NEXT:} -CHECK: Type{{.*}} , name = "EnumConst", size = 4, decl = SimpleTypesTest.cpp:22, compiler_type = {{.*}} enum EnumConst { -CHECK-NEXT: LOW, -CHECK-NEXT: NORMAL, -CHECK-NEXT: HIGH -CHECK-NEXT:} +ENUM_CONST: Type{{.*}} , name = "EnumConst", size = 4, decl = simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst { +ENUM_CONST-NEXT: LOW, +ENUM_CONST-NEXT: NORMAL, +ENUM_CONST-NEXT: HIGH +ENUM_CONST-NEXT:} -CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, decl = SimpleTypesTest.cpp:25, compiler_type = {{.*}} enum EnumEmpty { -CHECK-NEXT:} +ENUM_EMPTY: Type{{.*}} , name = "EnumEmpty", size = 4, decl = simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty { +ENUM_EMPTY-NEXT:} -CHECK: Type{{.*}} , name = "EnumUChar", size = 1, decl = SimpleTypesTest.cpp:28, compiler_type = {{.*}} enum EnumUChar { -CHECK-NEXT: ON, -CHECK-NEXT: OFF, -CHECK-NEXT: AUTO -CHECK-NEXT:} +ENUM_UCHAR: Type{{.*}} , name = "EnumUChar", size = 1, decl = simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar { +ENUM_UCHAR-NEXT: ON, +ENUM_UCHAR-NEXT: OFF, +ENUM_UCHAR-NEXT: AUTO +ENUM_UCHAR-NEXT:} ; Note that `enum EnumClass` is tested instead of `enum class EnumClass` -CHECK: Type{{.*}} , name = "EnumClass", size = 4, decl = SimpleTypesTest.cpp:32, compiler_type = {{.*}} enum EnumClass { -CHECK-NEXT: YES, -CHECK-NEXT: NO, -CHECK-NEXT: DEFAULT -CHECK-NEXT:} - -CHECK: Type{{.*}} , name = "EnumStruct", size = 4, decl = SimpleTypesTest.cpp:35, compiler_type = {{.*}} enum EnumStruct { -CHECK-NEXT: red, -CHECK-NEXT: blue, -CHECK-NEXT: black -CHECK-NEXT:} - -CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\SimpleTypesTest.cpp' +ENUM_CLASS: Type{{.*}} , name = "EnumClass", size = 4, decl = simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass { +ENUM_CLASS-NEXT: YES, +ENUM_CLASS-NEXT: NO, +ENUM_CLASS-NEXT: DEFAULT +ENUM_CLASS-NEXT:} + +ENUM_STRUCT: Type{{.*}} , name = "EnumStruct", size = 4, decl = simpletypestest.cpp:35, compiler_type = {{.*}} enum EnumStruct { +ENUM_STRUCT-NEXT: red, +ENUM_STRUCT-NEXT: blue, +ENUM_STRUCT-NEXT: black +ENUM_STRUCT-NEXT:} diff --git a/lit/SymbolFile/PDB/expressions.test b/lit/SymbolFile/PDB/expressions.test new file mode 100644 index 000000000000..49016196117e --- /dev/null +++ b/lit/SymbolFile/PDB/expressions.test @@ -0,0 +1,35 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/ExpressionsTest.cpp +RUN: %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s + +// Check the variable value through `print` +CHECK: (lldb) print result +CHECK: (char) $0 = '\x1c' + +// Call the function just like in the code +CHECK: (lldb) print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)) +CHECK: (char) $1 = '\x1c' + +// Try the relaxed namespaces search +CHECK: (lldb) print N1::sum(N1::buf1, sizeof(N1::buf1)) +CHECK: (char) $2 = '\x1c' + +// Try the relaxed variables and functions search +CHECK: (lldb) print sum(buf1, sizeof(buf1)) +CHECK: (char) $3 = '\x1c' + +// Make a crash during expression calculation +CHECK: (lldb) print sum(buf1, 1000000000) +CHECK: The process has been returned to the state before expression evaluation. + +// Make one more crash +CHECK: (lldb) print sum(buf0, 1) +CHECK: The process has been returned to the state before expression evaluation. + +// Check if the process state was restored succesfully +CHECK: (lldb) print sum(buf0, result - 28) +CHECK: (char) $4 = '\0' + +// Call the function with arbitrary parameters +CHECK: (lldb) print sum(buf1 + 3, 3) +CHECK: (char) $5 = '\f' diff --git a/lit/SymbolFile/PDB/func-symbols.test b/lit/SymbolFile/PDB/func-symbols.test index b13ff7e65bb0..fbbf5ddfb856 100644 --- a/lit/SymbolFile/PDB/func-symbols.test +++ b/lit/SymbolFile/PDB/func-symbols.test @@ -1,7 +1,5 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj -RUN: link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%T/FuncSymbolsTest.exe %S/Inputs/FuncSymbolsTestMain.cpp %S/Inputs/FuncSymbols.cpp RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-TWO %s @@ -9,16 +7,16 @@ RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-T ; In this test, We don't check demangled name of a mangled function. CHECK-ONE: Module [[MD:.*]] -CHECK-ONE-DAG: {{.*}}: SymbolVendor ([[MD]]) +CHECK-ONE-DAG: {{.*}}: SymbolVendor pdb ([[MD]]) CHECK-ONE-DAG: [[TY0:.*]]: Type{[[UID0:.*]]} , name = "Func_arg_array", decl = FuncSymbolsTestMain.cpp:3, compiler_type = {{.*}} int (int *) CHECK-ONE-DAG: [[TY1:.*]]: Type{[[UID1:.*]]} , name = "Func_arg_void", decl = FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY2:.*]]: Type{[[UID2:.*]]} , name = "Func_arg_none", decl = FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY3:.*]]: Type{[[UID3:.*]]} , name = "Func_varargs", decl = FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...) -CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "NS::Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (signed char, int) +CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (char, int) CHECK-ONE-DAG: [[TY5:.*]]: Type{[[UID5:.*]]} , name = "main", decl = FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void) -CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "`anonymous namespace'::Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...) +CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...) CHECK-ONE-DAG: [[TY7:.*]]: Type{[[UID7:.*]]} , name = "StaticFunction", decl = FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int) -CHECK-ONE-DAG: [[TY8:.*]]: Type{[[UID8:.*]]} , name = "MemberTest::A::Func", decl = FuncSymbolsTestMain.cpp:12, compiler_type = {{.*}} int (int, ...) +CHECK-ONE-DAG: [[TY8:.*]]: Type{[[UID8:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:12, compiler_type = {{.*}} int (int, ...) CHECK-ONE-DAG: [[TY9:.*]]: Type{[[UID9:.*]]} , name = "TemplateFunc<1,int>", decl = FuncSymbolsTestMain.cpp:18, compiler_type = {{.*}} void (int) CHECK-ONE-DAG: [[TY10:.*]]: Type{[[UID10:.*]]} , name = "TemplateFunc<1,int,int,int>", decl = FuncSymbolsTestMain.cpp:18, compiler_type = {{.*}} void (int, int, int) CHECK-ONE-DAG: [[TY11:.*]]: Type{[[UID11:.*]]} , name = "InlinedFunction", decl = FuncSymbolsTestMain.cpp:40, compiler_type = {{.*}} void (long) @@ -39,7 +37,7 @@ CHECK-ONE-DAG: Function{[[UID11]]}, mangled = ?InlinedFunction@@YAXJ@Z, demangle ; We expect new types observed in another compile unit CHECK-TWO-DAG: [[TY30:.*]]: Type{[[UID30:.*]]} , name = "FunctionCall", decl = FuncSymbols.cpp:13, compiler_type = {{.*}} void (void) -CHECK-TWO-DAG: [[TY31:.*]]: Type{[[UID31:.*]]} , name = "`anonymous namespace'::StaticFunction", decl = FuncSymbols.cpp:4, compiler_type = {{.*}} long (int) +CHECK-TWO-DAG: [[TY31:.*]]: Type{[[UID31:.*]]} , name = "StaticFunction", decl = FuncSymbols.cpp:4, compiler_type = {{.*}} long (int) CHECK-TWO-DAG: [[TY32:.*]]: Type{[[UID32:.*]]} , name = "InlinedFunction", decl = FuncSymbols.cpp:10, compiler_type = {{.*}} int (long) CHECK-TWO: {{.*}}: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\FuncSymbols.cpp' diff --git a/lit/SymbolFile/PDB/function-level-linking.test b/lit/SymbolFile/PDB/function-level-linking.test index 9b28ec1ba217..37b2cbc761b8 100644 --- a/lit/SymbolFile/PDB/function-level-linking.test +++ b/lit/SymbolFile/PDB/function-level-linking.test @@ -1,4 +1,5 @@ -REQUIRES: windows, lld -RUN: clang-cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj +REQUIRES: system-windows, lld +RUN: %clang_cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe -RUN: lldb-test symbols -verify %t.exe +RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -verify %t.exe +RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -verify %t.exe diff --git a/lit/SymbolFile/PDB/function-nested-block.test b/lit/SymbolFile/PDB/function-nested-block.test index 93543c681130..9057d01c2584 100644 --- a/lit/SymbolFile/PDB/function-nested-block.test +++ b/lit/SymbolFile/PDB/function-nested-block.test @@ -1,7 +1,11 @@ -REQUIRES: windows, lld -RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj -RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe -RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck %s +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --nodefaultlib --output=%t.exe %S/Inputs/FunctionNestedBlockTest.cpp +RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s +RUN: lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s -CHECK: Found 1 functions: -CHECK: name = "{{.*}}", mangled = "{{_?}}main" +CHECK-FUNCTION: Found 1 functions: +CHECK-FUNCTION: name = "{{.*}}", mangled = "{{_?}}main" + +CHECK-BLOCK: Found 1 blocks: +CHECK-BLOCK: Blocks: id = {{.*}}, range = {{.*}} +CHECK-BLOCK: id = {{.*}}, range = {{.*}} diff --git a/lit/SymbolFile/PDB/lit.local.cfg b/lit/SymbolFile/PDB/lit.local.cfg deleted file mode 100644 index df9b335dd131..000000000000 --- a/lit/SymbolFile/PDB/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] diff --git a/lit/SymbolFile/PDB/pointers.test b/lit/SymbolFile/PDB/pointers.test new file mode 100644 index 000000000000..a8f84f14783d --- /dev/null +++ b/lit/SymbolFile/PDB/pointers.test @@ -0,0 +1,38 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/PointerTypeTest.cpp.obj %S/Inputs/PointerTypeTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/PointerTypeTest.cpp.exe %T/PointerTypeTest.cpp.obj +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-F %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=F %s + +CHECK: Module [[MOD:.*]] +CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\PointerTypeTest.cpp' + +MAIN-ST-F: name = "f" +MAIN-ST-F-SAME: decl = PointerTypeTest.cpp:8 +MAIN-ST-F-SAME: compiler_type = {{.*}} int (int) + +MAIN-ST: name = "ST", size = 4, decl = PointerTypeTest.cpp:6, compiler_type = {{.*}} struct ST { +MAIN-ST-NEXT: int a; +MAIN-ST-NEXT: int {{.*}}f(int); +MAIN-ST-NEXT:} + +MAIN: Function{[[FID1:.*]]}, mangled = _main +MAIN-NEXT: Block{[[FID1]]} +MAIN: Variable{{.*}}, name = "array_pointer" +MAIN-SAME: (int (*)[2][4]), scope = local +MAIN: Variable{{.*}}, name = "p_int" +MAIN-SAME: (int *), scope = local +MAIN: Variable{{.*}}, name = "p_member_field" +MAIN-SAME: (int ST::*), scope = local +MAIN: Variable{{.*}}, name = "p_member_method" +MAIN-SAME: (int (ST::*)(int) __attribute__((thiscall))), scope = local + +F: Function{[[FID2:.*]]}, demangled = {{.*}}f(int) +F-NEXT: Block{[[FID2]]} +F: Variable{{.*}}, name = "this" +F-SAME: (ST *), scope = parameter, location = {{.*}}, artificial +F: Variable{{.*}}, name = "x" +F-SAME: (int), scope = parameter, decl = PointerTypeTest.cpp:8 diff --git a/lit/SymbolFile/PDB/type-quals.test b/lit/SymbolFile/PDB/type-quals.test index fbe10c0d8d64..734509f78345 100644 --- a/lit/SymbolFile/PDB/type-quals.test +++ b/lit/SymbolFile/PDB/type-quals.test @@ -1,39 +1,39 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj -RUN: link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/TypeQualsTest.cpp.obj %S/Inputs/TypeQualsTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/TypeQualsTest.cpp.exe %T/TypeQualsTest.cpp.obj RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s CHECK: Module [[MOD:.*]] -CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) -CHECK: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int * -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const * -CHECK: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *) - -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int * -CHECK: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *) - -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int * -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *& -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int & -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int & -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int && -CHECK: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&) +CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) +CHECK-DAG: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int * +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const * +CHECK-DAG: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *) + +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int * +CHECK-DAG: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *) + +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int * +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *& +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int && +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int & +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int & +CHECK-DAG: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&) // FIXME: __unaligned is not supported. -CHECK: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *) +CHECK-DAG: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *) -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict -CHECK: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict) +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict +CHECK-DAG: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict) -CHECK: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict) +CHECK-DAG: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict) -CHECK: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100] -CHECK: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100] +CHECK-DAG: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100] +CHECK-DAG: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100] -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\TypeQualsTest.cpp' diff --git a/lit/SymbolFile/PDB/typedefs.test b/lit/SymbolFile/PDB/typedefs.test index 659ef6392d1c..caf23a8c1664 100644 --- a/lit/SymbolFile/PDB/typedefs.test +++ b/lit/SymbolFile/PDB/typedefs.test @@ -1,6 +1,5 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj -RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%T/SimpleTypesTest.cpp.typedefs.exe %S/Inputs/SimpleTypesTest.cpp RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s ; Generate 32-bit target @@ -13,7 +12,7 @@ RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s ; both of them is the same. CHECK: Module [[MOD:.*]] -CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long @@ -46,9 +45,10 @@ CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} void * CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = {{.*}} unsigned short CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = {{.*}} unsigned int +CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = {{.*}} char CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} signed char -CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} signed char (void *, long, unsigned short, unsigned int, ...) -CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} signed char (*)(void *, long, unsigned short, unsigned int, ...) +CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} char (void *, long, unsigned short, unsigned int, ...) +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} char (*)(void *, long, unsigned short, unsigned int, ...) CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedef", compiler_type = {{.*}} typedef VarArgsFuncTypedef CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float diff --git a/lit/SymbolFile/PDB/udt-layout.test b/lit/SymbolFile/PDB/udt-layout.test new file mode 100644 index 000000000000..726f633efe5b --- /dev/null +++ b/lit/SymbolFile/PDB/udt-layout.test @@ -0,0 +1,51 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/UdtLayoutTest.cpp +RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s + +CHECK:(int) int C::abc = 123 +CHECK:(List [16]) ls = { +CHECK: [15] = { +CHECK: Prev = 0x00000000 +CHECK: Next = 0x00000000 +CHECK: Value = { +CHECK: B<0> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x01' +CHECK: _b = 2 +CHECK: _c = 3 +CHECK: } +CHECK: B<1> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x02' +CHECK: _b = 4 +CHECK: _c = 6 +CHECK: } +CHECK: B<2> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x03' +CHECK: _b = 6 +CHECK: _c = 9 +CHECK: } +CHECK: B<3> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x04' +CHECK: _b = 8 +CHECK: _c = 12 +CHECK: } +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _x = 5 +CHECK: _y = 10 +CHECK: _z = '\x0f' +CHECK: } +CHECK: } +CHECK:} diff --git a/lit/SymbolFile/PDB/variables-locations.test b/lit/SymbolFile/PDB/variables-locations.test index b70339fa23ac..7696dc92cee8 100644 --- a/lit/SymbolFile/PDB/variables-locations.test +++ b/lit/SymbolFile/PDB/variables-locations.test @@ -1,6 +1,6 @@ -REQUIRES: windows -RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe -RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/VariablesLocationsTest.cpp +RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s CHECK: g_var = 2222 diff --git a/lit/SymbolFile/PDB/variables.test b/lit/SymbolFile/PDB/variables.test index 6d37cd975b45..2e9b59471091 100644 --- a/lit/SymbolFile/PDB/variables.test +++ b/lit/SymbolFile/PDB/variables.test @@ -1,58 +1,66 @@ -REQUIRES: windows -RUN: clang-cl /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj -RUN: link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe -RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=64 --nodefaultlib --output=%T/VariablesTest.cpp.obj %S/Inputs/VariablesTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=64 --nodefaultlib --output=%T/VariablesTest.cpp.exe %T/VariablesTest.cpp.obj +RUN: lldb-test symbols %T/VariablesTest.cpp.exe > %T/VariablesTest.out +RUN: FileCheck --check-prefix=GLOBALS --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-F --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%T/VariablesTest.out %s -CHECK: Module [[MOD:.*]] -CHECK: SymbolVendor ([[MOD]]) -CHECK: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp' -CHECK-DAG: Variable{{.*}}, name = "g_IntVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "m_StaticClassMember" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_pConst" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_EnumVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_tls" -CHECK-SAME: scope = thread local, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "ClassVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_Const" -CHECK-SAME: scope = ??? (2) +GLOBALS: Module [[MOD:.*]] +GLOBALS: SymbolVendor pdb ([[MOD]]) +GLOBALS: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp' +GLOBALS-DAG: Variable{{.*}}, name = "g_IntVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "m_StaticClassMember" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_pConst" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "same_name_var" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_EnumVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_tls" +GLOBALS-SAME: scope = thread local, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "ClassVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_Const" +GLOBALS-SAME: scope = ??? (2) +GLOBALS: Function -CHECK-DAG: Function{[[FID1:.*]]}, mangled = ?f@@YAHHH@Z -CHECK-NEXT: Block{[[FID1]]} -CHECK-DAG: Variable{{.*}}, name = "var_arg1" -CHECK-SAME: scope = parameter -CHECK-DAG: Variable{{.*}}, name = "var_arg2" -CHECK-SAME: scope = parameter -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = local +FUNC-F: Function{{.*}}, mangled = ?f@@YAHHH@Z +FUNC-F-NEXT: Block +FUNC-F-NEXT: Variable{{.*}}, name = "var_arg1" +FUNC-F-SAME: scope = parameter +FUNC-F-NEXT: Variable{{.*}}, name = "var_arg2" +FUNC-F-SAME: scope = parameter +FUNC-F-NEXT: Variable{{.*}}, name = "same_name_var" +FUNC-F-SAME: scope = local -CHECK-DAG: Function{[[FID2:.*]]}, mangled = main -CHECK-NEXT: Block{[[FID2]]} -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "local_const" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "local_pCString" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "a" -CHECK-SAME: scope = local +FUNC-MAIN: Function{{.*}}, mangled = main +FUNC-MAIN-NEXT: Block +FUNC-MAIN-NEXT: Variable{{.*}}, name = "same_name_var" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_const" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_CString" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_pCString" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "a" +FUNC-MAIN-SAME: scope = local -CHECK-DAG: Function{[[FID3:.*]]}, mangled = ??0Class@@QEAA@H@Z -CHECK-NEXT: Block{[[FID3]]} -CHECK-DAG: Variable{{.*}}, name = "this" -CHECK-SAME: scope = parameter -CHECK-SAME: artificial -CHECK-DAG: Variable{{.*}}, name = "a" -CHECK-SAME: scope = parameter +FUNC-CONSTRUCTOR: Function{{.*}}, mangled = ??0Class@@QEAA@H@Z +FUNC-CONSTRUCTOR-NEXT: Block +FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "this" +FUNC-CONSTRUCTOR-SAME: scope = parameter +FUNC-CONSTRUCTOR-SAME: artificial +FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "a" +FUNC-CONSTRUCTOR-SAME: scope = parameter -CHECK-DAG: Function{[[FID4:.*]]}, mangled = ?Func@Class@@QEAAXXZ -CHECK-NEXT: Block{[[FID4]]} -CHECK-DAG: Variable{{.*}}, name = "this" -CHECK-SAME: scope = parameter -CHECK-SAME: artificial
\ No newline at end of file +FUNC-MEMBER: Function{{.*}}, mangled = ?Func@Class@@QEAAXXZ +FUNC-MEMBER-NEXT: Block +FUNC-MEMBER-NEXT: Variable{{.*}}, name = "this" +FUNC-MEMBER-SAME: scope = parameter +FUNC-MEMBER-SAME: artificial diff --git a/lit/SymbolFile/PDB/vbases.test b/lit/SymbolFile/PDB/vbases.test new file mode 100644 index 000000000000..57239e07c87d --- /dev/null +++ b/lit/SymbolFile/PDB/vbases.test @@ -0,0 +1,15 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/VBases.cpp +RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } diff --git a/lit/Unit/lit.cfg b/lit/Unit/lit.cfg.py index 338adfd7bd9a..3633c73a1d40 100644 --- a/lit/Unit/lit.cfg +++ b/lit/Unit/lit.cfg.py @@ -3,8 +3,10 @@ # Configuration file for the 'lit' test runner. import os +import sys import lit.formats +from lit.llvm import llvm_config # name: The name of this test suite. config.name = 'lldb-Unit' @@ -17,5 +19,12 @@ config.suffixes = [] config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests') config.test_exec_root = config.test_source_root +# One of our unit tests dynamically links against python.dll, and on Windows +# it needs to be able to find it at runtime. This is fine if Python is on your +# system PATH, but if it's not, then this unit test executable will fail to run. +# We can solve this by forcing the Python directory onto the system path here. +llvm_config.with_system_environment('PATH') +llvm_config.with_environment('PATH', os.path.dirname(sys.executable), append_path=True) + # testFormat: The test format to use to interpret tests. config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') diff --git a/lit/Unit/lit.site.cfg.in b/lit/Unit/lit.site.cfg.py.in index 9c43172e61e0..0c629fdfaa56 100644 --- a/lit/Unit/lit.site.cfg.in +++ b/lit/Unit/lit.site.cfg.py.in @@ -1,6 +1,6 @@ @LIT_SITE_CFG_IN_HEADER@ -config.test_exec_root = "@LLVM_BINARY_DIR@" +config.test_exec_root = "@LLDB_BINARY_DIR@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" @@ -22,5 +22,8 @@ except KeyError as e: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) +import lit.llvm +lit.llvm.initialize(lit_config, config) + # Let the main config do the real work. -lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Unit/lit.cfg") +lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Unit/lit.cfg.py") diff --git a/lit/helper/__init__.py b/lit/helper/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/lit/helper/__init__.py diff --git a/lit/helper/build.py b/lit/helper/build.py new file mode 100755 index 000000000000..26f321d709f8 --- /dev/null +++ b/lit/helper/build.py @@ -0,0 +1,787 @@ +#! /usr/bin/env python + +from __future__ import print_function + +import argparse +import os +import signal +import subprocess +import sys + +if sys.platform == 'win32': + # This module was renamed in Python 3. Make sure to import it using a + # consistent name regardless of python version. + try: + import winreg + except: + import _winreg as winreg + +if __name__ != "__main__": + raise RuntimeError("Do not import this script, run it instead") + + +parser = argparse.ArgumentParser(description='LLDB compilation wrapper') +parser.add_argument('--arch', + metavar='arch', + dest='arch', + required=True, + default='host', + choices=['32', '64', 'host'], + help='Specify the architecture to target.') + +parser.add_argument('--compiler', + metavar='compiler', + dest='compiler', + required=True, + help='Path to a compiler executable, or one of the values [any, msvc, clang-cl, gcc, clang]') + +parser.add_argument('--tools-dir', + metavar='directory', + dest='tools_dir', + required=False, + action='append', + help='If specified, a path to search in addition to PATH when --compiler is not an exact path') + +if sys.platform == 'darwin': + parser.add_argument('--apple-sdk', + metavar='apple_sdk', + dest='apple_sdk', + default="macosx", + help='Specify the name of the Apple SDK (macosx, macosx.internal, iphoneos, iphoneos.internal, or path to SDK) and use the appropriate tools from that SDK\'s toolchain.') + +parser.add_argument('--output', '-o', + dest='output', + metavar='file', + required=False, + default='', + help='Path to output file') + +parser.add_argument('--outdir', '-d', + dest='outdir', + metavar='directory', + required=False, + help='Directory for output files') + +parser.add_argument('--nodefaultlib', + dest='nodefaultlib', + action='store_true', + default=False, + help='When specified, the resulting image should not link against system libraries or include system headers. Useful when writing cross-targeting tests.') + +parser.add_argument('--opt', + dest='opt', + default='none', + choices=['none', 'basic', 'lto'], + help='Optimization level') + +parser.add_argument('--mode', + dest='mode', + default='compile-and-link', + choices=['compile', 'link', 'compile-and-link'], + help='Specifies whether to compile, link, or both') + +parser.add_argument('--noclean', + dest='clean', + action='store_false', + default=True, + help='Dont clean output file before building') + +parser.add_argument('--verbose', + dest='verbose', + action='store_true', + default=False, + help='Print verbose output') + +parser.add_argument('-n', '--dry-run', + dest='dry', + action='store_true', + default=False, + help='Print the commands that would run, but dont actually run them') + +parser.add_argument('inputs', + metavar='file', + nargs='+', + help='Source file(s) to compile / object file(s) to link') + + +args = parser.parse_args(args=sys.argv[1:]) + + +def to_string(b): + """Return the parameter as type 'str', possibly encoding it. + + In Python2, the 'str' type is the same as 'bytes'. In Python3, the + 'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is + distinct. + + This function is copied from llvm/utils/lit/lit/util.py + """ + if isinstance(b, str): + # In Python2, this branch is taken for types 'str' and 'bytes'. + # In Python3, this branch is taken only for 'str'. + return b + if isinstance(b, bytes): + # In Python2, this branch is never taken ('bytes' is handled as 'str'). + # In Python3, this is true only for 'bytes'. + try: + return b.decode('utf-8') + except UnicodeDecodeError: + # If the value is not valid Unicode, return the default + # repr-line encoding. + return str(b) + + # By this point, here's what we *don't* have: + # + # - In Python2: + # - 'str' or 'bytes' (1st branch above) + # - In Python3: + # - 'str' (1st branch above) + # - 'bytes' (2nd branch above) + # + # The last type we might expect is the Python2 'unicode' type. There is no + # 'unicode' type in Python3 (all the Python3 cases were already handled). In + # order to get a 'str' object, we need to encode the 'unicode' object. + try: + return b.encode('utf-8') + except AttributeError: + raise TypeError('not sure how to convert %s to %s' % (type(b), str)) + +def format_text(lines, indent_0, indent_n): + result = ' ' * indent_0 + lines[0] + for next in lines[1:]: + result = result + '\n{0}{1}'.format(' ' * indent_n, next) + return result + +def print_environment(env): + if env is None: + print(' Inherited') + return + for e in env: + value = env[e] + lines = value.split(os.pathsep) + formatted_value = format_text(lines, 0, 7 + len(e)) + print(' {0} = {1}'.format(e, formatted_value)) + +def find_executable(binary_name, search_paths): + if sys.platform == 'win32': + binary_name = binary_name + '.exe' + + search_paths = os.pathsep.join(search_paths) + paths = search_paths + os.pathsep + os.environ.get('PATH', '') + for path in paths.split(os.pathsep): + p = os.path.join(path, binary_name) + if os.path.exists(p) and not os.path.isdir(p): + return os.path.normpath(p) + return None + +def find_toolchain(compiler, tools_dir): + if compiler == 'msvc': + return ('msvc', find_executable('cl', tools_dir)) + if compiler == 'clang-cl': + return ('clang-cl', find_executable('clang-cl', tools_dir)) + if compiler == 'gcc': + return ('gcc', find_executable('g++', tools_dir)) + if compiler == 'clang': + return ('clang', find_executable('clang++', tools_dir)) + if compiler == 'any': + priorities = [] + if sys.platform == 'win32': + priorities = ['clang-cl', 'msvc', 'clang', 'gcc'] + else: + priorities = ['clang', 'gcc', 'clang-cl'] + for toolchain in priorities: + (type, dir) = find_toolchain(toolchain, tools_dir) + if type and dir: + return (type, dir) + # Could not find any toolchain. + return (None, None) + + # From here on, assume that |compiler| is a path to a file. + file = os.path.basename(compiler) + name, ext = os.path.splitext(file) + if file.lower() == 'cl.exe': + return 'msvc' + if name == 'clang-cl': + return 'clang-cl' + if name.startswith('clang'): + return 'clang' + if name.startswith('gcc') or name.startswith('g++'): + return 'gcc' + if name == 'cc' or name == 'c++': + return 'generic' + return 'unknown' + +class Builder(object): + def __init__(self, toolchain_type, args, obj_ext): + self.toolchain_type = toolchain_type + self.inputs = args.inputs + self.arch = args.arch + self.opt = args.opt + self.outdir = args.outdir + self.compiler = args.compiler + self.clean = args.clean + self.output = args.output + self.mode = args.mode + self.nodefaultlib = args.nodefaultlib + self.verbose = args.verbose + self.obj_ext = obj_ext + + def _exe_file_name(self): + assert self.mode != 'compile' + return self.output + + def _output_name(self, input, extension, with_executable=False): + basename = os.path.splitext(os.path.basename(input))[0] + extension + if with_executable: + exe_basename = os.path.basename(self._exe_file_name()) + basename = exe_basename + '-' + basename + + output = os.path.join(self.outdir, basename) + return os.path.normpath(output) + + def _obj_file_names(self): + if self.mode == 'link': + return self.inputs + + if self.mode == 'compile-and-link': + # Object file names should factor in both the input file (source) + # name and output file (executable) name, to ensure that two tests + # which share a common source file don't race to write the same + # object file. + return [self._output_name(x, self.obj_ext, True) for x in self.inputs] + + if self.mode == 'compile' and self.output: + return [self.output] + + return [self._output_name(x, self.obj_ext) for x in self.inputs] + + def build_commands(self): + commands = [] + if self.mode == 'compile' or self.mode == 'compile-and-link': + for input, output in zip(self.inputs, self._obj_file_names()): + commands.append(self._get_compilation_command(input, output)) + if self.mode == 'link' or self.mode == 'compile-and-link': + commands.append(self._get_link_command()) + return commands + + +class MsvcBuilder(Builder): + def __init__(self, toolchain_type, args): + Builder.__init__(self, toolchain_type, args, '.obj') + + self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64' + + if toolchain_type == 'msvc': + # Make sure we're using the appropriate toolchain for the desired + # target type. + compiler_parent_dir = os.path.dirname(self.compiler) + selected_target_version = os.path.basename(compiler_parent_dir) + if selected_target_version != self.msvc_arch_str: + host_dir = os.path.dirname(compiler_parent_dir) + self.compiler = os.path.join(host_dir, self.msvc_arch_str, 'cl.exe') + if self.verbose: + print('Using alternate compiler "{0}" to match selected target.'.format(self.compiler)) + + if self.mode == 'link' or self.mode == 'compile-and-link': + self.linker = self._find_linker('link') if toolchain_type == 'msvc' else self._find_linker('lld-link') + if not self.linker: + raise ValueError('Unable to find an appropriate linker.') + + self.compile_env, self.link_env = self._get_visual_studio_environment() + + def _find_linker(self, name): + if sys.platform == 'win32': + name = name + '.exe' + compiler_dir = os.path.dirname(self.compiler) + linker_path = os.path.join(compiler_dir, name) + if not os.path.exists(linker_path): + raise ValueError('Could not find \'{}\''.format(linker_path)) + return linker_path + + def _get_vc_install_dir(self): + dir = os.getenv('VCINSTALLDIR', None) + if dir: + if self.verbose: + print('Using %VCINSTALLDIR% {}'.format(dir)) + return dir + + dir = os.getenv('VSINSTALLDIR', None) + if dir: + if self.verbose: + print('Using %VSINSTALLDIR% {}'.format(dir)) + return os.path.join(dir, 'VC') + + dir = os.getenv('VS2019INSTALLDIR', None) + if dir: + if self.verbose: + print('Using %VS2019INSTALLDIR% {}'.format(dir)) + return os.path.join(dir, 'VC') + + dir = os.getenv('VS2017INSTALLDIR', None) + if dir: + if self.verbose: + print('Using %VS2017INSTALLDIR% {}'.format(dir)) + return os.path.join(dir, 'VC') + + dir = os.getenv('VS2015INSTALLDIR', None) + if dir: + if self.verbose: + print('Using %VS2015INSTALLDIR% {}'.format(dir)) + return os.path.join(dir, 'VC') + return None + + def _get_vctools_version(self): + ver = os.getenv('VCToolsVersion', None) + if ver: + if self.verbose: + print('Using %VCToolsVersion% {}'.format(ver)) + return ver + + vcinstalldir = self._get_vc_install_dir() + vcinstalldir = os.path.join(vcinstalldir, 'Tools', 'MSVC') + subdirs = next(os.walk(vcinstalldir))[1] + if not subdirs: + return None + + from distutils.version import StrictVersion + subdirs.sort(key=lambda x : StrictVersion(x)) + + if self.verbose: + full_path = os.path.join(vcinstalldir, subdirs[-1]) + print('Using VC tools version directory {0} found by directory walk.'.format(full_path)) + return subdirs[-1] + + def _get_vctools_install_dir(self): + dir = os.getenv('VCToolsInstallDir', None) + if dir: + if self.verbose: + print('Using %VCToolsInstallDir% {}'.format(dir)) + return dir + + vcinstalldir = self._get_vc_install_dir() + if not vcinstalldir: + return None + vctoolsver = self._get_vctools_version() + if not vctoolsver: + return None + result = os.path.join(vcinstalldir, 'Tools', 'MSVC', vctoolsver) + if not os.path.exists(result): + return None + if self.verbose: + print('Using VC tools install dir {} found by directory walk'.format(result)) + return result + + def _find_windows_sdk_in_registry_view(self, view): + products_key = None + roots_key = None + installed_options_keys = [] + try: + sam = view | winreg.KEY_READ + products_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, + r'Software\Microsoft\Windows Kits\Installed Products', + 0, + sam) + + # This is the GUID for the desktop component. If this is present + # then the components required for the Desktop SDK are installed. + # If not it will throw an exception. + winreg.QueryValueEx(products_key, '{5A3D81EC-D870-9ECF-D997-24BDA6644752}') + + roots_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, + r'Software\Microsoft\Windows Kits\Installed Roots', + 0, + sam) + root_dir = winreg.QueryValueEx(roots_key, 'KitsRoot10') + root_dir = to_string(root_dir[0]) + sdk_versions = [] + index = 0 + while True: + # Installed SDK versions are stored as sub-keys of the + # 'Installed Roots' key. Find all of their names, then sort + # them by version + try: + ver_key = winreg.EnumKey(roots_key, index) + sdk_versions.append(ver_key) + index = index + 1 + except WindowsError: + break + if not sdk_versions: + return (None, None) + + # Windows SDK version numbers consist of 4 dotted components, so we + # have to use LooseVersion, as StrictVersion supports 3 or fewer. + from distutils.version import LooseVersion + sdk_versions.sort(key=lambda x : LooseVersion(x), reverse=True) + option_value_name = 'OptionId.DesktopCPP' + self.msvc_arch_str + for v in sdk_versions: + try: + version_subkey = v + r'\Installed Options' + key = winreg.OpenKey(roots_key, version_subkey) + installed_options_keys.append(key) + (value, value_type) = winreg.QueryValueEx(key, option_value_name) + if value == 1: + # The proper architecture is installed. Return the + # associated paths. + if self.verbose: + print('Found Installed Windows SDK v{0} at {1}'.format(v, root_dir)) + return (root_dir, v) + except: + continue + except: + return (None, None) + finally: + del products_key + del roots_key + for k in installed_options_keys: + del k + return (None, None) + + def _find_windows_sdk_in_registry(self): + # This could be a clang-cl cross-compile. If so, there's no registry + # so just exit. + if sys.platform != 'win32': + return (None, None) + if self.verbose: + print('Looking for Windows SDK in 64-bit registry.') + dir, ver = self._find_windows_sdk_in_registry_view(winreg.KEY_WOW64_64KEY) + if not dir or not ver: + if self.verbose: + print('Looking for Windows SDK in 32-bit registry.') + dir, ver = self._find_windows_sdk_in_registry_view(winreg.KEY_WOW64_32KEY) + + return (dir, ver) + + def _get_winsdk_dir(self): + # If a Windows SDK is specified in the environment, use that. Otherwise + # try to find one in the Windows registry. + dir = os.getenv('WindowsSdkDir', None) + if not dir or not os.path.exists(dir): + return self._find_windows_sdk_in_registry() + ver = os.getenv('WindowsSDKLibVersion', None) + if not ver: + return self._find_windows_sdk_in_registry() + + ver = ver.rstrip('\\') + if self.verbose: + print('Using %WindowsSdkDir% {}'.format(dir)) + print('Using %WindowsSDKLibVersion% {}'.format(ver)) + return (dir, ver) + + def _get_msvc_native_toolchain_dir(self): + assert self.toolchain_type == 'msvc' + compiler_dir = os.path.dirname(self.compiler) + target_dir = os.path.dirname(compiler_dir) + host_name = os.path.basename(target_dir) + host_name = host_name[4:].lower() + return os.path.join(target_dir, host_name) + + def _get_visual_studio_environment(self): + vctools = self._get_vctools_install_dir() + winsdk, winsdkver = self._get_winsdk_dir() + + if not vctools and self.verbose: + print('Unable to find VC tools installation directory.') + if (not winsdk or not winsdkver) and self.verbose: + print('Unable to find Windows SDK directory.') + + vcincludes = [] + vclibs = [] + sdkincludes = [] + sdklibs = [] + if vctools is not None: + includes = [['ATLMFC', 'include'], ['include']] + libs = [['ATLMFC', 'lib'], ['lib']] + vcincludes = [os.path.join(vctools, *y) for y in includes] + vclibs = [os.path.join(vctools, *y) for y in libs] + if winsdk is not None: + includes = [['include', winsdkver, 'ucrt'], + ['include', winsdkver, 'shared'], + ['include', winsdkver, 'um'], + ['include', winsdkver, 'winrt'], + ['include', winsdkver, 'cppwinrt']] + libs = [['lib', winsdkver, 'ucrt'], + ['lib', winsdkver, 'um']] + sdkincludes = [os.path.join(winsdk, *y) for y in includes] + sdklibs = [os.path.join(winsdk, *y) for y in libs] + + includes = vcincludes + sdkincludes + libs = vclibs + sdklibs + libs = [os.path.join(x, self.msvc_arch_str) for x in libs] + compileenv = None + linkenv = None + defaultenv = {} + if sys.platform == 'win32': + defaultenv = { x : os.environ[x] for x in + ['SystemDrive', 'SystemRoot', 'TMP', 'TEMP'] } + # The directory to mspdbcore.dll needs to be in PATH, but this is + # always in the native toolchain path, not the cross-toolchain + # path. So, for example, if we're using HostX64\x86 then we need + # to add HostX64\x64 to the path, and if we're using HostX86\x64 + # then we need to add HostX86\x86 to the path. + if self.toolchain_type == 'msvc': + defaultenv['PATH'] = self._get_msvc_native_toolchain_dir() + + if includes: + compileenv = {} + compileenv['INCLUDE'] = os.pathsep.join(includes) + compileenv.update(defaultenv) + if libs: + linkenv = {} + linkenv['LIB'] = os.pathsep.join(libs) + linkenv.update(defaultenv) + return (compileenv, linkenv) + + def _ilk_file_names(self): + if self.mode == 'link': + return [] + + return [self._output_name(x, '.ilk') for x in self.inputs] + + def _pdb_file_name(self): + if self.mode == 'compile': + return None + return os.path.splitext(self.output)[0] + '.pdb' + + def _get_compilation_command(self, source, obj): + args = [] + + args.append(self.compiler) + if self.toolchain_type == 'clang-cl': + args.append('-m' + self.arch) + + if self.opt == 'none': + args.append('/Od') + elif self.opt == 'basic': + args.append('/O2') + elif self.opt == 'lto': + if self.toolchain_type == 'msvc': + args.append('/GL') + args.append('/Gw') + else: + args.append('-flto=thin') + if self.nodefaultlib: + args.append('/GS-') + args.append('/GR-') + args.append('/Z7') + if self.toolchain_type == 'clang-cl': + args.append('-Xclang') + args.append('-fkeep-static-consts') + args.append('/c') + + args.append('/Fo' + obj) + args.append(source) + + return ('compiling', [source], obj, + self.compile_env, + args) + + def _get_link_command(self): + args = [] + args.append(self.linker) + args.append('/DEBUG:FULL') + args.append('/INCREMENTAL:NO') + if self.nodefaultlib: + args.append('/nodefaultlib') + args.append('/entry:main') + args.append('/PDB:' + self._pdb_file_name()) + args.append('/OUT:' + self._exe_file_name()) + args.extend(self._obj_file_names()) + + return ('linking', self._obj_file_names(), self._exe_file_name(), + self.link_env, + args) + + def build_commands(self): + commands = [] + if self.mode == 'compile' or self.mode == 'compile-and-link': + for input, output in zip(self.inputs, self._obj_file_names()): + commands.append(self._get_compilation_command(input, output)) + if self.mode == 'link' or self.mode == 'compile-and-link': + commands.append(self._get_link_command()) + return commands + + def output_files(self): + outputs = [] + if self.mode == 'compile' or self.mode == 'compile-and-link': + outputs.extend(self._ilk_file_names()) + outputs.extend(self._obj_file_names()) + if self.mode == 'link' or self.mode == 'compile-and-link': + outputs.append(self._pdb_file_name()) + outputs.append(self._exe_file_name()) + + return [x for x in outputs if x is not None] + +class GccBuilder(Builder): + def __init__(self, toolchain_type, args): + Builder.__init__(self, toolchain_type, args, '.o') + + def _get_compilation_command(self, source, obj): + args = [] + + args.append(self.compiler) + args.append('-m' + self.arch) + + args.append('-g') + if self.opt == 'none': + args.append('-O0') + elif self.opt == 'basic': + args.append('-O2') + elif self.opt == 'lto': + args.append('-flto=thin') + if self.nodefaultlib: + args.append('-nostdinc') + args.append('-static') + args.append('-c') + + args.extend(['-o', obj]) + args.append(source) + + return ('compiling', [source], obj, None, args) + + def _get_link_command(self): + args = [] + args.append(self.compiler) + args.append('-m' + self.arch) + if self.nodefaultlib: + args.append('-nostdlib') + args.append('-static') + main_symbol = 'main' + if sys.platform == 'darwin': + main_symbol = '_main' + args.append('-Wl,-e,' + main_symbol) + args.extend(['-o', self._exe_file_name()]) + args.extend(self._obj_file_names()) + + return ('linking', self._obj_file_names(), self._exe_file_name(), None, args) + + + def output_files(self): + outputs = [] + if self.mode == 'compile' or self.mode == 'compile-and-link': + outputs.extend(self._obj_file_names()) + if self.mode == 'link' or self.mode == 'compile-and-link': + outputs.append(self._exe_file_name()) + + return outputs + +def indent(text, spaces): + def prefixed_lines(): + prefix = ' ' * spaces + for line in text.splitlines(True): + yield prefix + line + return ''.join(prefixed_lines()) + +def build(commands): + global args + for (status, inputs, output, env, child_args) in commands: + print('\n\n') + inputs = [os.path.basename(x) for x in inputs] + output = os.path.basename(output) + print(status + ' {0} -> {1}'.format('+'.join(inputs), output)) + + if args.verbose: + print(' Command Line: ' + ' '.join(child_args)) + print(' Env:') + print_environment(env) + if args.dry: + continue + + popen = subprocess.Popen(child_args, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + env=env, + universal_newlines=True) + stdout, stderr = popen.communicate() + res = popen.wait() + if res == -signal.SIGINT: + raise KeyboardInterrupt + print(' STDOUT:') + print(indent(stdout, 4)) + if res != 0: + print(' STDERR:') + print(indent(stderr, 4)) + sys.exit(res) + +def clean(files): + global args + if not files: + return + for o in files: + file = o if args.verbose else os.path.basename(o) + print('Cleaning {0}'.format(file)) + try: + if os.path.exists(o): + if not args.dry: + os.remove(o) + if args.verbose: + print(' The file was successfully cleaned.') + elif args.verbose: + print(' The file does not exist.') + except: + if args.verbose: + print(' The file could not be removed.') + +def fix_arguments(args): + if not args.inputs: + raise ValueError('No input files specified') + + if args.output and args.mode == 'compile' and len(args.inputs) > 1: + raise ValueError('Cannot specify -o with mode=compile and multiple source files. Use --outdir instead.') + + if not args.dry: + args.inputs = [os.path.abspath(x) for x in args.inputs] + + # If user didn't specify the outdir, use the directory of the first input. + if not args.outdir: + if args.output: + args.outdir = os.path.dirname(args.output) + else: + args.outdir = os.path.dirname(args.inputs[0]) + args.outdir = os.path.abspath(args.outdir) + args.outdir = os.path.normpath(args.outdir) + + # If user specified a non-absolute path for the output file, append the + # output directory to it. + if args.output: + if not os.path.isabs(args.output): + args.output = os.path.join(args.outdir, args.output) + args.output = os.path.normpath(args.output) + +fix_arguments(args) + +(toolchain_type, toolchain_path) = find_toolchain(args.compiler, args.tools_dir) +if not toolchain_path or not toolchain_type: + print('Unable to find toolchain {0}'.format(args.compiler)) + sys.exit(1) + +if args.verbose: + print('Script Arguments:') + print(' Arch: ' + args.arch) + print(' Compiler: ' + args.compiler) + print(' Outdir: ' + args.outdir) + print(' Output: ' + args.output) + print(' Nodefaultlib: ' + str(args.nodefaultlib)) + print(' Opt: ' + args.opt) + print(' Mode: ' + args.mode) + print(' Clean: ' + str(args.clean)) + print(' Verbose: ' + str(args.verbose)) + print(' Dryrun: ' + str(args.dry)) + print(' Inputs: ' + format_text(args.inputs, 0, 10)) + print('Script Environment:') + print_environment(os.environ) + +args.compiler = toolchain_path +if not os.path.exists(args.compiler) and not args.dry: + raise ValueError('The toolchain {} does not exist.'.format(args.compiler)) + +if toolchain_type == 'msvc' or toolchain_type=='clang-cl': + builder = MsvcBuilder(toolchain_type, args) +else: + builder = GccBuilder(toolchain_type, args) + +if args.clean: + clean(builder.output_files()) + +cmds = builder.build_commands() + +build(cmds) diff --git a/lit/helper/toolchain.py b/lit/helper/toolchain.py new file mode 100644 index 000000000000..938f343badcc --- /dev/null +++ b/lit/helper/toolchain.py @@ -0,0 +1,122 @@ +import os +import itertools +import platform +import subprocess +import sys + +import lit.util +from lit.llvm import llvm_config +from lit.llvm.subst import FindTool +from lit.llvm.subst import ToolSubst + +def use_lldb_substitutions(config): + # Set up substitutions for primary tools. These tools must come from config.lldb_tools_dir + # which is basically the build output directory. We do not want to find these in path or + # anywhere else, since they are specifically the programs which are actually being tested. + + dsname = 'debugserver' if platform.system() in ['Darwin'] else 'lldb-server' + dsargs = [] if platform.system() in ['Darwin'] else ['gdbserver'] + lldbmi = ToolSubst('%lldbmi', + command=FindTool('lldb-mi'), + extra_args=['--synchronous'], + unresolved='ignore') + + + build_script = os.path.dirname(__file__) + build_script = os.path.join(build_script, 'build.py') + build_script_args = [build_script, + '--compiler=any', # Default to best compiler + '--arch=' + str(config.lldb_bitness)] + if config.lldb_lit_tools_dir: + build_script_args.append('--tools-dir={0}'.format(config.lldb_lit_tools_dir)) + if config.lldb_tools_dir: + build_script_args.append('--tools-dir={0}'.format(config.lldb_tools_dir)) + + primary_tools = [ + ToolSubst('%lldb', + command=FindTool('lldb'), + extra_args=['-S', + os.path.join(config.test_source_root, + 'lit-lldb-init')]), + lldbmi, + ToolSubst('%debugserver', + command=FindTool(dsname), + extra_args=dsargs, + unresolved='ignore'), + 'lldb-test', + ToolSubst('%build', + command="'" + sys.executable + "'", + extra_args=build_script_args) + ] + + llvm_config.add_tool_substitutions(primary_tools, + [config.lldb_tools_dir]) + if lldbmi.was_resolved: + config.available_features.add('lldb-mi') + +def _use_msvc_substitutions(config): + # If running from a Visual Studio Command prompt (e.g. vcvars), this will + # detect the include and lib paths, and find cl.exe and link.exe and create + # substitutions for each of them that explicitly specify /I and /L paths + cl = lit.util.which('cl') + link = lit.util.which('link') + + if not cl or not link: + return + + cl = '"' + cl + '"' + link = '"' + link + '"' + includes = os.getenv('INCLUDE', '').split(';') + libs = os.getenv('LIB', '').split(';') + + config.available_features.add('msvc') + compiler_flags = ['"/I{}"'.format(x) for x in includes if os.path.exists(x)] + linker_flags = ['"/LIBPATH:{}"'.format(x) for x in libs if os.path.exists(x)] + + tools = [ + ToolSubst('%msvc_cl', command=cl, extra_args=compiler_flags), + ToolSubst('%msvc_link', command=link, extra_args=linker_flags)] + llvm_config.add_tool_substitutions(tools) + return + +def use_support_substitutions(config): + # Set up substitutions for support tools. These tools can be overridden at the CMake + # level (by specifying -DLLDB_LIT_TOOLS_DIR), installed, or as a last resort, we can use + # the just-built version. + flags = [] + if platform.system() in ['Darwin']: + try: + out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() + res = 0 + except OSError: + res = -1 + if res == 0 and out: + sdk_path = lit.util.to_string(out) + llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path) + flags = ['-isysroot', sdk_path] + elif platform.system() in ['OpenBSD', 'Linux']: + flags = ['-pthread'] + + + additional_tool_dirs=[] + if config.lldb_lit_tools_dir: + additional_tool_dirs.append(config.lldb_lit_tools_dir) + + llvm_config.use_clang(additional_flags=flags, + additional_tool_dirs=additional_tool_dirs, + required=True) + + if sys.platform == 'win32': + _use_msvc_substitutions(config) + + have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs, + required=False) + if have_lld: + config.available_features.add('lld') + + + support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil', + 'llvm-mc', 'llvm-readobj', 'llvm-objdump', + 'llvm-objcopy'] + additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] + llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) diff --git a/lit/lit-lldb-init b/lit/lit-lldb-init index b3a5d4dc9841..40bece698df3 100644 --- a/lit/lit-lldb-init +++ b/lit/lit-lldb-init @@ -1,2 +1,3 @@ # LLDB init file for the LIT tests. settings set symbols.enable-external-lookup false +settings set interpreter.echo-comment-commands false diff --git a/lit/lit.cfg b/lit/lit.cfg deleted file mode 100644 index 7e1fcf7520ca..000000000000 --- a/lit/lit.cfg +++ /dev/null @@ -1,174 +0,0 @@ -# -*- Python -*- - -import os -import platform -import re -import subprocess -import locale - -import lit.formats -import lit.util - -def binary_feature(on, feature, off_prefix): - return feature if on else off_prefix + feature - -# Configuration file for the 'lit' test runner. - -# name: The name of this test suite. -config.name = 'lldb' - -# testFormat: The test format to use to interpret tests. -# -# For now we require '&&' between commands, until they get globally killed and -# the test runner updated. -execute_external = (platform.system() != 'Windows' - or lit_config.getBashPath() not in [None, ""]) -config.test_format = lit.formats.ShTest(execute_external) - -# suffixes: We only support unit tests -config.suffixes = [] - -config.excludes = ['Inputs'] - -# test_source_root: The root path where tests are located. -config.test_source_root = os.path.dirname(__file__) - -# test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit') - -# Tweak the PATH to include the tools dir and the scripts dir. -lldb_tools_dir = config.lldb_tools_dir -llvm_tools_dir = config.llvm_tools_dir -path = os.path.pathsep.join((config.lldb_tools_dir, config.llvm_tools_dir, config.environment['PATH'])) - -config.environment['PATH'] = path - -path = os.path.pathsep.join((config.lldb_libs_dir, config.llvm_libs_dir, - config.environment.get('LD_LIBRARY_PATH',''))) -config.environment['LD_LIBRARY_PATH'] = path - -# Propagate LLVM_SRC_ROOT into the environment. -config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '') - -# Propagate PYTHON_EXECUTABLE into the environment -config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '') - -# Register substitutions -config.substitutions.append(('%python', config.python_executable)) - -debugserver = lit.util.which('debugserver', lldb_tools_dir) -lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', lldb_tools_dir), - config.test_source_root) - -lldbmi = lit.util.which('lldb-mi', lldb_tools_dir) - -if not os.path.exists(config.cc): - config.cc = lit.util.which(config.cc, config.environment['PATH']) - -if not os.path.exists(config.cxx): - config.cxx = lit.util.which(config.cxx, config.environment['PATH']) - -if platform.system() in ['Darwin']: - try: - out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip() - res = 0 - except OSError: - res = -1 - if res == 0 and out: - sdk_path = out - lit_config.note('using SDKROOT: %r' % sdk_path) - config.cc += " -isysroot %s" % sdk_path - config.cxx += " -isysroot %s" % sdk_path - -if platform.system() in ['OpenBSD']: - config.cc += " -pthread" - config.cxx += " -pthread" - -config.substitutions.append(('%cc', config.cc)) -config.substitutions.append(('%cxx', config.cxx)) - -config.substitutions.append(('%lldbmi', lldbmi + " --synchronous")) -config.substitutions.append(('%lldb', lldb)) - -if debugserver is not None: - config.substitutions.append(('%debugserver', debugserver)) - -for pattern in [r"\bFileCheck\b", - r"\blldb-test\b", - r"\byaml2obj\b", - r"\| \bnot\b"]: - tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", - pattern) - tool_pipe = tool_match.group(2) - tool_name = tool_match.group(4) - tool_path = lit.util.which(tool_name, config.environment['PATH']) - if not tool_path: - # Warn, but still provide a substitution. - lit_config.note( - 'Did not find ' + tool_name + ' in ' + config.environment['PATH']) - config.substitutions.append((pattern, tool_pipe + tool_path)) - -# Shell execution -if platform.system() not in ['Windows'] or lit_config.getBashPath() != '': - config.available_features.add('shell') - -# Running on Darwin OS -if platform.system() in ['Darwin']: - config.available_features.add('darwin') - config.available_features.add('system-linker-mach-o') - -# Running on ELF based *nix -if platform.system() in ['FreeBSD', 'Linux']: - config.available_features.add('system-linker-elf') - if platform.system() in ['FreeBSD']: - config.available_features.add('freebsd') - else: - config.available_features.add('linux') - -config.available_features.add( - binary_feature(platform.system() in ['Windows'], 'windows', 'no')) - -if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple): - config.available_features.add("armhf-linux") - -if re.match(r'icc', config.cc): - config.available_features.add("compiler-icc") -elif re.match(r'clang', config.cc): - config.available_features.add("compiler-clang") -elif re.match(r'gcc', config.cc): - config.available_features.add("compiler-gcc") -elif re.match(r'cl', config.cc): - config.available_features.add("compiler-msvc") - -config.available_features.add(binary_feature(config.have_zlib, "zlib", "no")) -if config.have_lld: - config.available_features.add("lld") - -# llvm-config knows whether it is compiled with asserts (and) -# whether we are operating in release/debug mode. -import subprocess -try: - llvm_config_cmd = \ - subprocess.Popen([os.path.join(llvm_tools_dir, 'llvm-config'), - '--build-mode', '--assertion-mode', '--targets-built'], - stdout = subprocess.PIPE) -except OSError as why: - print("Could not find llvm-config in " + llvm_tools_dir) - exit(42) - -llvm_config_output = llvm_config_cmd.stdout.read().decode('utf_8') -llvm_config_output_list = llvm_config_output.split("\n") - -if re.search(r'DEBUG', llvm_config_output_list[0]): - config.available_features.add('debug') -if re.search(r'ON', llvm_config_output_list[1]): - config.available_features.add('asserts') -if re.search(r'ARM', llvm_config_output_list[2]): - config.available_features.add('arm') -if re.search(r'Mips', llvm_config_output_list[2]): - config.available_features.add('mips') -if re.search(r'PowerPC', llvm_config_output_list[2]): - config.available_features.add('powerpc') -if re.search(r'X86', llvm_config_output_list[2]): - config.available_features.add('x86') -llvm_config_cmd.wait() diff --git a/lit/lit.cfg.py b/lit/lit.cfg.py new file mode 100644 index 000000000000..e1db7621e328 --- /dev/null +++ b/lit/lit.cfg.py @@ -0,0 +1,75 @@ +# -*- Python -*- + +import os +import re +import shutil +import site +import sys + +import lit.formats +from lit.llvm import llvm_config +from lit.llvm.subst import FindTool +from lit.llvm.subst import ToolSubst + +site.addsitedir(os.path.dirname(__file__)) +from helper import toolchain + +# name: The name of this test suite. +config.name = 'LLDB' + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) + +# suffixes: A list of file extensions to treat as test files. This is overriden +# by individual lit.local.cfg files in the test subdirectories. +config.suffixes = ['.test', '.cpp', '.s'] + +# excludes: A list of directories to exclude from the testsuite. The 'Inputs' +# subdirectories contain auxiliary inputs for various tests in their parent +# directories. +config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt'] + +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) + +# test_exec_root: The root path where tests should be run. +config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit') + + +llvm_config.use_default_substitutions() + +toolchain.use_lldb_substitutions(config) + +toolchain.use_support_substitutions(config) + + +if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple): + config.available_features.add("armhf-linux") + +def calculate_arch_features(arch_string): + # This will add a feature such as x86, arm, mips, etc for each built + # target + features = [] + for arch in arch_string.split(): + features.append(arch.lower()) + return features + +# Run llvm-config and add automatically add features for whether we have +# assertions enabled, whether we are in debug mode, and what targets we +# are built for. +llvm_config.feature_config( + [('--assertion-mode', {'ON': 'asserts'}), + ('--build-mode', {'DEBUG': 'debug'}), + ('--targets-built', calculate_arch_features) + ]) + +# Clean the module caches in the test build directory. This is +# necessary in an incremental build whenever clang changes underneath, +# so doing it once per lit.py invocation is close enough. + +for i in ['module-cache-clang', 'module-cache-lldb']: + cachedir = os.path.join(config.lldb_libs_dir, '..', + 'lldb-test-build.noindex', i) + if os.path.isdir(cachedir): + print("Deleting module cache at %s."%cachedir) + shutil.rmtree(cachedir) diff --git a/lit/lit.site.cfg.in b/lit/lit.site.cfg.py.in index 55942db64c4f..fbf88efcc2f5 100644 --- a/lit/lit.site.cfg.in +++ b/lit/lit.site.cfg.py.in @@ -4,29 +4,36 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.lldb_obj_root = "@LLDB_BINARY_DIR@" config.lldb_libs_dir = "@LLDB_LIBS_DIR@" config.lldb_tools_dir = "@LLDB_TOOLS_DIR@" +# Since it comes from the command line, it may have backslashes which +# should not need to be escaped. +config.lldb_lit_tools_dir = r"@LLDB_LIT_TOOLS_DIR@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" -config.cc = "@LLDB_TEST_C_COMPILER@" -config.cxx = "@LLDB_TEST_CXX_COMPILER@" config.have_zlib = @LLVM_ENABLE_ZLIB@ -config.have_lld = @LLDB_HAVE_LLD@ +config.host_triple = "@LLVM_HOST_TRIPLE@" +config.lldb_bitness = 64 if @LLDB_IS_64_BITS@ else 32 # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. try: config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params + config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params config.lldb_tools_dir = config.lldb_tools_dir % lit_config.params - config.cc = config.cc % lit_config.params - config.cxx = config.cxx % lit_config.params + config.lldb_lit_tools_dir = config.lldb_lit_tools_dir % lit_config.params + except KeyError as e: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) +import lit.llvm +lit.llvm.initialize(lit_config, config) + # Let the main config do the real work. -lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg") +lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg.py") diff --git a/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test b/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test new file mode 100644 index 000000000000..48f86b4d678c --- /dev/null +++ b/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test @@ -0,0 +1,47 @@ +# XFAIL: system-windows +# -> llvm.org/pr24452 +# +# RUN: %clang -o %t %p/inputs/break-insert-pending.c -g +# RUN: %lldbmi %t < %s | FileCheck %s + +# Test for enabling pending breakpoints globally + +-break-insert printf +# CHECK: ^error,msg="Command 'break-insert'. Breakpoint location 'printf' not found + +-gdb-set breakpoint pending on +# CHECK: ^done +-gdb-show breakpoint pending +# CHECK: ^done,value="on" +-break-insert printf +# CHECK: ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0xffffffffffffffff",func="??",file="??",fullname="??/??",line="0",pending=["printf"],times="0",original-location="printf"} + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={level="0",addr="{{0x[0-9a-f]*[^f][0-9a-f]*}}" +-break-disable 2 +# CHECK: ^done +-exec-continue +# CHECK: ^running +# CHECK: *stopped,reason="exited-normally" + +# Test that it can be turned back off +-gdb-show breakpoint pending +# CHECK: ^done,value="on" +-gdb-set breakpoint pending off +# CHECK: ^done +-gdb-show breakpoint pending +# CHECK: ^done,value="off" +-break-insert printf-non-existent +# CHECK: ^error,msg="Command 'break-insert'. Breakpoint location 'printf-non-existent' not found" +# Check that enable/disable with 1 and 0 works +-gdb-set breakpoint pending 1 +# CHECK: ^done +-gdb-show breakpoint pending +# CHECK: ^done,value="on" +-gdb-set breakpoint pending 0 +# CHECK: ^done +-gdb-show breakpoint pending +# CHECK: ^done,value="off" +-gdb-set breakpoint pending garbage +# CHECK: ^done diff --git a/lit/tools/lldb-mi/breakpoint/break-insert.test b/lit/tools/lldb-mi/breakpoint/break-insert.test index cecf9e2443ae..ef50bf530077 100644 --- a/lit/tools/lldb-mi/breakpoint/break-insert.test +++ b/lit/tools/lldb-mi/breakpoint/break-insert.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o a.exe %p/inputs/break-insert.c -g +# RUN: %build %p/inputs/break-insert.c --nodefaultlib -o a.exe # RUN: %lldbmi < %s | FileCheck %s # Test that a breakpoint can be inserted before creating a target. diff --git a/lit/tools/lldb-mi/breakpoint/inputs/break-insert-pending.c b/lit/tools/lldb-mi/breakpoint/inputs/break-insert-pending.c new file mode 100644 index 000000000000..99722abfbd4b --- /dev/null +++ b/lit/tools/lldb-mi/breakpoint/inputs/break-insert-pending.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main(int argc, char const *argv[]) { + printf("Print a formatted string so that GCC does not optimize this printf call: %s\n", argv[0]); + return 0; +} diff --git a/lit/tools/lldb-mi/data/data-info-line.test b/lit/tools/lldb-mi/data/data-info-line.test index c224efa4de2d..287e833ab9ef 100644 --- a/lit/tools/lldb-mi/data/data-info-line.test +++ b/lit/tools/lldb-mi/data/data-info-line.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/data-info-line.c -g +# RUN: %build %p/inputs/data-info-line.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -data-info-line command. diff --git a/lit/tools/lldb-mi/exec/exec-continue.test b/lit/tools/lldb-mi/exec/exec-continue.test index c363422373d3..d51393e5c716 100644 --- a/lit/tools/lldb-mi/exec/exec-continue.test +++ b/lit/tools/lldb-mi/exec/exec-continue.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-continue command. diff --git a/lit/tools/lldb-mi/exec/exec-finish.test b/lit/tools/lldb-mi/exec/exec-finish.test index 03c6b158fcf3..b2a50c5267fd 100644 --- a/lit/tools/lldb-mi/exec/exec-finish.test +++ b/lit/tools/lldb-mi/exec/exec-finish.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-finish command. diff --git a/lit/tools/lldb-mi/exec/exec-interrupt.test b/lit/tools/lldb-mi/exec/exec-interrupt.test index 81a3e72ee7e6..2c063236d7f5 100644 --- a/lit/tools/lldb-mi/exec/exec-interrupt.test +++ b/lit/tools/lldb-mi/exec/exec-interrupt.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-interrupt command. diff --git a/lit/tools/lldb-mi/exec/exec-next-instruction.test b/lit/tools/lldb-mi/exec/exec-next-instruction.test index 1dcca0468490..abd4e526375f 100644 --- a/lit/tools/lldb-mi/exec/exec-next-instruction.test +++ b/lit/tools/lldb-mi/exec/exec-next-instruction.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-next-instruction command. diff --git a/lit/tools/lldb-mi/exec/exec-next.test b/lit/tools/lldb-mi/exec/exec-next.test index a4dd737b5ddb..87d9d44bb582 100644 --- a/lit/tools/lldb-mi/exec/exec-next.test +++ b/lit/tools/lldb-mi/exec/exec-next.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-next command. diff --git a/lit/tools/lldb-mi/exec/exec-step-instruction.test b/lit/tools/lldb-mi/exec/exec-step-instruction.test index a02bc01a07d6..0613fb5c7934 100644 --- a/lit/tools/lldb-mi/exec/exec-step-instruction.test +++ b/lit/tools/lldb-mi/exec/exec-step-instruction.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-step-instruction command. diff --git a/lit/tools/lldb-mi/exec/exec-step.test b/lit/tools/lldb-mi/exec/exec-step.test index 095bba714ec8..976afb33bcd4 100644 --- a/lit/tools/lldb-mi/exec/exec-step.test +++ b/lit/tools/lldb-mi/exec/exec-step.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c -g +# RUN: %build %p/inputs/main.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -exec-step command. diff --git a/lit/tools/lldb-mi/symbol/symbol-list-lines.test b/lit/tools/lldb-mi/symbol/symbol-list-lines.test index f40ad2f94e40..792f283db1bb 100644 --- a/lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ b/lit/tools/lldb-mi/symbol/symbol-list-lines.test @@ -1,7 +1,4 @@ -# XFAIL: windows -# -> llvm.org/pr24452 -# -# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g +# RUN: %build %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c --nodefaultlib -o %t # RUN: %lldbmi %t < %s | FileCheck %s # Test lldb-mi -symbol-list-lines command. @@ -14,7 +11,7 @@ # CHECK: ^error,msg="File Handler. Invalid file name path" -symbol-list-lines symbol-list-lines.c -# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="3"},{pc="0x{{[0-9A-Fa-f]+}}",line="4"},{pc="0x{{[0-9A-Fa-f]+}}",line="5"}] +# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="3"},{pc="0x{{[0-9A-Fa-f]+}}",line="4"},{pc="0x{{[0-9A-Fa-f]+}}",line="5"}{{.*}}] -symbol-list-lines list-lines-helper.c -# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="1"},{pc="0x{{[0-9A-Fa-f]+}}",line="2"},{pc="0x{{[0-9A-Fa-f]+}}",line="3"}] +# CHECK: ^done,lines=[{pc="0x{{[0-9A-Fa-f]+}}",line="1"},{pc="0x{{[0-9A-Fa-f]+}}",line="2"},{pc="0x{{[0-9A-Fa-f]+}}",line="3"}{{.*}}] diff --git a/lit/tools/lldb-mi/target/inputs/main.c b/lit/tools/lldb-mi/target/inputs/main.c new file mode 100644 index 000000000000..8c74b3496f7c --- /dev/null +++ b/lit/tools/lldb-mi/target/inputs/main.c @@ -0,0 +1,4 @@ +int main(void) { + int x = 0; + return x; +} diff --git a/lit/tools/lldb-mi/target/inputs/target-select-so-path.py b/lit/tools/lldb-mi/target/inputs/target-select-so-path.py new file mode 100644 index 000000000000..5eb07d84237c --- /dev/null +++ b/lit/tools/lldb-mi/target/inputs/target-select-so-path.py @@ -0,0 +1,50 @@ +import os +import sys +import subprocess +from threading import Timer + + +hostname = 'localhost' + +(r, w) = os.pipe() +kwargs = {} +if sys.version_info >= (3,2): + kwargs['pass_fds'] = [w] + +args = sys.argv +# Get debugserver, lldb-mi and FileCheck executables' paths with arguments. +debugserver = ' '.join([args[1], '--pipe', str(w), hostname + ':0']) +lldbmi = args[2] +test_file = args[3] +filecheck = 'FileCheck ' + test_file + +# Run debugserver, lldb-mi and FileCheck. +debugserver_proc = subprocess.Popen(debugserver.split(), **kwargs) +lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, shell=True) +filecheck_proc = subprocess.Popen(filecheck, stdin=subprocess.PIPE, + shell=True) + +timeout_sec = 30 +timer = Timer(timeout_sec, exit, [filecheck_proc.returncode]) +try: + timer.start() + + # Get a tcp port chosen by debugserver. + # The number quite big to get lldb-server's output and to not hang. + bytes_to_read = 10 + port_bytes = os.read(r, bytes_to_read) + port = str(port_bytes.decode('utf-8').strip('\x00')) + + with open(test_file, 'r') as f: + # Replace '$PORT' with a free port number and pass + # test's content to lldb-mi. + lldbmi_proc.stdin.write(f.read().replace('$PORT', port).encode('utf-8')) + out, err = lldbmi_proc.communicate() + filecheck_proc.stdin.write(out) + filecheck_proc.communicate() +finally: + timer.cancel() + +debugserver_proc.kill() +exit(filecheck_proc.returncode) diff --git a/lit/Expr/lit.local.cfg b/lit/tools/lldb-mi/target/lit.local.cfg index df9b335dd131..df9b335dd131 100644 --- a/lit/Expr/lit.local.cfg +++ b/lit/tools/lldb-mi/target/lit.local.cfg diff --git a/lit/tools/lldb-mi/target/target-select-so-path.test b/lit/tools/lldb-mi/target/target-select-so-path.test new file mode 100644 index 000000000000..785030bf2fd3 --- /dev/null +++ b/lit/tools/lldb-mi/target/target-select-so-path.test @@ -0,0 +1,25 @@ +# UNSUPPORTED: windows, darwin +# +# RUN: %clang -o %t %p/inputs/main.c -g +# RUN: %python %p/inputs/target-select-so-path.py "%debugserver" "%lldbmi %t" %s + +# Test that -target-select command can hook up a path +# added by gdb-set solib-search-path. + +# Check that we have a valid target created via file-exec-and-symbols. +# CHECK: ^done + +-interpreter-exec console "target modules search-paths list" +# CHECK ^done + +-gdb-set solib-search-path /example/dir +# CHECK: ^done + +-target-select remote localhost:$PORT +# CHECK: ^connected + +-interpreter-exec console "target modules search-paths list" +# CHECK: ~"[0] \".\" -> \"/example/dir\"\n" +# CHECK-NEXT: ^done + +-gdb-exit |
