You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lldb/docs/use/variable.rst
+96-9Lines changed: 96 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Variable Formatting
7
7
LLDB has a data formatters subsystem that allows users to define custom display
8
8
options for their variables.
9
9
10
-
Usually, when you type frame variable or run some expression LLDB will
10
+
Usually, when you type ``frame variable`` or run some expression LLDB will
11
11
automatically choose the way to display your results on a per-type basis, as in
12
12
the following example:
13
13
@@ -17,7 +17,11 @@ the following example:
17
17
(uint8_t) x = 'a'
18
18
(intptr_t) y = 124752287
19
19
20
-
However, in certain cases, you may want to associate a different style to the display for certain datatypes. To do so, you need to give hints to the debugger
20
+
Note: ``frame variable`` without additional arguments prints the list of
21
+
variables of the current frame.
22
+
23
+
However, in certain cases, you may want to associate a different style to the
24
+
display for certain datatypes. To do so, you need to give hints to the debugger
21
25
as to how variables should be displayed. The LLDB type command allows you to do
22
26
just that.
23
27
@@ -29,6 +33,63 @@ Using it you can change your visualization to look like this:
29
33
(uint8_t) x = chr='a' dec=65 hex=0x41
30
34
(intptr_t) y = 0x76f919f
31
35
36
+
In addition, some data structures can encode their data in a way that is not
37
+
easily readable to the user, in which case a data formatter can be used to
38
+
show the data in a human readable way. For example, without a formatter,
39
+
printing a ``std::deque<int>`` with the elements ``{2, 3, 4, 5, 6}`` would
40
+
result in something like:
41
+
42
+
::
43
+
44
+
(lldb) frame variable a_deque
45
+
(std::deque<Foo, std::allocator<int> >) $0 = {
46
+
std::_Deque_base<Foo, std::allocator<int> > = {
47
+
_M_impl = {
48
+
_M_map = 0x000000000062ceb0
49
+
_M_map_size = 8
50
+
_M_start = {
51
+
_M_cur = 0x000000000062cf00
52
+
_M_first = 0x000000000062cf00
53
+
_M_last = 0x000000000062d2f4
54
+
_M_node = 0x000000000062cec8
55
+
}
56
+
_M_finish = {
57
+
_M_cur = 0x000000000062d300
58
+
_M_first = 0x000000000062d300
59
+
_M_last = 0x000000000062d6f4
60
+
_M_node = 0x000000000062ced0
61
+
}
62
+
}
63
+
}
64
+
}
65
+
66
+
which is very hard to make sense of.
67
+
68
+
Note: ``frame variable <var>`` prints out the variable ``<var>`` in the current
69
+
frame.
70
+
71
+
On the other hand, a proper formatter is able to produce the following output:
0 commit comments