llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.48k stars 11.77k forks source link

16.0.0-rc1: 2 failing llvm tests on osx-64 #60363

Closed h-vetinari closed 1 year ago

h-vetinari commented 1 year ago

From starting to build LLVM (the lib) 16 in conda-forge, things look pretty good, the only thing is that there are two failing tests on osx-64:

Failed Tests (2):
  LLVM-Unit :: DebugInfo/LogicalView/./DebugInfoLogicalViewTests/LogicalViewTest/ELFReader
  LLVM-Unit :: DebugInfo/LogicalView/./DebugInfoLogicalViewTests/LogicalViewTest/SelectElements

Testing Time: 2381.97s
  Skipped          :     7
  Unsupported      :  1789
  Passed           : 50371
  Expectedly Failed:   154
  Failed           :     2
Error log ```console $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:68: Failure Expected equality of these values: Root->getFileFormatName() Which is: "" "elf64-x86-64" Which is: 0x10d3fbe39 $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:69: Failure Expected equality of these values: Root->getName() Which is: "" DwarfClang Which is: 0x10d3fbdfd $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:72: Failure Value of: CompileUnit->getProducer().startswith("clang") Actual: false Expected: true $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:73: Failure Expected equality of these values: CompileUnit->getName() Which is: "" "test.cpp" Which is: 0x10d3fbb75 $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:68 Expected equality of these values: Root->getFileFormatName() Which is: "" "elf64-x86-64" Which is: 0x10d3fbe39 $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:69 Expected equality of these values: Root->getName() Which is: "" DwarfClang Which is: 0x10d3fbdfd $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:72 Value of: CompileUnit->getProducer().startswith("clang") Actual: false Expected: true $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:73 Expected equality of these values: CompileUnit->getName() Which is: "" "test.cpp" Which is: 0x10d3fbb75 ```
llvmbot commented 1 year ago

@llvm/issue-subscribers-debuginfo

CarlosAlbertoEnciso commented 1 year ago

To help debugging those issues, can I get the CMake command line used to build? Thanks

h-vetinari commented 1 year ago

To help debugging those issues, can I get the CMake command line used to build? Thanks

Sure, no problem!

cmake -DCMAKE_INSTALL_PREFIX=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh -DLLVM_ENABLE_BACKTRACES=OFF -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_ENABLE_LIBXML2=FORCE_ON -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZLIB=FORCE_ON -DLLVM_ENABLE_ZSTD=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_GO_TESTS=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_INCLUDE_UTILS=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_UTILS_INSTALL_DIR=libexec/llvm -DLLVM_BUILD_LLVM_DYLIB=yes -DLLVM_LINK_LLVM_DYLIB=yes -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_AR=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_CXX_COMPILER_AR=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_C_COMPILER_AR=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_RANLIB=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_CXX_COMPILER_RANLIB=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_C_COMPILER_RANLIB=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_LINKER=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-ld -DCMAKE_STRIP=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-strip -DCMAKE_INSTALL_NAME_TOOL=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-install_name_tool -DCMAKE_LIBTOOL=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-libtool -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=LAST -DCMAKE_INSTALL_PREFIX=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh -DCMAKE_INSTALL_LIBDIR=lib '-DCMAKE_PROGRAM_PATH=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin;/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/bin' '-DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-clang;-DCMAKE_CXX_COMPILER=/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/bin/x86_64-apple-darwin13.4.0-clang++;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,/Users/runner/miniforge3/conda-bld/llvm-package_1674896016003/_build_env/lib;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=;-DCMAKE_STATIC_LINKER_FLAGS=;-DLLVM_INCLUDE_BENCHMARKS=OFF;' -DLLVM_HOST_TRIPLE=x86_64-apple-darwin13.4.0 -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin13.4.0 -GNinja ../llvm

Sorry for the long paths, this is how we ensure a high degree of isolation (it's relatively easy to search for such paths and check if they've been inadvertently baked into some binaries)

Full logs are here

CarlosAlbertoEnciso commented 1 year ago

Full logs are here

Thanks for the information. It would be great if you can run the following 2 commands on that specific build and attach their output

llvm-debuginfo-analyzer --attribute=offset,format,filename,producer,publics,range,location --print=all llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang.o

llvm-dwarfdump --all llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang.o

Many thanks

h-vetinari commented 1 year ago

It would be great if you can run the following 2 commands on that specific build and attach their output

Currently running in https://github.com/conda-forge/llvmdev-feedstock/pull/196 (will take about ~5h). Hope I got the commands correctly 🤞

CarlosAlbertoEnciso commented 1 year ago

It would be great if you can run the following 2 commands on that specific build and attach their output

Currently running in conda-forge/llvmdev-feedstock#196 (will take about ~5h).

Not a problem.

Hope I got the commands correctly 🤞

Basically run the llvm-debuginfo-analyzer and llvm-dwarfdump executables using the binary file test-dwarf-clang.o that is the LLVM source distribution llvm/unittests/DebugInfo/LogicalView/Inputs/

Thanks

h-vetinari commented 1 year ago

Basically run the llvm-debuginfo-analyzer and llvm-dwarfdump executables using the binary file test-dwarf-clang.o that is the LLVM source distribution llvm/unittests/DebugInfo/LogicalView/Inputs/

Ah, I didn't expect an .o file to be distributed, so I tried to ensure the test suite gets compiled first by running ninja check-llvm, but not failing on it (i.e. || true). In any case, if I got it wrong, I'll fix it, it's just a pretty long iteration cycle in CI... 😅

CarlosAlbertoEnciso commented 1 year ago

Basically run the llvm-debuginfo-analyzer and llvm-dwarfdump executables using the binary file test-dwarf-clang.o that is the LLVM source distribution llvm/unittests/DebugInfo/LogicalView/Inputs/

Ah, I didn't expect an .o file to be distributed, so I tried to ensure the test suite gets compiled first by running ninja check-llvm, but not failing on it (i.e. || true). In any case, if I got it wrong, I'll fix it, it's just a pretty long iteration cycle in CI... 😅

Good finding.

CarlosAlbertoEnciso commented 1 year ago

Basically run the llvm-debuginfo-analyzer and llvm-dwarfdump executables using the binary file test-dwarf-clang.o that is the LLVM source distribution llvm/unittests/DebugInfo/LogicalView/Inputs/

Ah, I didn't expect an .o file to be distributed, so I tried to ensure the test suite gets compiled first by running ninja check-llvm, but not failing on it (i.e. || true). In any case, if I got it wrong, I'll fix it, it's just a pretty long iteration cycle in CI... 😅

After looking at the changes you commited to add the commands I mentioned, I think there is a misunderstanding. https://github.com/conda-forge/llvmdev-feedstock/pull/196/commits/f6ca9669b54dbbfbde45e7b8682764062ce0a1ed

Those commands are intended to get extra information to help debugging the failures, as their output may be indicate the reason. The object file test-dwarf-clang.o is not included in any distribution; it is just used for the unittest.

The llvm-debuginfo-analyzer includes some other unittests that already pass: CompareElementsTest LocationRangesTest LogicalElementsTest WarningInternalTest

Sorry for the confusion.

h-vetinari commented 1 year ago

It would be great if you can run the following 2 commands on that specific build and attach their output

Here's the log, and here's their output:

+ /Users/runner/miniforge3/conda-bld/llvm-package_1675299892624/work/build/bin/llvm-debuginfo-analyzer --attribute=offset,format,filename,producer,publics,range,location --print=all ../llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang.o

Logical View:
[0x0000000000]           {File} 'test-dwarf-clang.o' -> elf64-x86-64

[0x000000000b]             {CompileUnit} 'test.cpp'
[0x000000000b]               {Producer} 'clang version 15.0.0 (https://github.sie.sony.com/SIE/llvm-diva.git d00ebb35df4a4f1817eb139dfd0716ba837dda7c)'
                             {Public} 'foo' [0x0000000000:0x000000003a]
[0x000000000b]               {Range} Lines 2:9 [0x0000000000:0x000000003a]

