This is an archive of the discontinued LLVM Phabricator instance.

add patch to print lldb path
Needs ReviewPublic

Authored by LocutusOfBorg on Apr 13 2020, 8:43 AM.

Details

Summary

See e.g. http://bugs.debian.org/945445

lldb -P is supposed to print the path to the python lldb module. This does not work
in Debian, the path was not overridden correctly in the packaging:

$ lldb-9 -P
/usr/lib/lib/python3/dist-packages

$ dpkg -L python3-lldb-9
[..]
/usr/lib/llvm-9/lib/python3/dist-packages
[..]

The fix is to override "lldb-9 -P" so it doesn't output "/lib" twice

This will make it easier to package rust-lldb as well.

Diff Detail

Event Timeline

LocutusOfBorg created this revision.Apr 13 2020, 8:43 AM
JDevlieghere requested changes to this revision.Apr 13 2020, 9:09 AM
JDevlieghere added a reviewer: labath.

I don't see how the patch addresses the issue described in the summary. Also, this seems like something that should be fixed at build-time in CMake, rather than at runtime.

This revision now requires changes to proceed.Apr 13 2020, 9:10 AM
LocutusOfBorg edited the summary of this revision. (Show Details)Apr 13 2020, 9:18 AM

I agree that this needs to be implemented differently. Maybe you could start out by explaining the problem in more detail. The questions I have are:

  • how exactly does debian build/install lldb? Maybe give us the relevant cmake commands, the locations of various lldb components (i am mainly intersted liblldb mainly) and the various path values that lldb computes (e.g. result of HostInfoBase::GetShlibDir) ?
  • could this be solved by passing an appropriate value for LLDB_PYTHON_RELATIVE_PATH cmake argument?

Hello, I updated the patch.

Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 1:08 AM

The problem was that since a newer python3.10 or 3.11 version, the scheme to get the configuration changed, so we have to add the "posix_local" or "posix_prefix". I adapted the python script to find the new location, and to append it correctly at the path. Now the patch works correctly for me, and lldb doesn't print anymore any kind of warnings at startup

I'm sorry, but I still don't feel I can properly review. Can you answer the questions from my previous comment? I need to understand what are the locations of the various lldb components and the values of relevant variables (LLDB_PYTHON_RELATIVE_LIBDIR for one), before and after this patch.

llvm-toolchain-15-15.0.6/lldb/bindings/python/get-python-config.py
40

is that because that's where cmake installs them? by default? On debian? What if the user specifies a different CMAKE_INSTALL_PREFIX?

llvm-toolchain-15-15.0.6/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
241

Where does this directory come from? I have a hard time believing that this will be correct on all systems running lldb. It seems to me that this should somehow be a part of LLDB_PYTHON_RELATIVE_LIBDIR, so that it can be customized based on the install path.