[Lldb-commits] [lldb] c2112e9 - [lldb][Windows] Fix ECHO_TO_FILE/ECHO_APPEND_FILE (#202612)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 10 03:21:03 PDT 2026


Author: Charles Zablit
Date: 2026-06-10T11:20:57+01:00
New Revision: c2112e925e99d93dff671e2254e3e999dccf25dd

URL: https://github.com/llvm/llvm-project/commit/c2112e925e99d93dff671e2254e3e999dccf25dd
DIFF: https://github.com/llvm/llvm-project/commit/c2112e925e99d93dff671e2254e3e999dccf25dd.diff

LOG: [lldb][Windows] Fix ECHO_TO_FILE/ECHO_APPEND_FILE (#202612)

The Windows recipes for these macros were `printf "%s\n" $(1)`. The
callers wrap content in single quotes (for the POSIX printf), but the
test recipes run under `cmd.exe` on Windows, which keeps the single
quotes literal and word-splits on spaces, and the bundled `printf`
additionally mangles backslashes and spaces. The result is garbage
generated files (e.g. a modulemap whose first line is `'module`, or a
truncated SDK path from a "Program Files" directory).

Write the file with cmd's `echo` after stripping the callers' single
quotes. `echo` runs in the recipe shell, so unlike GNU make's `$(file
...)` it still works after a preceding `MKDIR_P` in the same recipe.

rdar://179218545

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 44aa91ef7b6fc..68067451d1d30 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -64,8 +64,8 @@ else
 	# valid when transferred to a remote device.
 	LN_SF = ln -sf $(patsubst $(dir $(2))%,%,$(1)) $(2)
 	ECHO = echo $(1);
-	ECHO_TO_FILE = printf '%s\n' $(1) > "$(2)"
-	ECHO_APPEND_FILE = printf '%s\n' $(1) >> "$(2)"
+	ECHO_TO_FILE = echo $(subst ',,$(1))> "$(subst /,\,$(2))"
+	ECHO_APPEND_FILE = echo $(subst ',,$(1))>> "$(subst /,\,$(2))"
 endif
 
 # Suppress built-in suffix rules. We explicitly define rules for %.o.


        


More information about the lldb-commits mailing list