[Lldb-commits] [lldb] [lldb][docs] Clean Variable Formatting Documentation (PR #193907)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 24 03:15:32 PDT 2026


================
@@ -323,96 +328,145 @@ pick:
 | ``void``                                      | v                | don't show anything                                                      |
 +-----------------------------------------------+------------------+--------------------------------------------------------------------------+
 
+.. _type-summary:
+
 Type Summary
 ------------
 
-Type formats work by showing a different kind of display for the value of a
-variable. However, they only work for basic types. When you want to display a
-class or struct in a custom format, you cannot do that using formats.
+Type formats specify the way to format a variable/value with a fundamental type.
+When you want to display a variable/value for a user-defined type,\ [#]_ you need
+another tool, type summaries.
+
+Type summaries work by extracting information from aggregate types and arranging it
+in a user-defined format. Consider the following example:
+
+Before adding a type summary, for a C++ program with a ``struct`` declared like
 
-A different feature, type summaries, works by extracting information from
-classes, structures, ... (aggregate types) and arranging it in a user-defined
-format, as in the following example:
+.. code-block:: C++
+
+   struct Person {
+      std::string name;
+      int age;
+   };
 
-before adding a summary...
+
+LLDB will format a variable that is an instance of the ``Person`` type as
 
 ::
 
-   (lldb) frame variable -T one
-   (i_am_cool) one = {
-      (int) x = 3
-      (float) y = 3.14159
-      (char) z = 'E'
+   (lldb) frame variable -T p
+   (Person) p = {
+      (std::string) name = "Jaime"
+      (int) age = 44
    }
 
-after adding a summary...
+But, using a type summary, the LLDB user can specify that an instance of
----------------
DavidSpickett wrote:

I don't think you need "But" here. The reader has not encountered type summaries before so I don't think there's any contradiction or surprise to what you're saying here.

It's a story, we didn't expect anything other than a type summary to appear here.

I do see why you'd say "but" as someone who knows about all this.

https://github.com/llvm/llvm-project/pull/193907


More information about the lldb-commits mailing list