[Lldb-commits] [lldb] [lldb] Guard CRT debug report calls with _MSC_VER (PR #216710)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 17 05:29:45 PDT 2026
https://github.com/robk-dev updated https://github.com/llvm/llvm-project/pull/216710
>From b659b6237e50ee9b3eefdcf9534db8109ea88cf0 Mon Sep 17 00:00:00 2001
From: Rob <robk at robk.dev>
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.
Assisted-by: Claude Fable 5
---
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
More information about the lldb-commits
mailing list