here are some of my favourite LLDB shortcuts for the console junkies out there
(lldb) help <command>
get help for a command like expression
or break set
(lldb) help
get complete help docs
(lldb) type lookup Equatable
shows information about a type
(lldb) run
(lldb) kill
... hit breakpoints...
(lldb) continue
(lldb) expr -i 0 -- functionWithBreakpoint()
calls the function that contains the breakpoint and stops at the breakpoint.
(lldb) break set -r "\.Circle\..*"
breaks on all calls from a specified class.
(lldb) po let $array = [321,1241,44]
creates a variable that you can use later on. ensure that $
is added to the variable name.
(lldb) expression
struct $Person {
let name: String
}
po let $pranav = $Person.init(name: "pranav")
po $pranav
$Person
- name : "pranav"
define a struct in lldb and create new vars
(lldb) expr -l objc++ —- (Class)(variableName class)
tells lldb to fetch an expression using a particular language
(lldb) expr -O --language objc -- [SomeClass returnAnObject]
print the memory address of the result of an expression
(lldb) expr -O --language objc —- 0x100001c74
print the dynamic type of the result of a memory address
(lldb) e -l swift -- UIApplication.shared.keyWindow?.rootViewController?.value(forKey: "_printHierarchy")
get a printout of your entire view hierarchy during pause
(lldb) expression
extension Collection where Self.Element == Int {
var $elementsOver30: [Self.Element]? {
return self.filter { $0 > 30 }
}
}
(lldb) po [32,31,4].$elementsOver30
swift extensions in lldb
(lldb) po 0x100001c74
4294974580
(lldb) next
(lldb) step
(lldb) finish
(lldb) up
(lldb) down
move around the frame
(lldb) fr v
shows all local variables
(lldb) register read
show the general-purpose registers for the current thread
(lldb) fr v variableName
shows all information about a variable
(lldb) f
shows where you are in the frame
(lldb) thread info
shows extended information about the threads at a breakpoint
(lldb) bt
shows thread backtrace
(lldb) image list ModuleName
lists targets for module