Hi Pavel, looks like this broke the lldb-standalone macOS bot. http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/151/console
FAILED: unittests/TestingSupport/CMakeFiles/lldbUtilityHelpers.dir/TestUtilities.cpp.o [trim] /Users/buildslave/jenkins/workspace/lldb-cmake-standalone/llvm-project/lldb/unittests/TestingSupport/TestUtilities.cpp:16:10: fatal error: 'gtest/gtest.h' file not found Can you please take a look? On Tue, Aug 20, 2019 at 5:27 AM Pavel Labath via lldb-commits <lldb-commits@lists.llvm.org> wrote: > > Author: labath > Date: Tue Aug 20 05:28:36 2019 > New Revision: 369374 > > URL: http://llvm.org/viewvc/llvm-project?rev=369374&view=rev > Log: > unittests: Use yaml2obj as a library instead of an external process > > Summary: > Recently, yaml2obj has been turned into a library. This means we can use > it from our unit tests directly, instead of shelling out to an external > process. This patch does just that. > > Reviewers: JDevlieghere, aadsm, espindola, jdoerfert > > Subscribers: emaste, mgorny, arichardson, MaskRay, jhenderson, abrachet, > lldb-commits > > Differential Revision: https://reviews.llvm.org/D65949 > > Removed: > lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml > > lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml > lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml > Modified: > lldb/trunk/unittests/Core/CMakeLists.txt > lldb/trunk/unittests/Core/MangledTest.cpp > lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt > lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp > lldb/trunk/unittests/Symbol/CMakeLists.txt > lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp > lldb/trunk/unittests/Symbol/TestLineEntry.cpp > lldb/trunk/unittests/TestingSupport/CMakeLists.txt > lldb/trunk/unittests/TestingSupport/TestUtilities.cpp > lldb/trunk/unittests/TestingSupport/TestUtilities.h > > Modified: lldb/trunk/unittests/Core/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/Core/CMakeLists.txt (original) > +++ lldb/trunk/unittests/Core/CMakeLists.txt Tue Aug 20 05:28:36 2019 > @@ -15,8 +15,3 @@ add_lldb_unittest(LLDBCoreTests > LINK_COMPONENTS > Support > ) > - > -set(test_inputs > - mangled-function-names.yaml > - ) > -add_unittest_inputs(LLDBCoreTests "${test_inputs}") > > Removed: lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml?rev=369373&view=auto > ============================================================================== > --- lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (original) > +++ lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (removed) > @@ -1,129 +0,0 @@ > ---- !ELF > -FileHeader: > - Class: ELFCLASS64 > - Data: ELFDATA2LSB > - Type: ET_EXEC > - Machine: EM_X86_64 > -Sections: > - - Name: .text > - Type: SHT_PROGBITS > - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > - AddressAlign: 0x0000000000000010 > - Content: 554889E58B0425A80000005DC30F1F00 > - - Name: .anothertext > - Type: SHT_PROGBITS > - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > - Address: 0x0000000000000010 > - AddressAlign: 0x0000000000000010 > - Content: > 554889E54883EC20488D0425A8000000C745FC00000000488945F0488B45F08B08894DECE8C7FFFFFF8B4DEC01C189C84883C4205D746573742073747200C3 > - - Name: .eh_frame > - Type: SHT_PROGBITS > - Flags: [ SHF_ALLOC ] > - Address: 0x0000000000000050 > - AddressAlign: 0x0000000000000008 > - Content: > 1400000000000000017A5200017810011B0C0708900100001C0000001C00000090FFFFFF0D00000000410E108602430D06000000000000001C0000003C00000080FFFFFF3F00000000410E108602430D0600000000000000 > - - Name: .data > - Type: SHT_PROGBITS > - Flags: [ SHF_WRITE, SHF_ALLOC ] > - Address: 0x00000000000000A8 > - AddressAlign: 0x0000000000000004 > - Content: '01000000' > - - Name: .comment > - Type: SHT_PROGBITS > - Flags: [ SHF_MERGE, SHF_STRINGS ] > - AddressAlign: 0x0000000000000001 > - Content: > 5562756E747520636C616E672076657273696F6E20332E352D317562756E74753120287472756E6B2920286261736564206F6E204C4C564D20332E352900 > -Symbols: > - - Type: STT_SECTION > - Section: .text > - - Type: STT_SECTION > - Section: .anothertext > - Value: 0x0000000000000010 > - - Type: STT_SECTION > - Section: .eh_frame > - Value: 0x0000000000000050 > - - Type: STT_SECTION > - Section: .data > - Value: 0x00000000000000A8 > - - Type: STT_SECTION > - Section: .comment > - - Name: /tmp/a.c > - Type: STT_FILE > - - Type: STT_FILE > - - Name: somedata > - Type: STT_OBJECT > - Section: .anothertext > - Value: 0x0000000000000045 > - Binding: STB_GLOBAL > - - Name: main > - Type: STT_FUNC > - Section: .anothertext > - Value: 0x0000000000000010 > - Size: 0x000000000000003F > - Binding: STB_GLOBAL > - - Name: _Z3foov > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: puts@GLIBC_2.5 > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: puts@GLIBC_2.6 > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _Z5annotv@VERSION3 > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZN1AC2Ev > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZN1AD2Ev > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZN1A3barEv > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZGVZN4llvm4dbgsEvE7thestrm > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZZN4llvm4dbgsEvE7thestrm > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _ZTVN5clang4DeclE > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: -[ObjCfoo] > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: +[B ObjCbar(WithCategory)] > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > - - Name: _Z12undemangableEvx42 > - Type: STT_FUNC > - Section: .text > - Size: 0x000000000000000D > - Binding: STB_GLOBAL > -... > > Modified: lldb/trunk/unittests/Core/MangledTest.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/MangledTest.cpp?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/Core/MangledTest.cpp (original) > +++ lldb/trunk/unittests/Core/MangledTest.cpp Tue Aug 20 05:28:36 2019 > @@ -56,15 +56,113 @@ TEST(MangledTest, NameIndexes_FindFuncti > ObjectFileELF::Initialize(); > SymbolFileSymtab::Initialize(); > > - llvm::SmallString<128> Obj; > - ASSERT_NO_ERROR(llvm::sys::fs::createTemporaryFile( > - "mangled-function-names-%%%%%%", "obj", Obj)); > - llvm::FileRemover Deleter(Obj); > - ASSERT_THAT_ERROR(ReadYAMLObjectFile("mangled-function-names.yaml", Obj), > - llvm::Succeeded()); > + auto ExpectedFile = TestFile::fromYaml(R"( > +--- !ELF > +FileHeader: > + Class: ELFCLASS64 > + Data: ELFDATA2LSB > + Type: ET_EXEC > + Machine: EM_X86_64 > +Sections: > + - Name: .text > + Type: SHT_PROGBITS > + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > + AddressAlign: 0x0000000000000010 > + Size: 0x20 > + - Name: .anothertext > + Type: SHT_PROGBITS > + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > + Address: 0x0000000000000010 > + AddressAlign: 0x0000000000000010 > + Size: 0x40 > + - Name: .data > + Type: SHT_PROGBITS > + Flags: [ SHF_WRITE, SHF_ALLOC ] > + Address: 0x00000000000000A8 > + AddressAlign: 0x0000000000000004 > + Content: '01000000' > +Symbols: > + - Name: somedata > + Type: STT_OBJECT > + Section: .anothertext > + Value: 0x0000000000000045 > + Binding: STB_GLOBAL > + - Name: main > + Type: STT_FUNC > + Section: .anothertext > + Value: 0x0000000000000010 > + Size: 0x000000000000003F > + Binding: STB_GLOBAL > + - Name: _Z3foov > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: puts@GLIBC_2.5 > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: puts@GLIBC_2.6 > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _Z5annotv@VERSION3 > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZN1AC2Ev > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZN1AD2Ev > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZN1A3barEv > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZGVZN4llvm4dbgsEvE7thestrm > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZZN4llvm4dbgsEvE7thestrm > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _ZTVN5clang4DeclE > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: -[ObjCfoo] > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: +[B ObjCbar(WithCategory)] > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > + - Name: _Z12undemangableEvx42 > + Type: STT_FUNC > + Section: .text > + Size: 0x000000000000000D > + Binding: STB_GLOBAL > +... > +)"); > + ASSERT_THAT_EXPECTED(ExpectedFile, llvm::Succeeded()); > > - ModuleSpec Spec{FileSpec(Obj)}; > - Spec.GetSymbolFileSpec().SetFile(Obj, FileSpec::Style::native); > + ModuleSpec Spec{FileSpec(ExpectedFile->name())}; > auto M = std::make_shared<Module>(Spec); > > auto Count = [M](const char *Name, FunctionNameType Type) -> int { > > Modified: lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt (original) > +++ lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt Tue Aug 20 05:28:36 > 2019 > @@ -11,6 +11,5 @@ add_lldb_unittest(ObjectFileELFTests > > set(test_inputs > early-section-headers.so > - sections-resolve-consistently.yaml > ) > add_unittest_inputs(ObjectFileELFTests "${test_inputs}") > > Removed: > lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml?rev=369373&view=auto > ============================================================================== > --- > lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml > (original) > +++ > lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml > (removed) > @@ -1,52 +0,0 @@ > ---- !ELF > -FileHeader: > - Class: ELFCLASS64 > - Data: ELFDATA2LSB > - Type: ET_EXEC > - Machine: EM_X86_64 > - Entry: 0x0000000000400180 > -Sections: > - - Name: .note.gnu.build-id > - Type: SHT_NOTE > - Flags: [ SHF_ALLOC ] > - Address: 0x0000000000400158 > - AddressAlign: 0x0000000000000004 > - Content: > 040000001400000003000000474E55003F3EC29E3FD83E49D18C4D49CD8A730CC13117B6 > - - Name: .text > - Type: SHT_PROGBITS > - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > - Address: 0x0000000000400180 > - AddressAlign: 0x0000000000000010 > - Content: 554889E58B042500106000890425041060005DC3 > - - Name: .data > - Type: SHT_PROGBITS > - Flags: [ SHF_WRITE, SHF_ALLOC ] > - Address: 0x0000000000601000 > - AddressAlign: 0x0000000000000004 > - Content: 2F000000 > - - Name: .bss > - Type: SHT_NOBITS > - Flags: [ SHF_WRITE, SHF_ALLOC ] > - Address: 0x0000000000601004 > - AddressAlign: 0x0000000000000004 > - Size: 0x0000000000000004 > -Symbols: > - - Name: Y > - Type: STT_OBJECT > - Section: .data > - Value: 0x0000000000601000 > - Size: 0x0000000000000004 > - Binding: STB_GLOBAL > - - Name: _start > - Type: STT_FUNC > - Section: .text > - Value: 0x0000000000400180 > - Size: 0x0000000000000014 > - Binding: STB_GLOBAL > - - Name: X > - Type: STT_OBJECT > - Section: .bss > - Value: 0x0000000000601004 > - Size: 0x0000000000000004 > - Binding: STB_GLOBAL > -... > > Modified: lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp (original) > +++ lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp Tue Aug 20 > 05:28:36 2019 > @@ -48,16 +48,65 @@ protected: > }; > > TEST_F(ObjectFileELFTest, SectionsResolveConsistently) { > - llvm::SmallString<128> obj; > - ASSERT_NO_ERROR(llvm::sys::fs::createTemporaryFile( > - "sections-resolve-consistently-%%%%%%", "obj", obj)); > - llvm::FileRemover remover(obj); > - ASSERT_THAT_ERROR( > - ReadYAMLObjectFile("sections-resolve-consistently.yaml", obj), > - llvm::Succeeded()); > + auto ExpectedFile = TestFile::fromYaml(R"( > +--- !ELF > +FileHeader: > + Class: ELFCLASS64 > + Data: ELFDATA2LSB > + Type: ET_EXEC > + Machine: EM_X86_64 > + Entry: 0x0000000000400180 > +Sections: > + - Name: .note.gnu.build-id > + Type: SHT_NOTE > + Flags: [ SHF_ALLOC ] > + Address: 0x0000000000400158 > + AddressAlign: 0x0000000000000004 > + Content: > 040000001400000003000000474E55003F3EC29E3FD83E49D18C4D49CD8A730CC13117B6 > + - Name: .text > + Type: SHT_PROGBITS > + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > + Address: 0x0000000000400180 > + AddressAlign: 0x0000000000000010 > + Content: 554889E58B042500106000890425041060005DC3 > + - Name: .data > + Type: SHT_PROGBITS > + Flags: [ SHF_WRITE, SHF_ALLOC ] > + Address: 0x0000000000601000 > + AddressAlign: 0x0000000000000004 > + Content: 2F000000 > + - Name: .bss > + Type: SHT_NOBITS > + Flags: [ SHF_WRITE, SHF_ALLOC ] > + Address: 0x0000000000601004 > + AddressAlign: 0x0000000000000004 > + Size: 0x0000000000000004 > +Symbols: > + - Name: Y > + Type: STT_OBJECT > + Section: .data > + Value: 0x0000000000601000 > + Size: 0x0000000000000004 > + Binding: STB_GLOBAL > + - Name: _start > + Type: STT_FUNC > + Section: .text > + Value: 0x0000000000400180 > + Size: 0x0000000000000014 > + Binding: STB_GLOBAL > + - Name: X > + Type: STT_OBJECT > + Section: .bss > + Value: 0x0000000000601004 > + Size: 0x0000000000000004 > + Binding: STB_GLOBAL > +... > +)"); > + ASSERT_THAT_EXPECTED(ExpectedFile, llvm::Succeeded()); > > - ModuleSpec spec{FileSpec(obj)}; > - spec.GetSymbolFileSpec().SetFile(obj, FileSpec::Style::native); > + ModuleSpec spec{FileSpec(ExpectedFile->name())}; > + spec.GetSymbolFileSpec().SetFile(ExpectedFile->name(), > + FileSpec::Style::native); > auto module_sp = std::make_shared<Module>(spec); > SectionList *list = module_sp->GetSectionList(); > ASSERT_NE(nullptr, list); > > Modified: lldb/trunk/unittests/Symbol/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/Symbol/CMakeLists.txt (original) > +++ lldb/trunk/unittests/Symbol/CMakeLists.txt Tue Aug 20 05:28:36 2019 > @@ -18,7 +18,6 @@ add_lldb_unittest(SymbolTests > ) > > set(test_inputs > - basic-call-frame-info.yaml > inlined-functions.yaml > ) > add_unittest_inputs(SymbolTests "${test_inputs}") > > Removed: lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml?rev=369373&view=auto > ============================================================================== > --- lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml (original) > +++ lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml (removed) > @@ -1,140 +0,0 @@ > ---- !ELF > -FileHeader: > - Class: ELFCLASS64 > - Data: ELFDATA2LSB > - Type: ET_DYN > - Machine: EM_X86_64 > - Entry: 0x0000000000000260 > -Sections: > - - Name: .text > - Type: SHT_PROGBITS > - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > - Address: 0x0000000000000260 > - AddressAlign: 0x0000000000000010 > - Content: > 554889E5897DFC8B45FC5DC30F1F4000554889E5897DFC8B45FC5DC30F1F4000554889E5897DFC8B45FC5DC3 > -#0000000000000260 <eh_frame>: > -# 260: 55 push %rbp > -# 261: 48 89 e5 mov %rsp,%rbp > -# 264: 89 7d fc mov %edi,-0x4(%rbp) > -# 267: 8b 45 fc mov -0x4(%rbp),%eax > -# 26a: 5d pop %rbp > -# 26b: c3 retq > -# 26c: 0f 1f 40 00 nopl 0x0(%rax) > -# > -#0000000000000270 <debug_frame3>: > -# 270: 55 push %rbp > -# 271: 48 89 e5 mov %rsp,%rbp > -# 274: 89 7d fc mov %edi,-0x4(%rbp) > -# 277: 8b 45 fc mov -0x4(%rbp),%eax > -# 27a: 5d pop %rbp > -# 27b: c3 retq > -# 27c: 0f 1f 40 00 nopl 0x0(%rax) > -# > -#0000000000000280 <debug_frame4>: > -# 280: 55 push %rbp > -# 281: 48 89 e5 mov %rsp,%rbp > -# 284: 89 7d fc mov %edi,-0x4(%rbp) > -# 287: 8b 45 fc mov -0x4(%rbp),%eax > -# 28a: 5d pop %rbp > -# 28b: c3 retq > - - Name: .eh_frame > - Type: SHT_X86_64_UNWIND > - Flags: [ SHF_ALLOC ] > - Address: 0x0000000000000290 > - AddressAlign: 0x0000000000000008 > - Content: > 1400000000000000017A5200017810011B0C0708900100001C0000001C000000B0FFFFFF0C00000000410E108602430D0600000000000000 > -#00000000 0000000000000014 00000000 CIE > -# Version: 1 > -# Augmentation: "zR" > -# Code alignment factor: 1 > -# Data alignment factor: -8 > -# Return address column: 16 > -# Augmentation data: 1b > -# > -# DW_CFA_def_cfa: r7 (rsp) ofs 8 > -# DW_CFA_offset: r16 (rip) at cfa-8 > -# DW_CFA_nop > -# DW_CFA_nop > -# > -#00000018 000000000000001c 0000001c FDE cie=00000000 > pc=ffffffffffffffd0..ffffffffffffffdc > -# DW_CFA_advance_loc: 1 to ffffffffffffffd1 > -# DW_CFA_def_cfa_offset: 16 > -# DW_CFA_offset: r6 (rbp) at cfa-16 > -# DW_CFA_advance_loc: 3 to ffffffffffffffd4 > -# DW_CFA_def_cfa_register: r6 (rbp) > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > - - Name: .debug_frame > - Type: SHT_PROGBITS > - AddressAlign: 0x0000000000000008 > - Content: > 14000000FFFFFFFF03000178100C070890010000000000001C0000000000000070020000000000000C00000000000000410E108602430D0614000000FFFFFFFF040008000178100C07089001000000001C0000003800000080020000000000000C00000000000000410E108602430D06 > -#00000000 0000000000000014 ffffffff CIE > -# Version: 3 > -# Augmentation: "" > -# Code alignment factor: 1 > -# Data alignment factor: -8 > -# Return address column: 16 > -# > -# DW_CFA_def_cfa: r7 (rsp) ofs 8 > -# DW_CFA_offset: r16 (rip) at cfa-8 > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# > -#00000018 000000000000001c 00000000 FDE cie=00000000 > pc=0000000000000270..000000000000027c > -# DW_CFA_advance_loc: 1 to 0000000000000271 > -# DW_CFA_def_cfa_offset: 16 > -# DW_CFA_offset: r6 (rbp) at cfa-16 > -# DW_CFA_advance_loc: 3 to 0000000000000274 > -# DW_CFA_def_cfa_register: r6 (rbp) > -# > -#00000038 0000000000000014 ffffffff CIE > -# Version: 4 > -# Augmentation: "" > -# Pointer Size: 8 > -# Segment Size: 0 > -# Code alignment factor: 1 > -# Data alignment factor: -8 > -# Return address column: 16 > -# > -# DW_CFA_def_cfa: r7 (rsp) ofs 8 > -# DW_CFA_offset: r16 (rip) at cfa-8 > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# DW_CFA_nop > -# > -#00000050 000000000000001c 00000038 FDE cie=00000038 > pc=0000000000000280..000000000000028c > -# DW_CFA_advance_loc: 1 to 0000000000000281 > -# DW_CFA_def_cfa_offset: 16 > -# DW_CFA_offset: r6 (rbp) at cfa-16 > -# DW_CFA_advance_loc: 3 to 0000000000000284 > -# DW_CFA_def_cfa_register: r6 (rbp) > -Symbols: > - - Name: eh_frame > - Type: STT_FUNC > - Section: .text > - Value: 0x0000000000000260 > - Size: 0x000000000000000C > - Binding: STB_GLOBAL > - - Name: debug_frame3 > - Type: STT_FUNC > - Section: .text > - Value: 0x0000000000000270 > - Size: 0x000000000000000C > - Binding: STB_GLOBAL > - - Name: debug_frame4 > - Type: STT_FUNC > - Section: .text > - Value: 0x0000000000000280 > - Size: 0x000000000000000C > - Binding: STB_GLOBAL > -... > > Modified: lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp (original) > +++ lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp Tue Aug 20 > 05:28:36 2019 > @@ -87,14 +87,152 @@ static UnwindPlan::Row GetExpectedRow2() > > void DWARFCallFrameInfoTest::TestBasic(DWARFCallFrameInfo::Type type, > llvm::StringRef symbol) { > - llvm::SmallString<128> obj; > - ASSERT_NO_ERROR(llvm::sys::fs::createTemporaryFile( > - "basic-call-frame-info-%%%%%%", "obj", obj)); > - llvm::FileRemover obj_remover(obj); > - ASSERT_THAT_ERROR(ReadYAMLObjectFile("basic-call-frame-info.yaml", obj), > - llvm::Succeeded()); > + auto ExpectedFile = TestFile::fromYaml(R"( > +--- !ELF > +FileHeader: > + Class: ELFCLASS64 > + Data: ELFDATA2LSB > + Type: ET_DYN > + Machine: EM_X86_64 > + Entry: 0x0000000000000260 > +Sections: > + - Name: .text > + Type: SHT_PROGBITS > + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] > + Address: 0x0000000000000260 > + AddressAlign: 0x0000000000000010 > + Content: > 554889E5897DFC8B45FC5DC30F1F4000554889E5897DFC8B45FC5DC30F1F4000554889E5897DFC8B45FC5DC3 > +#0000000000000260 <eh_frame>: > +# 260: 55 push %rbp > +# 261: 48 89 e5 mov %rsp,%rbp > +# 264: 89 7d fc mov %edi,-0x4(%rbp) > +# 267: 8b 45 fc mov -0x4(%rbp),%eax > +# 26a: 5d pop %rbp > +# 26b: c3 retq > +# 26c: 0f 1f 40 00 nopl 0x0(%rax) > +# > +#0000000000000270 <debug_frame3>: > +# 270: 55 push %rbp > +# 271: 48 89 e5 mov %rsp,%rbp > +# 274: 89 7d fc mov %edi,-0x4(%rbp) > +# 277: 8b 45 fc mov -0x4(%rbp),%eax > +# 27a: 5d pop %rbp > +# 27b: c3 retq > +# 27c: 0f 1f 40 00 nopl 0x0(%rax) > +# > +#0000000000000280 <debug_frame4>: > +# 280: 55 push %rbp > +# 281: 48 89 e5 mov %rsp,%rbp > +# 284: 89 7d fc mov %edi,-0x4(%rbp) > +# 287: 8b 45 fc mov -0x4(%rbp),%eax > +# 28a: 5d pop %rbp > +# 28b: c3 retq > + - Name: .eh_frame > + Type: SHT_X86_64_UNWIND > + Flags: [ SHF_ALLOC ] > + Address: 0x0000000000000290 > + AddressAlign: 0x0000000000000008 > + Content: > 1400000000000000017A5200017810011B0C0708900100001C0000001C000000B0FFFFFF0C00000000410E108602430D0600000000000000 > +#00000000 0000000000000014 00000000 CIE > +# Version: 1 > +# Augmentation: "zR" > +# Code alignment factor: 1 > +# Data alignment factor: -8 > +# Return address column: 16 > +# Augmentation data: 1b > +# > +# DW_CFA_def_cfa: r7 (rsp) ofs 8 > +# DW_CFA_offset: r16 (rip) at cfa-8 > +# DW_CFA_nop > +# DW_CFA_nop > +# > +#00000018 000000000000001c 0000001c FDE cie=00000000 > pc=ffffffffffffffd0..ffffffffffffffdc > +# DW_CFA_advance_loc: 1 to ffffffffffffffd1 > +# DW_CFA_def_cfa_offset: 16 > +# DW_CFA_offset: r6 (rbp) at cfa-16 > +# DW_CFA_advance_loc: 3 to ffffffffffffffd4 > +# DW_CFA_def_cfa_register: r6 (rbp) > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > + - Name: .debug_frame > + Type: SHT_PROGBITS > + AddressAlign: 0x0000000000000008 > + Content: > 14000000FFFFFFFF03000178100C070890010000000000001C0000000000000070020000000000000C00000000000000410E108602430D0614000000FFFFFFFF040008000178100C07089001000000001C0000003800000080020000000000000C00000000000000410E108602430D06 > +#00000000 0000000000000014 ffffffff CIE > +# Version: 3 > +# Augmentation: "" > +# Code alignment factor: 1 > +# Data alignment factor: -8 > +# Return address column: 16 > +# > +# DW_CFA_def_cfa: r7 (rsp) ofs 8 > +# DW_CFA_offset: r16 (rip) at cfa-8 > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# > +#00000018 000000000000001c 00000000 FDE cie=00000000 > pc=0000000000000270..000000000000027c > +# DW_CFA_advance_loc: 1 to 0000000000000271 > +# DW_CFA_def_cfa_offset: 16 > +# DW_CFA_offset: r6 (rbp) at cfa-16 > +# DW_CFA_advance_loc: 3 to 0000000000000274 > +# DW_CFA_def_cfa_register: r6 (rbp) > +# > +#00000038 0000000000000014 ffffffff CIE > +# Version: 4 > +# Augmentation: "" > +# Pointer Size: 8 > +# Segment Size: 0 > +# Code alignment factor: 1 > +# Data alignment factor: -8 > +# Return address column: 16 > +# > +# DW_CFA_def_cfa: r7 (rsp) ofs 8 > +# DW_CFA_offset: r16 (rip) at cfa-8 > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# DW_CFA_nop > +# > +#00000050 000000000000001c 00000038 FDE cie=00000038 > pc=0000000000000280..000000000000028c > +# DW_CFA_advance_loc: 1 to 0000000000000281 > +# DW_CFA_def_cfa_offset: 16 > +# DW_CFA_offset: r6 (rbp) at cfa-16 > +# DW_CFA_advance_loc: 3 to 0000000000000284 > +# DW_CFA_def_cfa_register: r6 (rbp) > +Symbols: > + - Name: eh_frame > + Type: STT_FUNC > + Section: .text > + Value: 0x0000000000000260 > + Size: 0x000000000000000C > + Binding: STB_GLOBAL > + - Name: debug_frame3 > + Type: STT_FUNC > + Section: .text > + Value: 0x0000000000000270 > + Size: 0x000000000000000C > + Binding: STB_GLOBAL > + - Name: debug_frame4 > + Type: STT_FUNC > + Section: .text > + Value: 0x0000000000000280 > + Size: 0x000000000000000C > + Binding: STB_GLOBAL > +... > +)"); > + ASSERT_THAT_EXPECTED(ExpectedFile, llvm::Succeeded()); > > - auto module_sp = std::make_shared<Module>(ModuleSpec(FileSpec(obj))); > + auto module_sp = > + std::make_shared<Module>(ModuleSpec(FileSpec(ExpectedFile->name()))); > SectionList *list = module_sp->GetSectionList(); > ASSERT_NE(nullptr, list); > > > Modified: lldb/trunk/unittests/Symbol/TestLineEntry.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestLineEntry.cpp?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/Symbol/TestLineEntry.cpp (original) > +++ lldb/trunk/unittests/Symbol/TestLineEntry.cpp Tue Aug 20 05:28:36 2019 > @@ -33,13 +33,7 @@ using namespace lldb; > > class LineEntryTest : public testing::Test { > public: > - void SetUp() override { > - FileSystem::Initialize(); > - HostInfo::Initialize(); > - ObjectFileMachO::Initialize(); > - SymbolFileDWARF::Initialize(); > - ClangASTContext::Initialize(); > - } > + void SetUp() override; > > void TearDown() override { > ClangASTContext::Terminate(); > @@ -50,44 +44,32 @@ public: > } > > protected: > - llvm::Expected<ModuleSP> GetModule(); > llvm::Expected<LineEntry> GetLineEntryForLine(uint32_t line); > + llvm::Optional<TestFile> m_file; > ModuleSP m_module_sp; > }; > > -llvm::Expected<ModuleSP> LineEntryTest::GetModule() { > - if (m_module_sp) > - return m_module_sp; > - > - llvm::SmallString<128> obj; > - if (auto ec = llvm::sys::fs::createTemporaryFile("source-%%%%%%", "obj", > obj)) > - return llvm::errorCodeToError(ec); > - llvm::FileRemover obj_remover(obj); > - if (auto error = ReadYAMLObjectFile("inlined-functions.yaml", obj)) > - return llvm::Error(std::move(error)); > - > - m_module_sp = std::make_shared<Module>(ModuleSpec(FileSpec(obj))); > - // Preload because the temporary file will be gone once we exit this > function. > - m_module_sp->PreloadSymbols(); > - return m_module_sp; > +void LineEntryTest::SetUp() { > + FileSystem::Initialize(); > + HostInfo::Initialize(); > + ObjectFileMachO::Initialize(); > + SymbolFileDWARF::Initialize(); > + ClangASTContext::Initialize(); > + auto ExpectedFile = TestFile::fromYamlFile("inlined-functions.yaml"); > + ASSERT_THAT_EXPECTED(ExpectedFile, llvm::Succeeded()); > + m_file.emplace(std::move(*ExpectedFile)); > + m_module_sp = > std::make_shared<Module>(ModuleSpec(FileSpec(m_file->name()))); > } > > llvm::Expected<LineEntry> LineEntryTest::GetLineEntryForLine(uint32_t line) { > - auto expected_module_so = GetModule(); > - > - if (!expected_module_so) > - return llvm::createStringError(llvm::inconvertibleErrorCode(), > - "Not able to get module for test > object."); > - > - auto module = expected_module_so->get(); > bool check_inlines = true; > bool exact = true; > SymbolContextList sc_comp_units; > SymbolContextList sc_line_entries; > FileSpec file_spec("inlined-functions.cpp"); > - module->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines, > - lldb::eSymbolContextCompUnit, > - sc_comp_units); > + m_module_sp->ResolveSymbolContextsForFileSpec(file_spec, line, > check_inlines, > + lldb::eSymbolContextCompUnit, > + sc_comp_units); > if (sc_comp_units.GetSize() == 0) > return llvm::createStringError(llvm::inconvertibleErrorCode(), > "No comp unit found on the test object."); > > Modified: lldb/trunk/unittests/TestingSupport/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/TestingSupport/CMakeLists.txt (original) > +++ lldb/trunk/unittests/TestingSupport/CMakeLists.txt Tue Aug 20 05:28:36 > 2019 > @@ -8,7 +8,5 @@ add_lldb_library(lldbUtilityHelpers > > LINK_COMPONENTS > Support > + ObjectYAML > ) > - > -add_dependencies(lldbUtilityHelpers yaml2obj) > -add_definitions(-DYAML2OBJ="$<TARGET_FILE:yaml2obj>") > \ No newline at end of file > > Modified: lldb/trunk/unittests/TestingSupport/TestUtilities.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/TestUtilities.cpp?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/TestingSupport/TestUtilities.cpp (original) > +++ lldb/trunk/unittests/TestingSupport/TestUtilities.cpp Tue Aug 20 05:28:36 > 2019 > @@ -8,9 +8,14 @@ > > #include "TestUtilities.h" > #include "llvm/ADT/SmallString.h" > +#include "llvm/ObjectYAML/yaml2obj.h" > #include "llvm/Support/FileSystem.h" > #include "llvm/Support/Path.h" > #include "llvm/Support/Program.h" > +#include "llvm/Support/YAMLTraits.h" > +#include "gtest/gtest.h" > + > +using namespace lldb_private; > > extern const char *TestMainArgv0; > > @@ -21,23 +26,39 @@ std::string lldb_private::GetInputFilePa > return result.str(); > } > > -llvm::Error > -lldb_private::ReadYAMLObjectFile(const llvm::Twine &yaml_name, > - llvm::SmallString<128> &object_file) { > - std::string yaml = GetInputFilePath(yaml_name); > - llvm::StringRef args[] = {YAML2OBJ, yaml}; > - llvm::StringRef obj_ref = object_file; > - const llvm::Optional<llvm::StringRef> redirects[] = {llvm::None, obj_ref, > - llvm::None}; > - if (llvm::sys::ExecuteAndWait(YAML2OBJ, args, llvm::None, redirects) != 0) > - return llvm::createStringError(llvm::inconvertibleErrorCode(), > - "Error running yaml2obj %s.", > yaml.c_str()); > - uint64_t size; > - if (auto ec = llvm::sys::fs::file_size(object_file, size)) > - return llvm::errorCodeToError(ec); > - if (size == 0) > - return llvm::createStringError( > - llvm::inconvertibleErrorCode(), > - "Empty object file created from yaml2obj %s.", yaml.c_str()); > - return llvm::Error::success(); > +llvm::Expected<TestFile> TestFile::fromYaml(llvm::StringRef Yaml) { > + const auto *Info = testing::UnitTest::GetInstance()->current_test_info(); > + assert(Info); > + llvm::SmallString<128> Name; > + int FD; > + if (std::error_code EC = llvm::sys::fs::createTemporaryFile( > + llvm::Twine(Info->test_case_name()) + "-" + Info->name(), "test", > FD, > + Name)) > + return llvm::errorCodeToError(EC); > + llvm::FileRemover Remover(Name); > + { > + llvm::raw_fd_ostream OS(FD, /*shouldClose*/ true); > + llvm::yaml::Input YIn(Yaml); > + if (llvm::Error E = llvm::yaml::convertYAML(YIn, OS)) > + return std::move(E); > + } > + return TestFile(Name, std::move(Remover)); > +} > + > +llvm::Expected<TestFile> TestFile::fromYamlFile(const llvm::Twine &Name) { > + auto BufferOrError = > + llvm::MemoryBuffer::getFile(GetInputFilePath(Name), /*FileSize*/ -1, > + /*RequiresNullTerminator*/ false); > + if (!BufferOrError) > + return llvm::errorCodeToError(BufferOrError.getError()); > + return fromYaml(BufferOrError.get()->getBuffer()); > +} > + > +TestFile::~TestFile() { > + if (!Name) > + return; > + if (std::error_code EC = > + llvm::sys::fs::remove(*Name, /*IgnoreNonExisting*/ false)) > + GTEST_LOG_(WARNING) << "Failed to delete `" << Name->c_str() > + << "`: " << EC.message(); > } > > Modified: lldb/trunk/unittests/TestingSupport/TestUtilities.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/TestUtilities.h?rev=369374&r1=369373&r2=369374&view=diff > ============================================================================== > --- lldb/trunk/unittests/TestingSupport/TestUtilities.h (original) > +++ lldb/trunk/unittests/TestingSupport/TestUtilities.h Tue Aug 20 05:28:36 > 2019 > @@ -12,6 +12,7 @@ > #include "llvm/ADT/SmallString.h" > #include "llvm/ADT/Twine.h" > #include "llvm/Support/Error.h" > +#include "llvm/Support/FileUtilities.h" > #include <string> > > #define ASSERT_NO_ERROR(x) > \ > @@ -27,8 +28,28 @@ > > namespace lldb_private { > std::string GetInputFilePath(const llvm::Twine &name); > -llvm::Error ReadYAMLObjectFile(const llvm::Twine &yaml_name, > - llvm::SmallString<128> &obj); > + > +class TestFile { > +public: > + static llvm::Expected<TestFile> fromYaml(llvm::StringRef Yaml); > + static llvm::Expected<TestFile> fromYamlFile(const llvm::Twine &Name); > + > + TestFile(TestFile &&RHS) : Name(std::move(RHS.Name)) { > + RHS.Name = llvm::None; > + } > + > + ~TestFile(); > + > + llvm::StringRef name() { return *Name; } > + > +private: > + TestFile(llvm::StringRef Name, llvm::FileRemover &&Remover) : Name(Name) { > + Remover.releaseFile(); > + } > + void operator=(const TestFile &) = delete; > + > + llvm::Optional<std::string> Name; > +}; > } > > #endif > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits