[Lldb-commits] [lldb] [lldb][docs] Describe how to check enabled features (PR #171468)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 9 09:08:31 PST 2025


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/171468

>From 0c3d5744c86ad069e20f30e83f1bc8dfdc61aeae Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 16:11:51 +0000
Subject: [PATCH 1/7] [lldb][docs] Describe how to check enabled features

This makes use of `version -v` added by #170772,
along with a fallback method for LLDB prior to 22.

The fallback uses readelf because running ldd on
binaries you don't trust is not a good idea.

https://man7.org/linux/man-pages/man1/ldd.1.html
"some versions of ldd may attempt to obtain the
dependency information by attempting to directly
execute the program"

People will be inspecting downloaded builds
of LLDB so this is best avoided.
---
 lldb/docs/use/troubleshooting.rst | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index e6604f6ecffea..c25371ec3c615 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -97,3 +97,33 @@ for any source file and line breakpoints that the IDE set using:
 ::
 
    (lldb) breakpoint list --verbose
+
+How Do I Find Out What Features My Version Of LLDB Has?
+-------------------------------------------------------
+
+Some features such as XML parsing are optional and must be enabled when LLDB is
+built. To check which features your copy of LLDB has enabled, use the ``version``
+command from within LLDB:
+
+::
+
+   (lldb) version -v
+
+.. note::
+   This feature was added in LLDB 22. If you are using an earlier version, you
+   can use the method below.
+
+Alternatively, you can check the shared library dependencies of LLDB. For example
+on Linux you can use the following command:
+
+::
+
+   $ readelf -d ./bin/lldb | grep NEEDED
+   0x0000000000000001 (NEEDED)             Shared library: [liblldb.so.22.0git]
+   0x0000000000000001 (NEEDED)             Shared library: [libxml2.so.2]
+   0x0000000000000001 (NEEDED)             Shared library: [libedit.so.2]
+   <...>
+   0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
+
+The output above shows us that this particular copy of LLDB has XML parsing
+(``libxml2``) and editline (``libedit``) enabled.

>From 1abd8e615d477aab5a41f6fd6058e5ae7e427d85 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 16:17:57 +0000
Subject: [PATCH 2/7] remove a bit of a path

---
 lldb/docs/use/troubleshooting.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index c25371ec3c615..83748bb0570eb 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -118,7 +118,7 @@ on Linux you can use the following command:
 
 ::
 
-   $ readelf -d ./bin/lldb | grep NEEDED
+   $ readelf -d lldb | grep NEEDED
    0x0000000000000001 (NEEDED)             Shared library: [liblldb.so.22.0git]
    0x0000000000000001 (NEEDED)             Shared library: [libxml2.so.2]
    0x0000000000000001 (NEEDED)             Shared library: [libedit.so.2]

>From b3aa6ca8032ac1de415bcd02310c0c71f41055fd Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 16:18:26 +0000
Subject: [PATCH 3/7] what -> which

---
 lldb/docs/use/troubleshooting.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index 83748bb0570eb..92c811609d7d5 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -98,8 +98,8 @@ for any source file and line breakpoints that the IDE set using:
 
    (lldb) breakpoint list --verbose
 
-How Do I Find Out What Features My Version Of LLDB Has?
--------------------------------------------------------
+How Do I Find Out Which Features My Version Of LLDB Has?
+--------------------------------------------------------
 
 Some features such as XML parsing are optional and must be enabled when LLDB is
 built. To check which features your copy of LLDB has enabled, use the ``version``

>From 543a0ab483a283cfbf451c3fc542d962825518ed Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 16:55:48 +0000
Subject: [PATCH 4/7] Add the scripting version and macos command.

---
 lldb/docs/use/troubleshooting.rst | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index 92c811609d7d5..bd524db790283 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -111,14 +111,23 @@ command from within LLDB:
 
 .. note::
    This feature was added in LLDB 22. If you are using an earlier version, you
-   can use the method below.
+   can use one of the methods below.
 
-Alternatively, you can check the shared library dependencies of LLDB. For example
-on Linux you can use the following command:
+If your LLDB has Python enabled, you can also use this command to print the
+same information:
 
 ::
 
-   $ readelf -d lldb | grep NEEDED
+   (lldb) script lldb.debugger.GetBuildConfiguration()
+
+This command will fail if Python was not enabled. In that case, you can instead
+check the shared library dependencies of LLDB.
+
+For example on Linux you can use the following command:
+
+::
+
+   $ readelf -d <path-to-lldb> | grep NEEDED
    0x0000000000000001 (NEEDED)             Shared library: [liblldb.so.22.0git]
    0x0000000000000001 (NEEDED)             Shared library: [libxml2.so.2]
    0x0000000000000001 (NEEDED)             Shared library: [libedit.so.2]
@@ -127,3 +136,5 @@ on Linux you can use the following command:
 
 The output above shows us that this particular copy of LLDB has XML parsing
 (``libxml2``) and editline (``libedit``) enabled.
+
+If you are on MacOS, use ``otool -l <path-to-lldb>``.

>From 3bab3101b1a64bbd37525ea0d549126a41898558 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 16:56:34 +0000
Subject: [PATCH 5/7] technically doesn't have to be python

---
 lldb/docs/use/troubleshooting.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index bd524db790283..6bb75cfaa47a7 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -120,8 +120,8 @@ same information:
 
    (lldb) script lldb.debugger.GetBuildConfiguration()
 
-This command will fail if Python was not enabled. In that case, you can instead
-check the shared library dependencies of LLDB.
+This command will fail if no scripting langauge is enabled. In that case, you
+can instead check the shared library dependencies of LLDB.
 
 For example on Linux you can use the following command:
 

>From 86a7fe28df787b4ad2dffeb2bbb87ff24f45da40 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 17:04:35 +0000
Subject: [PATCH 6/7] note the deps of deps problem

---
 lldb/docs/use/troubleshooting.rst | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index 6bb75cfaa47a7..96a9066730338 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -137,4 +137,13 @@ For example on Linux you can use the following command:
 The output above shows us that this particular copy of LLDB has XML parsing
 (``libxml2``) and editline (``libedit``) enabled.
 
+.. note::
+
+   ``readelf -d`` as used above only shows direct dependencies of the binary.
+   Libraries loaded by a library will not be shown. An example of this is Python.
+   ``lldb`` loads ``liblldb`` and it is ``liblldb`` that requires ``libpython``.
+
+   The same ``readelf`` command can be used on ``liblldb`` to see if it does
+   depend on Python.
+
 If you are on MacOS, use ``otool -l <path-to-lldb>``.

>From 06212459fed2c32ebb12093dfd68b3435f3031c4 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 17:07:54 +0000
Subject: [PATCH 7/7] note the obvious ldd use and why it's not a good idea

---
 lldb/docs/use/troubleshooting.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lldb/docs/use/troubleshooting.rst b/lldb/docs/use/troubleshooting.rst
index 96a9066730338..4900d2f86505c 100644
--- a/lldb/docs/use/troubleshooting.rst
+++ b/lldb/docs/use/troubleshooting.rst
@@ -146,4 +146,8 @@ The output above shows us that this particular copy of LLDB has XML parsing
    The same ``readelf`` command can be used on ``liblldb`` to see if it does
    depend on Python.
 
+   ``ldd`` will show you the full dependency tree of ``lldb`` but **do not**
+   use it unless you trust the ``lldb`` binary itself. As some versions of
+   ``ldd`` may execute the binary in the process of inspecting it.
+
 If you are on MacOS, use ``otool -l <path-to-lldb>``.



More information about the lldb-commits mailing list