File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -800,16 +800,24 @@ Print the dynamic type of the result of an expression
800
800
(gdb) p someCPPObjectPtrOrReference
801
801
(Only works for C++ objects)
802
802
803
+ LLDB does this automatically if determining the dynamic type does not require
804
+ running the target (in C++, running the target is never needed). This default is
805
+ controlled by the `target.prefer-dynamic-value` setting. If that is disabled, it
806
+ can be re-enabled on a per-command basis:
807
+
803
808
.. code-block:: shell
804
809
805
- (lldb) expr -d 1 -- [SomeClass returnAnObject]
806
- (lldb) expr -d 1 -- someCPPObjectPtrOrReference
810
+ (lldb) settings set target.prefer-dynamic-value no-dynamic-values
811
+ (lldb) frame variable -d no-run-target someCPPObjectPtrOrReference
812
+ (lldb) expr -d no-run-target -- someCPPObjectPtr
807
813
808
- or set dynamic type printing to be the default:
814
+ Note that printing of the dynamic type of references is not possible with the
815
+ `expr` command. The workaround is to take the address of the reference and
816
+ instruct lldb to print the children of the resulting pointer.
809
817
810
818
.. code-block:: shell
811
819
812
- (lldb) settings set target.prefer-dynamic run-target
820
+ (lldb) expr -P1 -d no- run-target -- &someCPPObjectReference
813
821
814
822
Call a function so you can stop at a breakpoint in it
815
823
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments