When the DWOPath is absolute, we want to use DWOPath as is, without prepending any other
components to the path. The sys::path::append does not join, but rather unconditionally appends
the paths, so something like sys::path::append("/tmp", "/tmp/banana") will result in
/tmp/tmp/banana rather than the desired /tmp/banana.
This then causes llvm-dwp to fail in a following situation:
$ clang -gsplit-dwarf /tmp/banana/test.c -c -o /tmp/outdir/foo.o $ clang outdir/foo.o -o outdir/hm $ llvm-dwarfdump outdir/hm | grep -C2 foo.dwo DW_AT_comp_dir ("/tmp") DW_AT_GNU_pubnames (true) DW_AT_GNU_dwo_name ("/tmp/outdir/foo.dwo") DW_AT_GNU_dwo_id (0xde4d396f3bf0e257) DW_AT_low_pc (0x0000000000401100) $ strace -o trace llvm-dwp -e outdir/hm -o outdir/hm.dwp error: No such file or directory $ cat trace | grep foo.dwo openat(AT_FDCWD, "/tmp/tmp/outdir/foo.dwo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
Generally prefer = init syntax over {} or () (this avoids any invocation of explicit conversions, for instance - making the code a bit simpler/easier to understand)