The document discusses debugging and evaluating expressions in LLDB. It provides examples of common LLDB commands for threads, stack backtraces, stepping, and evaluating expressions. It also discusses how commands like "po", "p", and "v" work under the hood to evaluate expressions by compiling and executing code. Additional tips are provided for using Chisel to add advanced debugging capabilities to LLDB. Links to external resources on advanced LLDB debugging techniques are also included.
31. Evaluating Expression
Command Alias for Execute
po [expession] expression -Object-description --
Code ,
debugDescription
description
LLDB formatter
p [expression] expression --
Code
LLDB formatter
v / fr v [name] frame variable
Code , LLDB
formatter
32. Evaluating Expression
Command Alias for Execute
po [expession] expression -Object-description --
Code ,
debugDescription
description
LLDB formatter
p [expression] expression --
Code
LLDB formatter
v / fr v [name] frame variable
Code , LLDB
formatter
33. “po” Under the Hood
(lldb) po view
: WWDC19 - LLDB: Beyond “po"
34. “po” Under the Hood
(lldb) po view
Create
compilable code
: WWDC19 - LLDB: Beyond “po"
35. func __lldb_expr() {
__lldb_res = view
}
“po” Under the Hood
(lldb) po view
Create
compilable code
: WWDC19 - LLDB: Beyond “po"
36. “po” Under the Hood
(lldb) po view
Create
compilable code
Compile
: WWDC19 - LLDB: Beyond “po"
37. “po” Under the Hood
(lldb) po view
Create
compilable code
Compile Execute
Get result
: WWDC19 - LLDB: Beyond “po"
38. func __lldb_expr2 -> String() {
return __lldb_res.description
}
“po” Under the Hood
(lldb) po view
Create
compilable code
Compile Execute
Create code to
access
description
Get result
: WWDC19 - LLDB: Beyond “po"
39. “po” Under the Hood
(lldb) po view
Create
compilable code
Compile Execute
Create code to
access
description
CompileGet result
: WWDC19 - LLDB: Beyond “po"
40. “po” Under the Hood
(lldb) po view
Create
compilable code
Compile Execute
Create code to
access
description
Compile ExecuteGet result
: WWDC19 - LLDB: Beyond “po"
41. “po” Under the Hood
(lldb) po view
Create
compilable code
Compile Execute
Create code to
access
description
Compile ExecuteGet result
“<UIView: 0x12345678>”
: WWDC19 - LLDB: Beyond “po"
42. “po” Under the Hood
(lldb) po view
Get string result
Create
compilable code
Compile Execute
Create code to
access
description
Compile ExecuteGet result
Display result
string
: WWDC19 - LLDB: Beyond “po"
43. Evaluating Expression
Command Alias for Execute
po [expession] expression -Object-description --
Code ,
debugDescription
description
LLDB formatter
p [expression] expression --
Code
LLDB formatter
v / fr v [name] frame variable
Code , LLDB
formatter
44. “p” Under the Hood
(lldb) p cruise
: WWDC19 - LLDB: Beyond “po"
45. “p” Under the Hood
Create
compilable code
Compile Execute
Get result
(lldb) p cruise
: WWDC19 - LLDB: Beyond “po"
46. “p” Under the Hood
Dynamic type
resolution
Create
compilable code
Compile Execute
Get result
(lldb) p cruise
: WWDC19 - LLDB: Beyond “po"
47. “p” Under the Hood
(lldb) p cruise
Create
compilable code
Compile Execute
Get result Formatter
Dynamic type
resolution
: WWDC19 - LLDB: Beyond “po"
48. Evaluating Expression
Command Alias for Execute
po [expession] expression -Object-description --
Code ,
debugDescription
description
LLDB formatter
p [expression] expression --
Code
LLDB formatter
v / fr v [name] frame variable
Code , LLDB
formatter
49. “v” Under the Hood
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
50. “v” Under the Hood
(lldb) v variable
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
51. “v” Under the Hood
Examine
program state
(lldb) v variable
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
52. “v” Under the Hood
Examine
program state
Read value from
memory
(lldb) v variable
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
53. “v” Under the Hood
Examine
program state
Read value from
memory
Dynamic type
resolution
(lldb) v variable
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
54. “v” Under the Hood
Examine
program state
Read value from
memory
Dynamic type
resolution
(lldb) v variable.field1
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
55. “v” Under the Hood
Examine
program state
Read value from
memory
Dynamic type
resolution
(lldb) v variable.field1 .field2
(lldb) v variable
: WWDC19 - LLDB: Beyond “po"
56. “v” Under the Hood
Examine
program state
Read value from
memory
Dynamic type
resolution
(lldb) v variable.field1 .field2
Formatter(lldb) v variable
: WWDC19 - LLDB: Beyond “po"