# Debugging Instruments

Debug iOS apps and profile performance using LLDB, the interactive Memory Graph...

- Repository: https://github.com/dpearson2699/swift-ios-skills (1266 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-07-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add dpearson2699/swift-ios-skills --skill debugging-instruments -g -a claude-code -y`
Codex: `npx skills add dpearson2699/swift-ios-skills --skill debugging-instruments -g -a codex -y`
Cursor: `npx skills add dpearson2699/swift-ios-skills --skill debugging-instruments -g -a cursor -y`
Gemini CLI: `npx skills add dpearson2699/swift-ios-skills --skill debugging-instruments -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add dpearson2699/swift-ios-skills`

## Description

Debug iOS apps and profile performance using LLDB, the interactive Memory Graph Debugger, and Instruments. Use for crashes, retain-cycle inspection, hangs, build failures, and generic CPU, memory, energy, or network profiling. Use ios-memgraph-analysis for .memgraph capture, leaks CLI ownership paths, or persistent heap growth; use ios-ettrace-performance for ETTrace capture and JSON.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Debugging and Instruments

Keep interactive graph and Instruments triage here. Route detailed `.memgraph`
command-line ownership/growth analysis and ETTrace work to their focused skills.

## Contents

- [LLDB Debugging](#lldb-debugging)
- [Memory Debugging](#memory-debugging)
- [Hang Diagnostics](#hang-diagnostics)
- [Build Failure Triage](#build-failure-triage)
- [Instruments Overview](#instruments-overview)
- [Common Mistakes](#common-mistakes)
- [Review Checklist](#review-checklist)
- [References](#references)

## LLDB Debugging

Start with a small, repeatable workflow:

1. Reproduce in a Debug build and stop at the narrowest useful breakpoint.
2. Inspect locals without executing code, then capture the current stack.
3. Move to the relevant frame or thread and verify the failing state.
4. Add a condition or watchpoint only when the bad transition is still unclear.

```text
(lldb) br set -f ViewModel.swift -l 42     # Stop at file and line
(lldb) v myLocal                           # Inspect without executing code
(lldb) po myObject                         # Use debugDescription when needed
(lldb) bt all                              # Capture every thread's backtrace
(lldb) frame select 3                      # Inspect a relevant frame
(lldb) br modify 1 -c "count > 10"         # Narrow a noisy breakpoint
(lldb) w set v self.score                  # Stop on an unexpected write
```

Use `v` over `po` when you only need a local variable value, it does not
execute code and cannot trigger side effects. Expression evaluation can execute
or mutate program state, and hardware watchpoints are scarce, so use both
deliberately.

Load [references/lldb-patterns.md](references/lldb-patterns.md) for the complete
inspection, breakpoint/logpoint, expression, watchpoint, thread navigation, and
symbolic-breakpoint command tables.

## Memory Debugging

### Memory Graph Debugger Workflow

The rest: https://github.com/dpearson2699/swift-ios-skills/blob/HEAD/skills/debugging-instruments/SKILL.md
