Skip to content

Conversation

@DavidSpickett
Copy link
Collaborator

@DavidSpickett DavidSpickett commented Dec 9, 2025

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

  1. version --verbose (won't work prior to 22)
  2. Scripting to call GetBuildConfiguration (won't work if you don't have a scripting language
  3. readelf/other platform's equivalent utility

readelf is recommended for Linux due to security concerns with ldd.

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"

The drawback to that is it doesn't show dependencies of dependencies, so I've noted that. People can use ldd if they trust the binary, but I've made it clear how to avoid that and why you should avoid it.

This makes use of `version -v` added by llvm#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.
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2025

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/171468.diff

1 Files Affected:

  • (modified) lldb/docs/use/troubleshooting.rst (+30)
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.

@DavidSpickett
Copy link
Collaborator Author

This is useful in itself but I also intend to use it as the first step for dealing with register info problems. Which will be a follow up addition to this document.

@DavidSpickett DavidSpickett merged commit 0e7adf2 into llvm:main Dec 10, 2025
8 of 10 checks passed
@DavidSpickett DavidSpickett deleted the lldb-trouble branch December 10, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants