Skip to content

Commit 0e7adf2

Browse files
[lldb][docs] Describe how to check enabled features (#171468)
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.
1 parent 467af27 commit 0e7adf2

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

lldb/docs/use/troubleshooting.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,59 @@ for any source file and line breakpoints that the IDE set using:
9797
::
9898

9999
(lldb) breakpoint list --verbose
100+
101+
How Do I Find Out Which Features My Copy Of LLDB Has?
102+
-----------------------------------------------------
103+
104+
Some features such as XML parsing are optional and must be enabled when LLDB is
105+
built. To check which features your copy of LLDB has enabled, use the ``version``
106+
command from within LLDB:
107+
108+
::
109+
110+
(lldb) version -v
111+
112+
.. note::
113+
This feature was added in LLDB 22. If you are using an earlier version, you
114+
can use one of the methods below.
115+
116+
If your LLDB has a scripting langauge enabled, you can also use this command to
117+
print the same information:
118+
119+
::
120+
121+
(lldb) script lldb.debugger.GetBuildConfiguration()
122+
123+
This command will fail if no scripting langauge was enabled. In that case, you
124+
can instead check the shared library dependencies of LLDB.
125+
126+
For example on Linux you can use the following command:
127+
128+
::
129+
130+
$ readelf -d <path-to-lldb> | grep NEEDED
131+
0x0000000000000001 (NEEDED) Shared library: [liblldb.so.22.0git]
132+
0x0000000000000001 (NEEDED) Shared library: [libxml2.so.2]
133+
0x0000000000000001 (NEEDED) Shared library: [libedit.so.2]
134+
<...>
135+
136+
The output above shows us that this particular copy of LLDB has XML parsing
137+
(``libxml2``) and editline (``libedit``) enabled.
138+
139+
.. note::
140+
141+
``readelf -d`` as used above only shows direct dependencies of the binary.
142+
Libraries loaded by a library will not be shown. An example of this is Python.
143+
``lldb`` requires ``liblldb`` and it is ``liblldb`` that would require ``libpython``.
144+
The same ``readelf`` command can be used on ``liblldb`` to see if it does
145+
depend on Python.
146+
147+
``ldd`` will show you the full dependency tree of ``lldb`` but **do not**
148+
use it unless you trust the ``lldb`` binary. As some versions of ``ldd`` may
149+
execute the binary in the process of inspecting it.
150+
151+
On Windows, use ``dumpbin /dependents <path-to-lldb>``. The same caveat from
152+
Linux applies to Windows. To find dependencies like Python, you need to run
153+
``dumpbin`` on ``liblldb.dll`` too.
154+
155+
On MacOS, use ``otool -l <path-to-lldb>``.

0 commit comments

Comments
 (0)