[PATCH] D147256: [DebugInfo] Fix file path separator when targeting windows.

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 31 10:43:49 PDT 2023


hans added a comment.

In D147256#4237099 <https://reviews.llvm.org/D147256#4237099>, @probinson wrote:

> I think we cannot be 100% sure about source paths in a cross-compile situation. Cross-compiling on platform A targeting platform B does not mean your sources and debugger UI are on platform B. My users keep source and debugger UI on platform A, debugging target B remotely. We need to preserve the host pathnames. It is not clear to me that this patch does so.

I believe the idea is to preserve host pathnames as long as `LangOptions.UseTargetPathSeparator` is unset. But I see that might not be the case for `CodeViewDebug::emitObjName()` in the current version of the patch. Could we make clang handle that path instead depending on the flag?



================
Comment at: llvm/test/DebugInfo/COFF/build-info.ll:18
+; RUN: cd %t-dir
+; RUN: llc -filetype=obj -mtriple i686-pc-windows-msvc %s -o ../build-info.o
+; RUN: llvm-readobj --codeview ../build-info.o | FileCheck %s --check-prefix=OBJ
----------------
zequanwu wrote:
> hans wrote:
> > Does this write the .o file into the test directory? I don't think that's allowed (it may be read-only). But the test could create another subdirectory under `%t-dir`.
> It writes the .o file into the parent directory of the temporary dir %t-dir. It will just be the directory path of a normal `%t`, not the source test directory. The reason I'm not using `%t-dir/build-info.o` in the parent dir is because it will be translated into an absolute address. That will remain unchanged in ObjectName.
Right, I'm just thinking that we can't be sure that we can (or should) write files into the parent of `%t-dir`.

Would it work if you instead create `%t-dir/subdir`, `cd` into that, and then do `-o ../build-info.o`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147256/new/

https://reviews.llvm.org/D147256



More information about the cfe-commits mailing list