[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:05:03 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: robk-dev
<details>
<summary>Changes</summary>
`_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.
---
Full diff: https://github.com/llvm/llvm-project/pull/216710.diff
1 Files Affected:
- (modified) lldb/source/Initialization/SystemInitializerCommon.cpp (+4)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/216710
More information about the lldb-commits
mailing list