https://github.com/rchamala created https://github.com/llvm/llvm-project/pull/181493
## Summary Include `lldb-python.h` as the first include inside the `LLDB_ENABLE_PYTHON` block in `ScriptInterpreterPythonInterfaces.cpp`, matching the pattern used by every other Python interface `.cpp` file in this directory. On Windows, `lldb-python.h` defines `NO_PID_T` before including `Python.h`. This prevents `PosixApi.h` (transitively included via `lldb-private.h`) from redefining `pid_t` with a conflicting type (`uint32_t` vs `int`). The issue was introduced by #181334 (ScriptedSymbolLocator plugin), which added a new header whose include chain transitively reaches `PosixApi.h`. Fixes Windows build failures on lldb-aarch64-windows, lldb-x86_64-win, and lldb-remote-linux-win. ## Test plan - [ ] lldb-aarch64-windows build passes - [ ] lldb-x86_64-win build passes - [ ] lldb-remote-linux-win build passes >From c58313e355bf6cd9253a4dd8b8d4ea9e2a7dabe6 Mon Sep 17 00:00:00 2001 From: Rahul Reddy Chamala <[email protected]> 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp index c460b16ba8405..47972805e7a37 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp @@ -7,13 +7,17 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/Config.h" -#include "lldb/lldb-enumerations.h" #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" +#include "lldb/lldb-enumerations.h" using namespace lldb; using namespace lldb_private; _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
