[llvm] [llvm-objdump] Add --substitute-path and --source-dir for --source (PR #201096)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 02:09:43 PDT 2026
================
@@ -49,19 +49,46 @@
; RUN: --substitute-path /wron /nowhere \
; RUN: --substitute-path /wrong %/p %t.o | \
; RUN: FileCheck %s --check-prefix=SOURCE
+
+; Empty <to> strips the matched prefix (GDB allows this); use --source-dir to
+; resolve the resulting relative path.
+; RUN: echo '--substitute-path' > %t-empty-to.rsp
+; RUN: echo '/wrong' >> %t-empty-to.rsp
+; RUN: echo '""' >> %t-empty-to.rsp
+; RUN: llvm-objdump --no-print-imm-hex -d --source @%t-empty-to.rsp \
+; RUN: --source-dir %/p/Inputs %t.o | FileCheck %s --check-prefix=SOURCE
+
+; Empty <to> without --source-dir: relative path is not resolved; warn once, no crash.
+; RUN: llvm-objdump --no-print-imm-hex -d --source @%t-empty-to.rsp %t.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=SOURCE-EMPTY-TO -DFILE=%t.o
+
+; Empty <from> is rejected (use a response file so the shell does not drop "").
----------------
jh7370 wrote:
Hmm, this comment doesn't sound right. `llvm-objdump --substitute-path "" "%/p" "t.o"` shouldn't lose the empty string quotes under any reasonable shell, including the lit internal shell. If you are definitely seeing this, it's possibly a bug in lit, but I'd be surprised by it, as I'm sure we have other cases where we specify an empty string as part of the command arguments. Are you sure it's not your LLM hallucinating?
https://github.com/llvm/llvm-project/pull/201096
More information about the llvm-commits
mailing list