[Lldb-commits] [lldb] 6a99d81 - [lldb/docs] Fix/improve the gdb command map for dynamic types (#138538)
via lldb-commits
lldb-commits at lists.llvm.org
Tue May 6 06:06:28 PDT 2025
Author: Pavel Labath
Date: 2025-05-06T15:06:24+02:00
New Revision: 6a99d817204dfa39afc42f1f6a810d82f6a8794f
URL: https://github.com/llvm/llvm-project/commit/6a99d817204dfa39afc42f1f6a810d82f6a8794f
DIFF: https://github.com/llvm/llvm-project/commit/6a99d817204dfa39afc42f1f6a810d82f6a8794f.diff
LOG: [lldb/docs] Fix/improve the gdb command map for dynamic types (#138538)
The setting and option value names were wrong. I'm assuming this changed
over time, but I haven't tried to figure out when.
Added:
Modified:
lldb/docs/use/map.rst
Removed:
################################################################################
diff --git a/lldb/docs/use/map.rst b/lldb/docs/use/map.rst
index ed285b2d1f6e9..c648b212006e0 100644
--- a/lldb/docs/use/map.rst
+++ b/lldb/docs/use/map.rst
@@ -800,16 +800,24 @@ Print the dynamic type of the result of an expression
(gdb) p someCPPObjectPtrOrReference
(Only works for C++ objects)
+LLDB does this automatically if determining the dynamic type does not require
+running the target (in C++, running the target is never needed). This default is
+controlled by the `target.prefer-dynamic-value` setting. If that is disabled, it
+can be re-enabled on a per-command basis:
+
.. code-block:: shell
- (lldb) expr -d 1 -- [SomeClass returnAnObject]
- (lldb) expr -d 1 -- someCPPObjectPtrOrReference
+ (lldb) settings set target.prefer-dynamic-value no-dynamic-values
+ (lldb) frame variable -d no-run-target someCPPObjectPtrOrReference
+ (lldb) expr -d no-run-target -- someCPPObjectPtr
-or set dynamic type printing to be the default:
+Note that printing of the dynamic type of references is not possible with the
+`expr` command. The workaround is to take the address of the reference and
+instruct lldb to print the children of the resulting pointer.
.. code-block:: shell
- (lldb) settings set target.prefer-dynamic run-target
+ (lldb) expr -P1 -d no-run-target -- &someCPPObjectReference
Call a function so you can stop at a breakpoint in it
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the lldb-commits
mailing list