diff --git a/.lldb.metadata b/.lldb.metadata new file mode 100644 index 0000000..2736d29 --- /dev/null +++ b/.lldb.metadata @@ -0,0 +1,2 @@ +fe7372c59ada760ed06814ed92c24c47fb2a055d lldb-17.0.6.src.tar.xz.sig +fc7260e1768ad2ee3b9d5a91d90d17e58e20df14 lldb-17.0.6.src.tar.xz diff --git a/0001-lldb-Adapt-code-to-Python-3.13.patch b/0001-lldb-Adapt-code-to-Python-3.13.patch new file mode 100644 index 0000000..c18682f --- /dev/null +++ b/0001-lldb-Adapt-code-to-Python-3.13.patch @@ -0,0 +1,74 @@ +From ed87035da34be675df7ea78bdf5f7631d81ab2db Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Wed, 25 Oct 2023 10:48:53 -0300 +Subject: [PATCH] [lldb] Adapt code to Python 3.13 + +1. Remove usage of PyEval_ThreadsInitialized and PyEval_InitThreads + +Both of these functions were removed in Python 3.13 [1] after being +deprecated since Python 3.9. + +According to "What's new in Python 3.13" document [1]: + + Since Python 3.7, Py_Initialize() always creates the GIL: calling + PyEval_InitThreads() did nothing and PyEval_ThreadsInitialized() + always returned non-zero. + +2. Replace _Py_IsFinalizing() with Py_IsFinalizing(). + +[1] https://docs.python.org/3.13/whatsnew/3.13.html +--- + .../ScriptInterpreter/Python/PythonDataObjects.cpp | 4 +++- + .../ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 9 +++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +index 9ac840a4a102..fe3438c42471 100644 +--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp ++++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +@@ -71,7 +71,9 @@ Expected python::As(Expected &&obj) { + } + + static bool python_is_finalizing() { +-#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7 ++#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 13) || (PY_MAJOR_VERSION > 3) ++ return Py_IsFinalizing(); ++#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7 + return _Py_Finalizing != nullptr; + #else + return _Py_IsFinalizing(); +diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +index a57c8e4984ad..968cc8ca0300 100644 +--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp ++++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +@@ -179,18 +179,27 @@ private: + return; + #endif + ++// `PyEval_ThreadsInitialized` was deprecated in Python 3.9 and removed in ++// Python 3.13. It has been returning `true` always since Python 3.7. ++#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9) || (PY_MAJOR_VERSION < 3) + if (PyEval_ThreadsInitialized()) { ++#endif + Log *log = GetLog(LLDBLog::Script); + + m_was_already_initialized = true; + m_gil_state = PyGILState_Ensure(); + LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked\n", + m_gil_state == PyGILState_UNLOCKED ? "un" : ""); ++ ++// `PyEval_InitThreads` was deprecated in Python 3.9 and removed in ++// Python 3.13. ++#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9) || (PY_MAJOR_VERSION < 3) + return; + } + + // InitThreads acquires the GIL if it hasn't been called before. + PyEval_InitThreads(); ++#endif + } + + PyGILState_STATE m_gil_state = PyGILState_UNLOCKED; +-- +2.41.0 + diff --git a/0001-lldb-Fix-building-LLDB-standlone-without-framework.patch b/0001-lldb-Fix-building-LLDB-standlone-without-framework.patch deleted file mode 100644 index 5f257d6..0000000 --- a/0001-lldb-Fix-building-LLDB-standlone-without-framework.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 6888de118707e6392b46073fc35738804f9f1d80 Mon Sep 17 00:00:00 2001 -From: Alex Langford -Date: Mon, 31 Jul 2023 16:30:17 -0700 -Subject: [PATCH] [lldb] Fix building LLDB standlone without framework - -In a809720102fae8d1b5a7073f99f9dae9395c5f41 I refactored some logic to -deal with the clang resource directory in standalone LLDB builds. -However, this logic escaped me because it only runs when you do not -build LLDB.framework. - -Differential Revision: https://reviews.llvm.org/D156763 ---- - lldb/source/API/CMakeLists.txt | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt -index a55754726c58..39ac451c471c 100644 ---- a/lldb/source/API/CMakeLists.txt -+++ b/lldb/source/API/CMakeLists.txt -@@ -204,13 +204,11 @@ else() - # When building the LLDB framework, this isn't necessary as there we copy everything we need into - # the framework (including the Clang resourece directory). - if(NOT LLDB_BUILD_FRAMEWORK) -- set(LLDB_CLANG_RESOURCE_DIR_PARENT "$/clang") -- file(MAKE_DIRECTORY "${LLDB_CLANG_RESOURCE_DIR_PARENT}") -+ set(LLDB_CLANG_RESOURCE_DIR "$/clang") - add_custom_command(TARGET liblldb POST_BUILD -- COMMENT "Linking Clang resource dir into LLDB build directory: ${LLDB_CLANG_RESOURCE_DIR_PARENT}" -- COMMAND ${CMAKE_COMMAND} -E make_directory "${LLDB_CLANG_RESOURCE_DIR_PARENT}" -- COMMAND ${CMAKE_COMMAND} -E create_symlink "${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}" -- "${LLDB_CLANG_RESOURCE_DIR_PARENT}/${LLDB_CLANG_RESOURCE_DIR_NAME}" -+ COMMENT "Linking Clang resource dir into LLDB build directory: ${LLDB_CLANG_RESOURCE_DIR}" -+ COMMAND ${CMAKE_COMMAND} -E create_symlink -+ "${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}" "${LLDB_CLANG_RESOURCE_DIR}" - ) - endif() - endif() --- -2.41.0 - diff --git a/0001-lldb-NFCI-Change-logic-to-find-clang-resource-dir-in.patch b/0001-lldb-NFCI-Change-logic-to-find-clang-resource-dir-in.patch deleted file mode 100644 index f636645..0000000 --- a/0001-lldb-NFCI-Change-logic-to-find-clang-resource-dir-in.patch +++ /dev/null @@ -1,80 +0,0 @@ -From a809720102fae8d1b5a7073f99f9dae9395c5f41 Mon Sep 17 00:00:00 2001 -From: Alex Langford -Date: Tue, 25 Jul 2023 15:38:04 -0700 -Subject: [PATCH] [lldb][NFCI] Change logic to find clang resource dir in - standalone builds - -As of 0beffb854209a41f31beb18f9631258349a99299 there is a CMake -function to actually calculate the relative path to the clang resource -directory. Currently we have some bespoke logic that looks in a few -places, but with this new function we should be able to eliminate some -complexity here. - -Also, I moved the functionality from LLDBConfig to LLDBStandalone since -it is only used in standalone builds. - -Differential Revision: https://reviews.llvm.org/D156270 ---- - lldb/cmake/modules/LLDBConfig.cmake | 24 ------------------------ - lldb/cmake/modules/LLDBStandalone.cmake | 13 +++++++++++++ - 2 files changed, 13 insertions(+), 24 deletions(-) - -diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake -index 1393342dd5cb..ce90ecabc6a5 100644 ---- a/lldb/cmake/modules/LLDBConfig.cmake -+++ b/lldb/cmake/modules/LLDBConfig.cmake -@@ -282,30 +282,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - endif() - endif() - -- --# If LLDB is building against a prebuilt Clang, then the Clang resource --# directory that LLDB is using for its embedded Clang instance needs to point --# to the resource directory of the used Clang installation. --if (NOT TARGET clang-resource-headers) -- set(LLDB_CLANG_RESOURCE_DIR_NAME "${LLVM_VERSION_MAJOR}") -- # Iterate over the possible places where the external resource directory -- # could be and pick the first that exists. -- foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}" -- "${LLVM_BUILD_LIBRARY_DIR}" -- "${LLVM_LIBRARY_DIR}") -- # Build the resource directory path by appending 'clang/'. -- set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}") -- if (IS_DIRECTORY "${CANDIDATE_RESOURCE_DIR}") -- set(LLDB_EXTERNAL_CLANG_RESOURCE_DIR "${CANDIDATE_RESOURCE_DIR}") -- break() -- endif() -- endforeach() -- -- if (NOT LLDB_EXTERNAL_CLANG_RESOURCE_DIR) -- message(FATAL_ERROR "Expected directory for clang-resource headers not found: ${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}") -- endif() --endif() -- - # Find Apple-specific libraries or frameworks that may be needed. - if (APPLE) - if(NOT APPLE_EMBEDDED) -diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake -index e9bcabcb63de..fd16716d7141 100644 ---- a/lldb/cmake/modules/LLDBStandalone.cmake -+++ b/lldb/cmake/modules/LLDBStandalone.cmake -@@ -128,3 +128,16 @@ endif() - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) -+ -+# If LLDB is building against a prebuilt Clang, then the Clang resource -+# directory that LLDB is using for its embedded Clang instance needs to point to -+# the resource directory of the used Clang installation. -+if (NOT TARGET clang-resource-headers) -+ include(GetClangResourceDir) -+ get_clang_resource_dir(LLDB_EXTERNAL_CLANG_RESOURCE_DIR -+ PREFIX "${Clang_DIR}/../../../") -+ -+ if (NOT EXISTS ${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}) -+ message(FATAL_ERROR "Expected directory for clang-resource-headers not found: ${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}") -+ endif() -+endif() --- -2.41.0 - diff --git a/0001-lldb-Replace-the-usage-of-module-imp-with-module-imp.patch b/0001-lldb-Replace-the-usage-of-module-imp-with-module-imp.patch new file mode 100644 index 0000000..cd1a70e --- /dev/null +++ b/0001-lldb-Replace-the-usage-of-module-imp-with-module-imp.patch @@ -0,0 +1,91 @@ +From 16fd09f102eff20825847e32f225715960d1c082 Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Wed, 25 Oct 2023 10:48:53 -0300 +Subject: [PATCH] [lldb] Replace the usage of module imp with module importlib + +imp got removed in Python 3.12 [1] and the community recommends using +importlib in newer Python versions. + +[1] https://docs.python.org/3.12/whatsnew/3.12.html#imp +--- + lldb/scripts/use_lldb_suite.py | 30 ++++++++++++++++++++++-------- + lldb/test/API/use_lldb_suite.py | 29 +++++++++++++++++++++-------- + 2 files changed, 43 insertions(+), 16 deletions(-) + +diff --git a/lldb/scripts/use_lldb_suite.py b/lldb/scripts/use_lldb_suite.py +index 6388d87b181c..4cedfa532cf9 100644 +--- a/lldb/scripts/use_lldb_suite.py ++++ b/lldb/scripts/use_lldb_suite.py +@@ -17,10 +17,25 @@ def find_lldb_root(): + return lldb_root + + lldb_root = find_lldb_root() +-import imp +-fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root]) +-try: +- imp.load_module("use_lldb_suite_root", fp, pathname, desc) +-finally: +- if fp: +- fp.close() ++ ++# Module imp got removed in Python 3.12. ++if ( ++ sys.version_info.major == 3 and sys.version_info.minor >= 12 ++) or sys.version_info.major > 3: ++ import importlib.machinery ++ import importlib.util ++ ++ path = os.path.join(lldb_root, "use_lldb_suite_root.py") ++ loader = importlib.machinery.SourceFileLoader("use_lldb_suite_root", path) ++ spec = importlib.util.spec_from_loader("use_lldb_suite_root", loader=loader) ++ module = importlib.util.module_from_spec(spec) ++ loader.exec_module(module) ++else: ++ import imp ++ ++ fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root]) ++ try: ++ imp.load_module("use_lldb_suite_root", fp, pathname, desc) ++ finally: ++ if fp: ++ fp.close() +diff --git a/lldb/test/API/use_lldb_suite.py b/lldb/test/API/use_lldb_suite.py +index e237dd4b8a56..c9332d9921b4 100644 +--- a/lldb/test/API/use_lldb_suite.py ++++ b/lldb/test/API/use_lldb_suite.py +@@ -20,11 +20,24 @@ def find_lldb_root(): + + lldb_root = find_lldb_root() + +-import imp +- +-fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root]) +-try: +- imp.load_module("use_lldb_suite_root", fp, pathname, desc) +-finally: +- if fp: +- fp.close() ++# Module imp got removed in Python 3.12. ++if ( ++ sys.version_info.major == 3 and sys.version_info.minor >= 12 ++) or sys.version_info.major > 3: ++ import importlib.machinery ++ import importlib.util ++ ++ path = os.path.join(lldb_root, "use_lldb_suite_root.py") ++ loader = importlib.machinery.SourceFileLoader("use_lldb_suite_root", path) ++ spec = importlib.util.spec_from_loader("use_lldb_suite_root", loader=loader) ++ module = importlib.util.module_from_spec(spec) ++ loader.exec_module(module) ++else: ++ import imp ++ ++ fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root]) ++ try: ++ imp.load_module("use_lldb_suite_root", fp, pathname, desc) ++ finally: ++ if fp: ++ fp.close() +-- +2.41.0 + diff --git a/lldb.spec b/lldb.spec index c44b6dd..ae338ec 100644 --- a/lldb.spec +++ b/lldb.spec @@ -1,7 +1,7 @@ %global toolchain clang %global gts_version 13 -%global lldb_version 17.0.1 +%global lldb_version 17.0.6 #global rc_ver 4 %global lldb_srcdir %{name}-%{lldb_version}%{?rc_ver:rc%{rc_ver}}.src @@ -16,9 +16,10 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{lldb_v Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{lldb_version}%{?rc_ver:-rc%{rc_ver}}/%{lldb_srcdir}.tar.xz.sig Source2: release-keys.asc -# Backports from LLVM 18. -Patch: 0001-lldb-NFCI-Change-logic-to-find-clang-resource-dir-in.patch -Patch: 0001-lldb-Fix-building-LLDB-standlone-without-framework.patch +# Backport from https://github.com/llvm/llvm-project/pull/70443 +Patch: 0001-lldb-Replace-the-usage-of-module-imp-with-module-imp.patch +# Backport from https://github.com/llvm/llvm-project/pull/70445 +Patch: 0001-lldb-Adapt-code-to-Python-3.13.patch BuildRequires: clang BuildRequires: cmake @@ -145,6 +146,9 @@ rm -f %{buildroot}%{python3_sitearch}/six.* %{python3_sitearch}/lldb %changelog +* Mon Dec 11 2023 Timm Bäder - 17.0.6-1 +- Update to 17.0.6 + * Wed Oct 04 2023 Timm Bäder - 17.0.1-1 - Update to 17.0.1 diff --git a/sources b/sources index f504bdc..78972d7 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (lldb-17.0.1.src.tar.xz.sig) = 1f23b078ff76f28ffd5c4454541f67ac0222a7deb00e5c70ae1dfe383e6f39996ed5f955b36a066d39a2c15b85417820a50a8e539c45fb4481144aff240db1aa -SHA512 (lldb-17.0.1.src.tar.xz) = 910eca8a96350b4ba1fd616c0fcf7e129c72751ec9efce5dfe1606f37227ff52f288ce444932f14b4bc48b4f75374081a90558948846278c70375a97d4d2bd91 +SHA512 (lldb-17.0.6.src.tar.xz.sig) = d6f8edabc7d4d3ec1f7620c6166606abef4632e10f36244a8e5b76d66a94f1218742c86cd6445c7983353fc001d307709659709e9708a82c7a7042495492d9da +SHA512 (lldb-17.0.6.src.tar.xz) = 80b327c89b160b1dcdbea1946a7c69514e797056629c0a7501c77e7557d6bb3a7ae6ecdd0d760d072b1f7c3f5b136838f76c8d75522cd84622a03b1b25ba6e6c