[Lldb-commits] [lldb] [lldb][windows] Null-check m_session_data in ProcessDebugger::HaltProcess (PR #199016)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Thu May 21 05:29:19 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/199016

Every other public method in this file checks `m_session_data` before dereferencing.

>From 1fa48716f9883c3d479e3fec0167e07b2a512c61 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 21 May 2026 11:20:13 +0100
Subject: [PATCH] [lldb][windows] Null-check m_session_data in
 ProcessDebugger::HaltProcess

Every other public method in this file (ReadMemory, WriteMemory,
AllocateMemory, DeallocateMemory, GetMemoryRegionInfo, OnExitProcess)
checks m_session_data before dereferencing.
---
 .../Plugins/Process/Windows/Common/ProcessDebugger.cpp      | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
index 51b2dfcb74d86..f40fda7e72156 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
@@ -248,6 +248,12 @@ Status ProcessDebugger::HaltProcess(bool &caused_stop) {
   Log *log = GetLog(WindowsLog::Process);
   Status error;
   llvm::sys::ScopedLock lock(m_mutex);
+  if (!m_session_data) {
+    caused_stop = false;
+    LLDB_LOG(log, "HaltProcess called with no active session.");
+    return Status::FromErrorString(
+        "HaltProcess called with no active debugger session.");
+  }
   caused_stop = ::DebugBreakProcess(m_session_data->m_debugger->GetProcess()
                                         .GetNativeProcess()
                                         .GetSystemHandle());



More information about the lldb-commits mailing list