This is an archive of the discontinued LLVM Phabricator instance.

Normalize working directory when running llvm-mc
ClosedPublic

Authored by serge-sans-paille on Apr 10 2020, 6:57 AM.

Details

Summary

Otherwise, depending on the lit location used to run the test, llvm-mc adds an include_directories entry in the dwarf output, which breaks tests in some setup.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2020, 6:57 AM
JDevlieghere accepted this revision.Apr 10 2020, 2:30 PM
This revision is now accepted and ready to land.Apr 10 2020, 2:30 PM
This revision was automatically updated to reflect the committed changes.

Otherwise, depending on the lit location used to run the test, llvm-mc adds an include_directories entry in the dwarf output, which breaks tests in some setup.

Do you know under what exact condition this happens? We need it for a better test comment...

Otherwise, depending on the lit location used to run the test, llvm-mc adds an include_directories entry in the dwarf output, which breaks tests in some setup.

Do you know under what exact condition this happens? We need it for a better test comment...

yes, I can provide the full setup, basically:

  1. run the testsuite to have all the.script file generated: lit -sv ${llvmproject_srcdir}/_build/test/MC/MachO --filter gen-dwarf.s
  2. go to test directory, for hacking: cd ${llvmproject_dir}/llvm/test/MC/MachO
  3. run the .script file by hand from that directory: sh ${llvmproject_srcdir}/_build/test/MC/MachO/Output/gen-dwarf.s.script

Otherwise, depending on the lit location used to run the test, llvm-mc adds an include_directories entry in the dwarf output, which breaks tests in some setup.

Do you know under what exact condition this happens? We need it for a better test comment...

yes, I can provide the full setup, basically:

  1. run the testsuite to have all the.script file generated: lit -sv ${llvmproject_srcdir}/_build/test/MC/MachO --filter gen-dwarf.s
  2. go to test directory, for hacking: cd ${llvmproject_dir}/llvm/test/MC/MachO
  3. run the .script file by hand from that directory: sh ${llvmproject_srcdir}/_build/test/MC/MachO/Output/gen-dwarf.s.script

Thanks for sharing the setup! If the directory name of gen-dwarf.s is the same as the current working directory (DW_AT_comp_dir), dir_index is 0, otherwise dir_index is 1. MCDwarf.cpp's behavior is consistent with GNU as -g here.