Skip to content

Instantly share code, notes, and snippets.

@roop
roop / notes_on_debugging_the_swift_compiler.md
Last active January 21, 2020 06:55
Notes on debugging on the Swift compiler

Invoking lldb

  • swiftc invokes sub-commands, so you shouldn't run lldb on the swiftc command itself. You can add the -### option to swiftc to see the underlying sub-commands. Pick the correct sub-command, then run lldb -- <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 crashes