Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2024 SwiftDeveloper Tools

WWDC24 · 29 min · Swift / Developer Tools

Run, Break, Inspect: Explore effective debugging in LLDB

Learn how to use LLDB to explore and debug codebases. We’ll show you how to make the most of crashlogs and backtraces, and how to supercharge breakpoints with actions and complex stop conditions. We’ll also explore how the “p” command and the latest features in Swift 6 can enhance your debugging experience.

Watch at developer.apple.com ↗

Transcript all transcripts

Chapters

Code shown on screen · 5 snippets

WatchLater button swift · at 8:09 ↗
Button(action: { watchLater.toggle(video: video) }) {
  let inList = watchLater.isInList(video: video)
  Label(inList ? "In Watch Later" : "Add to Watch Later",
  systemImage: inList ? "checkmark" : "plus")
}
Printing watch later list information swift · at 12:54 ↗
p watchLater.count
p watchLater.last!.name
Breakpoint actions: Printing name of the most recently added video swift · at 13:45 ↗
p "last video is \(watchLater.last?.name)"
Breakpoint actions: on the command line swift · at 14:42 ↗
b DetailView.swift:70
break command add
p "last video is \(watchLater.last?.name)"
continue
DONE
@DebugDescriptio macro example swift · at 26:46 ↗
// Type summaries

@DebugDescription
struct WatchLaterItem {
    let video: Video
    let name: String
    let addedOn: Date

    var debugDescription: String {
        "\(name) - \(addedOn)"
    }
}

Resources