[0x00000000a0]  {Source} 'test.cpp'
[0x00000000a0]     1         {TypeAlias} 'INTPTR' -> [0x00000000ab]'* const int'
[0x000000002a]     2         {Function} extern not_inlined 'foo' -> [0x0000000099]'int'
[0x000000002a]                 {Range} Lines 2:9 [0x0000000000:0x000000003a]
[0x0000000071]                 {Block}
[0x0000000071]                   {Range} Lines 5:8 [0x000000001c:0x000000002f]
[0x000000007e]     5             {Variable} 'CONSTANT' -> [0x00000000c3]'const INTEGER'
[0x000000007f]                     {Location}
[0x000000007f]                       {Entry} fbreg -28
[0x000000001c]     5             {Line}
[0x000000001c]                   {Code} 'movl$0x7, -0x1c(%rbp)'
[0x0000000023]     6             {Line}
[0x0000000023]                   {Code} 'movl$0x7, -0x4(%rbp)'
[0x000000002a]                   {Code} 'jmp0x6'
[0x000000002f]     8             {Line}
[0x000000002f]                   {Code} 'movl-0x14(%rbp), %eax'
[0x0000000063]     2           {Parameter} 'ParamBool' -> [0x00000000bc]'bool'
[0x0000000064]                   {Location}
[0x0000000064]                     {Entry} fbreg -21
[0x0000000047]     2           {Parameter} 'ParamPtr' -> [0x00000000a0]'INTPTR'
[0x0000000048]                   {Location}
[0x0000000048]                     {Entry} fbreg -16
[0x0000000055]     2           {Parameter} 'ParamUnsigned' -> [0x00000000b5]'unsigned int'
[0x0000000056]                   {Location}
[0x0000000056]                     {Entry} fbreg -20
[0x000000008d]     4           {TypeAlias} 'INTEGER' -> [0x0000000099]'int'
[0x0000000000]     2           {Line}
[0x0000000000]                 {Code} 'pushq%rbp'
[0x0000000001]                 {Code} 'movq%rsp, %rbp'
[0x0000000004]                 {Code} 'movb%dl, %al'
[0x0000000006]                 {Code} 'movq%rdi, -0x10(%rbp)'
[0x000000000a]                 {Code} 'movl%esi, -0x14(%rbp)'
[0x000000000d]                 {Code} 'andb$0x1, %al'
[0x000000000f]                 {Code} 'movb%al, -0x15(%rbp)'
[0x0000000012]     3           {Line}
[0x0000000012]                 {Code} 'testb$0x1, -0x15(%rbp)'
[0x0000000016]                 {Code} 'je0x13'
[0x0000000032]     8           {Line}
[0x0000000032]                 {Code} 'movl%eax, -0x4(%rbp)'
[0x0000000035]     9           {Line}
[0x0000000035]                 {Code} 'movl-0x4(%rbp), %eax'
[0x0000000038]                 {Code} 'popq%rbp'
[0x0000000039]                 {Code} 'retq'
[0x000000003a]     9           {Line}

-----------------------------
Element      Total    Printed
-----------------------------
Scopes           3          3
Symbols          4          4
Types            2          2
Lines           25         25
-----------------------------
Total           34         34

Scope Sizes:
       189 (100.00%) : [0x000000000b]             {CompileUnit} 'test.cpp'
       110 ( 58.20%) : [0x000000002a]     2         {Function} extern not_inlined 'foo' -> [0x0000000099]'int'
        27 ( 14.29%) : [0x0000000071]                 {Block}

Totals by lexical level:
[001]:        189 (100.00%)
[002]:        110 ( 58.20%)
[003]:         27 ( 14.29%)
+ /Users/runner/miniforge3/conda-bld/llvm-package_1675299892624/work/build/bin/llvm-dwarfdump --all ../llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang.o
../llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang.o:file format elf64-x86-64

.debug_abbrev contents:
Abbrev table for offset: 0x00000000
[1] DW_TAG_compile_unitDW_CHILDREN_yes
DW_AT_producerDW_FORM_strp
DW_AT_languageDW_FORM_data2
DW_AT_nameDW_FORM_strp
DW_AT_stmt_listDW_FORM_sec_offset
DW_AT_comp_dirDW_FORM_strp
DW_AT_low_pcDW_FORM_addr
DW_AT_high_pcDW_FORM_data4

