debugging-instruments

Debugs iOS app crashes, memory leaks, and main-thread hangs via LLDB and Instruments.

Updated May 6, 2026
One-click install
npx skills add https://github.com/Roy-wonji/claude-config --skill debugging-instruments-roy-wonji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debugging-instruments
Source: https://github.com/Roy-wonji/claude-config/tree/main/skills/swift-ios-skills/skills/debugging-instruments
Command: npx skills add https://github.com/Roy-wonji/claude-config --skill debugging-instruments-roy-wonji

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps you diagnose iOS app crashes, memory leaks/retain cycles, main-thread hangs, and performance bottlenecks by combining LLDB inspection, Memory Graph Debugger, and Instruments profiling.

Core Features & Use Cases

  • LLDB Debugging Playbook: Backtraces, breakpoint/watcher patterns, and safe inspection techniques (e.g., prefer v over po when you want to avoid side effects).
  • Memory Debugging Workflow: Memory Graph leak detection with guidance on enabling Malloc Stack Logging to recover allocation origins.
  • Hang & Build Triage: Main-thread hang identification, Time Profiler usage, and practical steps for reading compiler diagnostics and resolving SPM/module/linker issues.
  • Instruments Profiling Toolkit: Choosing the right Instruments template (CPU/Time Profiler, Allocations/Leaks, Network, SwiftUI, Core Animation, Energy, etc.) and using xctrace in repeatable profiling loops.

Quick Start

Diagnose a suspected memory leak by running the app in Debug, enabling Malloc Stack Logging, reproducing the leak, and then opening the Memory Graph from Xcode to identify leaked objects and their reference graphs.

Frequently Asked Questions about debugging-instruments

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find a retain cycle or memory leak in an iOS app using Memory Graph Debugger?

To find a memory leak, run your app in Debug, enable Malloc Stack Logging to recover allocation origins, reproduce the leak, and open the Memory Graph from Xcode to identify leaked objects and their reference graphs.

What is the best way to profile CPU and energy bottlenecks in iOS applications?

The best way to profile performance bottlenecks is selecting the correct Instruments template like CPU/Time Profiler or Energy, and using xctrace in repeatable profiling loops to measure CPU, memory, energy, and network usage.

How do I use LLDB commands to inspect iOS crashes and set breakpoints without side effects?

You can inspect iOS crashes by using LLDB commands for breakpoints, watchpoints, and expression evaluation. Prefer the `v` command over `po` when you want to inspect variables while avoiding side effects.

How do I identify and debug main-thread hangs in an iOS application?

Identify main-thread hangs by triaging with Time Profiler usage and main-thread hang detection techniques. This workflow pinpoints UI blockages and helps resolve performance issues causing unresponsive interfaces.

Can Instruments profiling and LLDB work together to diagnose both crashes and performance bottlenecks?

Yes, you can combine LLDB inspection for breakpoints and crash backtraces with Instruments profiling templates for CPU and memory. This integrated workflow diagnoses both functional crashes and performance bottlenecks effectively.

Why do I need Malloc Stack Logging enabled when debugging iOS memory leaks?

Malloc Stack Logging is required because it recovers allocation origins for leaked objects. Without it, the Memory Graph Debugger can show leaked objects and their reference graphs but cannot trace where the allocation occurred.