mirror of https://github.com/pwndbg/pwndbg.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
5.1 KiB
Diff
108 lines
5.1 KiB
Diff
Subject: [PATCH] test1
|
|
---
|
|
Index: lldb/CMakeLists.txt
|
|
IDEA additional info:
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
<+>UTF-8
|
|
===================================================================
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
--- a/CMakeLists.txt (revision 4740e097031d231cd39680c16a31771d22fe84c9)
|
|
+++ b/CMakeLists.txt (date 1739005831013)
|
|
@@ -60,7 +60,7 @@
|
|
"Filename extension for native code python modules")
|
|
|
|
foreach(var LLDB_PYTHON_RELATIVE_PATH LLDB_PYTHON_EXE_RELATIVE_PATH LLDB_PYTHON_EXT_SUFFIX)
|
|
- if(NOT DEFINED ${var} AND NOT CMAKE_CROSSCOMPILING)
|
|
+ if(NOT DEFINED ${var})
|
|
execute_process(
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bindings/python/get-python-config.py
|
|
Index: lldb/bindings/python/get-python-config.py
|
|
IDEA additional info:
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
<+>UTF-8
|
|
===================================================================
|
|
diff --git a/bindings/python/get-python-config.py b/bindings/python/get-python-config.py
|
|
--- a/bindings/python/get-python-config.py (revision 4740e097031d231cd39680c16a31771d22fe84c9)
|
|
+++ b/bindings/python/get-python-config.py (date 1738953843941)
|
|
@@ -1,5 +1,14 @@
|
|
#!/usr/bin/env python3
|
|
|
|
+# In this script, we should only use the following to retrieve configuration values:
|
|
+# - `sysconfig.get_config_var`
|
|
+# - `sysconfig.get_platform`
|
|
+# - `sysconfig.get_path`
|
|
+# This is because certain variables may return invalid data during cross-compilation, for example:
|
|
+# - sys.prefix -> Use sysconfig.get_config_var("prefix") instead.
|
|
+# - sys.executable -> Use sysconfig.get_config_var("EXENAME") instead.
|
|
+# - os.name -> Use sysconfig.get_platform() for platform detection.
|
|
+
|
|
import os
|
|
import sys
|
|
import argparse
|
|
@@ -32,20 +41,25 @@
|
|
# If not, you'll have to use lldb -P or lldb -print-script-interpreter-info
|
|
# to figure out where it is.
|
|
try:
|
|
- print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix))
|
|
+ print(relpath_nodots(sysconfig.get_path("platlib"), sysconfig.get_config_var("prefix")))
|
|
except ValueError:
|
|
# Try to fall back to something reasonable if sysconfig's platlib
|
|
# is outside of sys.prefix
|
|
if os.name == "posix":
|
|
- print("lib/python%d.%d/site-packages" % sys.version_info[:2])
|
|
+ print("lib/python%s/site-packages" % sysconfig.get_config_var("VERSION"))
|
|
elif os.name == "nt":
|
|
print("Lib\\site-packages")
|
|
else:
|
|
raise
|
|
elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
|
|
tried = list()
|
|
- exe = sys.executable
|
|
- prefix = os.path.realpath(sys.prefix)
|
|
+ exe = sysconfig.get_config_var("EXENAME")
|
|
+ if not exe:
|
|
+ # Fallback: 'EXENAME' is not available on Windows
|
|
+ exe_name = "python" + sysconfig.get_config_var("VERSION") + sysconfig.get_config_var("EXE")
|
|
+ exe = os.path.join(sysconfig.get_config_var("BINDIR"), exe_name)
|
|
+
|
|
+ prefix = os.path.realpath(sysconfig.get_config_var("prefix"))
|
|
while True:
|
|
try:
|
|
print(relpath_nodots(exe, prefix))
|
|
@@ -59,13 +73,13 @@
|
|
continue
|
|
else:
|
|
print(
|
|
- "Could not find a relative path to sys.executable under sys.prefix",
|
|
+ "Could not find a relative path to sysconfig.get_config_var(\"EXENAME\") under sysconfig.get_config_var(\"prefix\")",
|
|
file=sys.stderr,
|
|
)
|
|
for e in tried:
|
|
print("tried:", e, file=sys.stderr)
|
|
- print("realpath(sys.prefix):", prefix, file=sys.stderr)
|
|
- print("sys.prefix:", sys.prefix, file=sys.stderr)
|
|
+ print("realpath(sysconfig.get_config_var(\"prefix\")):", prefix, file=sys.stderr)
|
|
+ print("sysconfig.get_config_var(\"prefix\"):", sysconfig.get_config_var("prefix"), file=sys.stderr)
|
|
sys.exit(1)
|
|
elif args.variable_name == "LLDB_PYTHON_EXT_SUFFIX":
|
|
print(sysconfig.get_config_var("EXT_SUFFIX"))
|
|
Index: lldb/cmake/modules/FindPythonAndSwig.cmake
|
|
IDEA additional info:
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
<+>UTF-8
|
|
===================================================================
|
|
diff --git a/cmake/modules/FindPythonAndSwig.cmake b/cmake/modules/FindPythonAndSwig.cmake
|
|
--- a/cmake/modules/FindPythonAndSwig.cmake (revision 4740e097031d231cd39680c16a31771d22fe84c9)
|
|
+++ b/cmake/modules/FindPythonAndSwig.cmake (date 1739019752496)
|
|
@@ -8,6 +8,9 @@
|
|
# Use PYTHON_HOME as a hint to find Python 3.
|
|
set(Python3_ROOT_DIR "${PYTHON_HOME}")
|
|
find_package(Python3 COMPONENTS Interpreter Development)
|
|
+ if (DEFINED Python3_EXECUTABLE_NATIVE)
|
|
+ set(Python3_EXECUTABLE "${Python3_EXECUTABLE_NATIVE}" CACHE STRING "Native Python3 executable" FORCE)
|
|
+ endif()
|
|
if(Python3_FOUND AND Python3_Interpreter_FOUND)
|
|
|
|
# The install name for the Python 3 framework in Xcode is relative to
|