[Lldb-commits] [lldb] [lldb][windows] print stop reason if MSVC's runtime check fails (PR #185473)

via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 9 11:59:54 PDT 2026


================
@@ -79,6 +81,49 @@ std::string GetProcessExecutableName(DWORD pid) {
   }
   return file_name;
 }
+
+std::optional<std::string> GetMSVCRTCFailureDescription(Thread &thread) {
+  const uint32_t kMaxFrames = 8;
+
+  for (uint32_t i = 0; i < kMaxFrames; ++i) {
+    StackFrameSP frame = thread.GetStackFrameAtIndex(i);
+    if (!frame)
+      break;
+
+    SymbolContext sc = frame->GetSymbolContext(eSymbolContextSymbol);
+    if (!sc.symbol)
+      continue;
+
+    const char *fn_name = frame->GetFunctionName();
+    if (!fn_name)
+      continue;
+    llvm::StringRef name(fn_name);
+
+    if (!name.contains("failwithmessage"))
----------------
Nerixyz wrote:

I think the check could be a bit stricter. `failwithmessage` has to be exactly the function in the first stack frame and the exception code has to be `0x80000003`.

We can't narrow down on `failwithmessage` more, because it's a local function (like `static void failwithmessage`) that is statically linked into the binary. 

https://github.com/llvm/llvm-project/pull/185473


More information about the lldb-commits mailing list