[2] DW_TAG_subprogramDW_CHILDREN_yes
DW_AT_low_pcDW_FORM_addr
DW_AT_high_pcDW_FORM_data4
DW_AT_frame_baseDW_FORM_exprloc
DW_AT_linkage_nameDW_FORM_strp
DW_AT_nameDW_FORM_strp
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT_typeDW_FORM_ref4
DW_AT_externalDW_FORM_flag_present

[3] DW_TAG_formal_parameterDW_CHILDREN_no
DW_AT_locationDW_FORM_exprloc
DW_AT_nameDW_FORM_strp
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT_typeDW_FORM_ref4

[4] DW_TAG_lexical_blockDW_CHILDREN_yes
DW_AT_low_pcDW_FORM_addr
DW_AT_high_pcDW_FORM_data4

[5] DW_TAG_variableDW_CHILDREN_no
DW_AT_locationDW_FORM_exprloc
DW_AT_nameDW_FORM_strp
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT_typeDW_FORM_ref4

[6] DW_TAG_typedefDW_CHILDREN_no
DW_AT_typeDW_FORM_ref4
DW_AT_nameDW_FORM_strp
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1

[7] DW_TAG_base_typeDW_CHILDREN_no
DW_AT_nameDW_FORM_strp
DW_AT_encodingDW_FORM_data1
DW_AT_byte_sizeDW_FORM_data1

[8] DW_TAG_pointer_typeDW_CHILDREN_no
DW_AT_typeDW_FORM_ref4

[9] DW_TAG_const_typeDW_CHILDREN_no
DW_AT_typeDW_FORM_ref4

.debug_info contents:
0x00000000: Compile Unit: length = 0x000000c5, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000c9)

0x0000000b: DW_TAG_compile_unit
              DW_AT_producer("clang version 15.0.0 (https://github.sie.sony.com/SIE/llvm-diva.git d00ebb35df4a4f1817eb139dfd0716ba837dda7c)")
              DW_AT_language(DW_LANG_C_plus_plus_14)
              DW_AT_name("test.cpp")
              DW_AT_stmt_list(0x00000000)
              DW_AT_comp_dir("/data/projects/tests/input/general")
              DW_AT_low_pc(0x0000000000000000)
              DW_AT_high_pc(0x000000000000003a)

0x0000002a:   DW_TAG_subprogram
                DW_AT_low_pc(0x0000000000000000)
                DW_AT_high_pc(0x000000000000003a)
                DW_AT_frame_base(DW_OP_reg6 RBP)
                DW_AT_linkage_name("_Z3fooPKijb")
                DW_AT_name("foo")
                DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                DW_AT_decl_line(2)
                DW_AT_type(0x00000099 "int")
                DW_AT_external(true)

0x00000047:     DW_TAG_formal_parameter
                  DW_AT_location(DW_OP_fbreg -16)
                  DW_AT_name("ParamPtr")
                  DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                  DW_AT_decl_line(2)
                  DW_AT_type(0x000000a0 "INTPTR")

0x00000055:     DW_TAG_formal_parameter
                  DW_AT_location(DW_OP_fbreg -20)
                  DW_AT_name("ParamUnsigned")
                  DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                  DW_AT_decl_line(2)
                  DW_AT_type(0x000000b5 "unsigned int")

0x00000063:     DW_TAG_formal_parameter
                  DW_AT_location(DW_OP_fbreg -21)
                  DW_AT_name("ParamBool")
                  DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                  DW_AT_decl_line(2)
                  DW_AT_type(0x000000bc "bool")

0x00000071:     DW_TAG_lexical_block
                  DW_AT_low_pc(0x000000000000001c)
                  DW_AT_high_pc(0x000000000000002f)

0x0000007e:       DW_TAG_variable
                    DW_AT_location(DW_OP_fbreg -28)
                    DW_AT_name("CONSTANT")
                    DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                    DW_AT_decl_line(5)
                    DW_AT_type(0x000000c3 "const INTEGER")

0x0000008c:       NULL

