-
swiftc
invokes sub-commands, so you shouldn't runlldb
on theswiftc
command itself. You can add the-###
option toswiftc
to see the underlying sub-commands. Pick the correct sub-command, then runlldb -- <command>
. -
Usually, we want the first command, so run something like:
lldb -- `swiftc file.swift | head -n 1`
-
Use
--one-line r
to run immediately after loading, without having to set breakopints - great for debugging crasheslldb --one-line r -- `swiftc crash.swift | head -n 1`
-
When dumping a type, use
type.dump()
, nottype->dump()
-
If you want to look inside llvm collections, you can't always dump them or see their size (possibly because the collection code is inlined). You can still iterate over it from the lldb shell:
e -- for (auto item: collection) { item.dump(); printf("\n"); }