https://github.com/robk-dev created 
https://github.com/llvm/llvm-project/pull/216710

`_CrtSetReportMode` and `_CrtSetReportFile` are debug reporting functions of
the Microsoft C runtime. They are not available when LLDB is built on Windows
with MinGW, so the `LLDB_DISABLE_CRASH_DIALOG` path failed to compile there.

Guard them with `_MSC_VER`. `SetErrorMode` above them is a Win32 API and stays
unconditional.


>From 9b2b5d53f50fae9d09e41e30695cbb4a31bf1cc5 Mon Sep 17 00:00:00 2001
From: Rob <[email protected]>
Date: Tue, 11 Aug 2026 20:10:00 +0100
Subject: [PATCH] [lldb] Guard CRT debug report calls with _MSC_VER

_CrtSetReportMode/_CrtSetReportFile are Microsoft C runtime debug APIs
that do not exist when building LLDB on Windows with MinGW; guard them so
the LLDB_DISABLE_CRASH_DIALOG path compiles there.

Co-Authored-By: Claude Fable 5 <[email protected]>
---
 lldb/source/Initialization/SystemInitializerCommon.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp 
b/lldb/source/Initialization/SystemInitializerCommon.cpp
index b5d1c25e15008..ba1299f7956d2 100644
--- a/lldb/source/Initialization/SystemInitializerCommon.cpp
+++ b/lldb/source/Initialization/SystemInitializerCommon.cpp
@@ -53,12 +53,16 @@ llvm::Error SystemInitializerCommon::Initialize() {
     ::SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS |
                    SEM_NOGPFAULTERRORBOX);
 
+#ifdef _MSC_VER
+    // The CRT debug reporting functions are only available with the
+    // Microsoft C runtime, not when building with MinGW.
     _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
     _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
     _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
     _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+#endif // _MSC_VER
   }
 #endif
 

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to