0x0000008d:     DW_TAG_typedef
                  DW_AT_type(0x00000099 "int")
                  DW_AT_name("INTEGER")
                  DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                  DW_AT_decl_line(4)

0x00000098:     NULL

0x00000099:   DW_TAG_base_type
                DW_AT_name("int")
                DW_AT_encoding(DW_ATE_signed)
                DW_AT_byte_size(0x04)

0x000000a0:   DW_TAG_typedef
                DW_AT_type(0x000000ab "const int *")
                DW_AT_name("INTPTR")
                DW_AT_decl_file("/data/projects/tests/input/general/test.cpp")
                DW_AT_decl_line(1)

0x000000ab:   DW_TAG_pointer_type
                DW_AT_type(0x000000b0 "const int")

0x000000b0:   DW_TAG_const_type
                DW_AT_type(0x00000099 "int")

0x000000b5:   DW_TAG_base_type
                DW_AT_name("unsigned int")
                DW_AT_encoding(DW_ATE_unsigned)
                DW_AT_byte_size(0x04)

0x000000bc:   DW_TAG_base_type
                DW_AT_name("bool")
                DW_AT_encoding(DW_ATE_boolean)
                DW_AT_byte_size(0x01)

0x000000c3:   DW_TAG_const_type
                DW_AT_type(0x0000008d "INTEGER")

0x000000c8:   NULL

.eh_frame contents:

00000000 00000014 00000000 CIE
  Format:                DWARF32
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1B

  DW_CFA_def_cfa: RSP +8
  DW_CFA_offset: RIP -8
  DW_CFA_nop:
  DW_CFA_nop:

  CFA=RSP+8: RIP=[CFA-8]

00000018 0000001c 0000001c FDE cie=00000000 pc=00000000...0000003a
  Format:       DWARF32
  DW_CFA_advance_loc: 1
  DW_CFA_def_cfa_offset: +16
  DW_CFA_offset: RBP -16
  DW_CFA_advance_loc: 3
  DW_CFA_def_cfa_register: RBP
  DW_CFA_advance_loc: 53
  DW_CFA_def_cfa: RSP +8
  DW_CFA_nop:
  DW_CFA_nop:
  DW_CFA_nop:

  0x0: CFA=RSP+8: RIP=[CFA-8]
  0x1: CFA=RSP+16: RBP=[CFA-16], RIP=[CFA-8]
  0x4: CFA=RBP+16: RBP=[CFA-16], RIP=[CFA-8]
  0x39: CFA=RSP+8: RBP=[CFA-16], RIP=[CFA-8]

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000004d
          format: DWARF32
         version: 4
 prologue_length: 0x00000020
 min_inst_length: 1
max_ops_per_inst: 1
 default_is_stmt: 1
       line_base: -5
      line_range: 14
     opcode_base: 13
standard_opcode_lengths[DW_LNS_copy] = 0
standard_opcode_lengths[DW_LNS_advance_pc] = 1
standard_opcode_lengths[DW_LNS_advance_line] = 1
standard_opcode_lengths[DW_LNS_set_file] = 1
standard_opcode_lengths[DW_LNS_set_column] = 1
standard_opcode_lengths[DW_LNS_negate_stmt] = 0
standard_opcode_lengths[DW_LNS_set_basic_block] = 0
standard_opcode_lengths[DW_LNS_const_add_pc] = 0
standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
standard_opcode_lengths[DW_LNS_set_isa] = 1
file_names[  1]:
           name: "test.cpp"
      dir_index: 0
       mod_time: 0x00000000
         length: 0x00000000

Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000      2      0      1   0             0  is_stmt
0x0000000000000012      3      7      1   0             0  is_stmt prologue_end
0x000000000000001c      5     19      1   0             0  is_stmt
0x0000000000000023      6      5      1   0             0  is_stmt
0x000000000000002f      8     10      1   0             0  is_stmt
0x0000000000000032      8      3      1   0             0
0x0000000000000035      9      1      1   0             0  is_stmt
0x000000000000003a      9      1      1   0             0  is_stmt end_sequence

