From 693146dcc0a1d653827cc88993acf52428af1a94 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 8 Sep 2025 10:34:33 -0700 Subject: [PATCH] [lldb][yaml2macho-core] Address bug when run on Windows The two API tests I converted to use yaml2macho-core were failing on windows. I was writing the output corefile with fopen(filename, "w"), and it turns out there was some newline conversion happening on Windows if a linefeed character was present. Charles Zablit helped to identify the issue and confirm the fix. Re-enabling the two tests on all platforms. https://github.com/llvm/llvm-project/pull/153911 --- .../macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py | 1 - lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py | 1 - lldb/tools/yaml2macho-core/yaml2macho.cpp | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py b/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py index acb6956ec478..a2890cdfeaa4 100644 --- a/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py +++ b/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py @@ -13,7 +13,6 @@ from lldbsuite.test import lldbutil class TestArmMachoCorefileRegctx(TestBase): NO_DEBUG_INFO_TESTCASE = True - @skipUnlessDarwin # CI fail on Windows, lr has value 0x0F000000? def test_armv7_corefile(self): ### Create corefile corefile = self.getBuildArtifact("core") diff --git a/lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py b/lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py index f791c01313fb..449da70fb08c 100644 --- a/lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py +++ b/lldb/test/API/macosx/riscv32-corefile/TestRV32MachOCorefile.py @@ -13,7 +13,6 @@ from lldbsuite.test import lldbutil class TestRV32MachOCorefile(TestBase): NO_DEBUG_INFO_TESTCASE = True - @skipUnlessDarwin # windows CI failure, says only 1 thread in corefile @no_debug_info_test def test_riscv32_gpr_corefile_registers(self): corefile = self.getBuildArtifact("core") diff --git a/lldb/tools/yaml2macho-core/yaml2macho.cpp b/lldb/tools/yaml2macho-core/yaml2macho.cpp index b01f61d49107..85979a37d167 100644 --- a/lldb/tools/yaml2macho-core/yaml2macho.cpp +++ b/lldb/tools/yaml2macho-core/yaml2macho.cpp @@ -198,7 +198,7 @@ int main(int argc, char **argv) { if (lc_note_payload_bytes.size() > 0) payload_fileoff = (payload_fileoff + 4096 - 1) & ~(4096 - 1); - FILE *f = fopen(OutputFilename.c_str(), "w"); + FILE *f = fopen(OutputFilename.c_str(), "wb"); if (f == nullptr) { fprintf(stderr, "Unable to open file %s for writing\n", OutputFilename.c_str());