debugging-instruments

Diagnose iOS crashes, memory leaks, and hangs using LLDB and Instruments.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/KumarAdi8/AgentKit --skill debugging-instruments-kumaradi8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debugging-instruments
Source: https://github.com/KumarAdi8/AgentKit/tree/main/skills/debugging-instruments
Command: npx skills add https://github.com/KumarAdi8/AgentKit --skill debugging-instruments-kumaradi8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Quickly identify and resolve crashes, memory leaks, retain cycles, main-thread hangs, and performance regressions in iOS apps by prescribing effective debugging and profiling workflows with LLDB, Xcode's Memory Graph, and Instruments.

Core Features & Use Cases

  • LLDB workflows: targeted breakpoints, watchpoints, expression evaluation, and frame navigation to inspect runtime state and reproduce failures.
  • Memory debugging: Memory Graph Debugger, malloc stack logging, common retain-cycle patterns, and Instruments Allocations/Leaks templates to locate and fix leaks.
  • Hang and performance analysis: Time Profiler, Core Animation, SwiftUI, Network, Energy Log templates, xctrace CLI for CI, and signposts integration for correlating application events with traces.
  • Build failure triage and diagnostics: reading compiler output, resolving SPM issues, and troubleshooting linker/module errors to restore a reproducible debug build.
  • Use case: Reproduce a UI hang on a device, record a Time Profiler trace, identify a heavy main-thread function via the call tree, and convert that finding into a concrete refactor plan to move blocking work off the main thread.

Quick Start

Use this skill to analyze a reproducible memory leak by running Allocations and Leaks in Instruments, capturing malloc stack traces, inspecting the reference graph, and recommending code changes.

Frequently Asked Questions about debugging-instruments

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

FAQPage Schema
How do I find memory leaks and retain cycles in my iOS app?

To diagnose iOS UI hangs and performance regressions, record a Time Profiler or Core Animation trace in Instruments, inspect the call tree to identify heavy main-thread functions, and move blocking work off the main thread.

What is the best way to debug an iOS crash using LLDB?

To collect performance profiling traces in CI environments, use the xctrace CLI tool to automate trace collection on physical devices, exporting trace files for postmortem analysis of crashes, hangs, and regressions.

Can I use xctrace to collect Instruments traces in a CI pipeline?

Yes, you can use xctrace CLI to automate Instruments trace collection in CI pipelines, recording Time Profiler and Allocations templates on physical devices to export trace files for postmortem performance and leak analysis.

Why does my iOS app hang on the main thread and how can I profile it?

iOS main-thread hangs occur when blocking work occupies the main thread; profile them by recording a Time Profiler trace in Instruments, inspecting the call tree for heavy functions, and moving blocking work to background queues.

Do I need malloc stack logging enabled to trace iOS memory allocations?

Yes, enabling malloc stack logging is required to trace iOS memory allocations because it captures allocation backtraces needed by the Memory Graph Debugger and Instruments Leaks templates to locate retain cycles and leaks.

Does the Memory Graph Debugger work with exported trace files for postmortem analysis?

The Memory Graph Debugger works with exported memory graphs for postmortem analysis by loading retain graphs and malloc stack logs to locate common retain-cycle patterns and produce actionable code remediation steps.