[Lldb-commits] [lldb] [lldb] Fix pid_t redefinition on Windows in ScriptInterpreterPythonInterfaces (PR #181493)

via lldb-commits lldb-commits at lists.llvm.org
Sat Feb 14 09:43:53 PST 2026


https://github.com/rchamala updated https://github.com/llvm/llvm-project/pull/181493

>From 66a9c86f7d4e6e5a84e7a8cddc5d7fe8c59b41a0 Mon Sep 17 00:00:00 2001
From: Rahul Reddy Chamala <rachamal at meta.com>
Date: Sat, 14 Feb 2026 09:39:58 -0800
Subject: [PATCH] [lldb] Fix pid_t redefinition on Windows in
 ScriptInterpreterPythonInterfaces

Include lldb-python.h as the first include (after Config.h) inside the
LLDB_ENABLE_PYTHON block. On Windows, lldb-python.h defines NO_PID_T
before including Python.h, which prevents PosixApi.h from later
redefining pid_t with a different type (uint32_t vs int).

This matches the pattern used by every other Python interface .cpp file
in this directory (OperatingSystemPythonInterface.cpp,
ScriptedPythonInterface.cpp, etc.).

The issue was introduced by the ScriptedSymbolLocator plugin (#181334)
which added ScriptedSymbolLocatorPythonInterface.h to
ScriptInterpreterPythonInterfaces.h. That new header's include chain
transitively reaches PosixApi.h via lldb-private.h, triggering the
pid_t conflict on Windows when lldb-python.h hasn't been included first.
---
 .../Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp
index c460b16ba8405..7cb5c90f8e14b 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp
@@ -11,6 +11,10 @@
 
 #if LLDB_ENABLE_PYTHON
 
+// Include lldb-python.h first to define NO_PID_T on Windows before any
+// LLDB header transitively pulls in PosixApi.h.
+#include "../lldb-python.h"
+
 #include "ScriptInterpreterPythonInterfaces.h"
 
 #include "lldb/Core/PluginManager.h"



More information about the lldb-commits mailing list