.debug_str contents:
0x00000000: "clang version 15.0.0 (https://github.sie.sony.com/SIE/llvm-diva.git d00ebb35df4a4f1817eb139dfd0716ba837dda7c)"
0x0000006e: "test.cpp"
0x00000077: "/data/projects/tests/input/general"
0x0000009a: "_Z3fooPKijb"
0x000000a6: "foo"
0x000000aa: "int"
0x000000ae: "ParamPtr"
0x000000b7: "INTPTR"
0x000000be: "ParamUnsigned"
0x000000cc: "unsigned int"
0x000000d9: "ParamBool"
0x000000e3: "bool"
0x000000e8: "CONSTANT"
0x000000f1: "INTEGER"
h-vetinari commented 1 year ago

After looking at the changes you commited to add the commands I mentioned, I think there is a misunderstanding.

Let me know if indeed I did misunderstand something, and the results are not what you were after.

h-vetinari commented 1 year ago

It's very curious to me that something seems to be picking up a clang we're neither in the process of building, nor one that should make it through our build isolation:

clang version 15.0.0 (https://github.sie.sony.com/SIE/llvm-diva.git d00ebb35df4a4f1817eb139dfd0716ba837dda7c)
CarlosAlbertoEnciso commented 1 year ago

It's very curious to me that something seems to be picking up a clang we're neither in the process of building, nor one that should make it through our build isolation:

clang version 15.0.0 (https://github.sie.sony.com/SIE/llvm-diva.git d00ebb35df4a4f1817eb139dfd0716ba837dda7c)

That text is embedded in the object file that is being tested, It is just a static information about the compiler used to generate that object. The unittest is checking that that specific string starts with 'clang'. It does not have any relation with the clang being build or the clang being used.

CarlosAlbertoEnciso commented 1 year ago

After looking at the changes you commited to add the commands I mentioned, I think there is a misunderstanding.

Let me know if indeed I did misunderstand something, and the results are not what you were after.

Thanks for the logs and the generated output. The output is the expected one.

h-vetinari commented 1 year ago

Thanks for the logs and the generated output.

Cool, happy to hear

The output is the expected one.

Does this illuminate or obscure the reason for the test failures mentioned initially?

CarlosAlbertoEnciso commented 1 year ago

Thanks for the logs and the generated output.

Cool, happy to hear

The output is the expected one.

Does this illuminate or obscure the reason for the test failures mentioned initially?

Looking at the unitest error logs $SRC_DIR/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp:72: Failure Value of: CompileUnit->getProducer().startswith("clang") Actual: false Expected: true

Looking at the llvm-debuginfo-analyzer output: [0x000000000b] {CompileUnit} 'test.cpp' [0x000000000b] {Producer} 'clang version 15.0.0 (.......)'

The text displayed for {Producer} is correct and the check should pass: 72 EXPECT_TRUE(CompileUnit->getProducer().startswith("clang"));

The text displayed for {CompileUnit} is correct and the check should pass: 73 EXPECT_EQ(CompileUnit->getName(), "test.cpp");

h-vetinari commented 1 year ago

The text displayed for {Producer} is correct and the check should pass: 72 EXPECT_TRUE(CompileUnit->getProducer().startswith("Fclang"));

The text displayed for {CompileUnit} is correct and the check should pass: 73 EXPECT_EQ(CompileUnit->getName(), "test.cpp");

Thanks for the analysis. I don't know what to conclude from this though - the test fails (reproducibly) in our CI, so I can only fix it or skip it. I don't mind skipping, personally, but I wanted to investigate first, and I certainly didn't want to unilaterally decide to skip a failing test without checking in with people here.

CarlosAlbertoEnciso commented 1 year ago

The text displayed for {Producer} is correct and the check should pass: 72 EXPECT_TRUE(CompileUnit->getProducer().startswith("Fclang")); The text displayed for {CompileUnit} is correct and the check should pass: 73 EXPECT_EQ(CompileUnit->getName(), "test.cpp");

Thanks for the analysis. I don't know what to conclude from this though - the test fails (reproducibly) in our CI, so I can only fix it or skip it. I don't mind skipping, personally, but I wanted to investigate first, and I certainly didn't want to unilaterally decide to skip a failing test without checking in with people here.

Normally I develop on Windows/Linux. I am trying to build Clang/LLVM on an old MacOS (Catalina 10.15.7), but it fails due to an old installed Clang version (11.0.33.17).

If those 2 cases are a blocker, for the time being you can disabled/skip them. Once I managed to build on MacOS I can debug them and find out the issue and enabled them.

h-vetinari commented 1 year ago

If those 2 cases are a blocker, for the time being you can disabled/skip them. Once I managed to build on MacOS I can debug them and find out the issue and enabled them.

Thanks for the info & your help! This may be a silly question, but is there an easy way to skip certain tests, short of hard-deleting them?

CarlosAlbertoEnciso commented 1 year ago

If those 2 cases are a blocker, for the time being you can disabled/skip them. Once I managed to build on MacOS I can debug them and find out the issue and enabled them.

Thanks for the info & your help! This may be a silly question, but is there an easy way to skip certain tests, short of hard-deleting them?

For these specific cases:

Modify the llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp replacing line 325 from TEST(LogicalViewTest, ELFReader) { to: TEST(LogicalViewTest, DISABLED_ELFReader) {

and

Modify the llvm/unittests/DebugInfo/LogicalView/SelectElementsTest.cpp replacing line 377 from TEST(LogicalViewTest, SelectElements) { to: TEST(LogicalViewTest, DISABLED_SelectElements) {

The DISABLE_ prefix disables the test https://github.com/google/googletest/blob/main/docs/advanced.md#temporarily-disabling-tests

Happy to help.

h-vetinari commented 1 year ago

Happy to help.

Thank you so much for the detailed instructions!

Next time I'll know now. :)

CarlosAlbertoEnciso commented 1 year ago

I managed to build and reproduce the same errors on my local Mac, using the following CMake options:

cmake -G"Ninja" -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_CXX_COMPILER="/opt/local/libexec/llvm-15/bin/clang++" -DCMAKE_C_COMPILER="/opt/local/libexec/llvm-15/bin/clang" -DCMAKE_LINKER="/opt/local/libexec/llvm-15/bin/ld" -DCMAKE_C_FLAGS=-O2 -DCMAKE_CXX_FLAGS=-O2 -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_BACKTRACES=OFF -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZLIB=FORCE_ON -DLLVM_ENABLE_ZSTD=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_GO_TESTS=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_INCLUDE_UTILS=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_BUILD_LLVM_DYLIB=yes -DLLVM_LINK_LLVM_DYLIB=yes -DLLVM_HOST_TRIPLE=x86_64-apple-darwin13.4.0 -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin13.4.0 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=LAST llvm

Now I will be able to debug the failures and submit a patch.

CarlosAlbertoEnciso commented 1 year ago

After some extra work on reducing the CMake options I found the minimum set to reproduce the issue:

cmake -G"Ninja" -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_CXX_COMPILER="/opt/local/libexec/llvm-15/bin/clang++" -DCMAKE_C_COMPILER="/opt/local/libexec/llvm-15/bin/clang" -DCMAKE_LINKER="/opt/local/libexec/llvm-15/bin/ld" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_INCLUDE_UTILS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_LLVM_DYLIB=yes -DLLVM_LINK_LLVM_DYLIB=yes -DLLVM_HOST_TRIPLE=x86_64-apple-darwin13.4.0 -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin13.4.0 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 llvm

But all of the tests pass if: -DLLVM_BUILD_LLVM_DYLIB=no -DLLVM_LINK_LLVM_DYLIB=no

CarlosAlbertoEnciso commented 1 year ago

Uploaded a patch for review: https://reviews.llvm.org/D143716

CarlosAlbertoEnciso commented 1 year ago

@h-vetinari: Committed the path to the main branch. Thanks for all your help.

h-vetinari commented 1 year ago

Thanks for all your help.

Likewise! :)

Let's try to backport this to release/16.x:

/cherry-pick 92716a42a6aa584fb009031a9f703b5dac310043

llvmbot commented 1 year ago

/branch llvm/llvm-project-release-prs/issue60363

llvmbot commented 1 year ago

/pull-request llvm/llvm-project-release-prs#296