When GDB tells you "value optimized out" or your breakpoints land on the wrong line, this is what you need. It walks through choosing between -O0, -Og, and -O2 with debug symbols, explains why variables disappear in optimized code and how to work around it, and covers practical techniques like reading inlined frames, using scheduler-locking for multithreaded stepping, and split-DWARF for faster link times. The workflow is organized by problem type rather than tool feature, which makes it easy to jump to the right section when you're stuck. Best for anyone debugging RelWithDebInfo builds or trying to diagnose production crashes where you only have -O2 binaries with debug info.

skills.sh installs
579
GitHub stars
279
last updated
Aug 21, 2026

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill debug-optimized-builds --agent claude-code

Installs into .claude/skills of the current project.

Files

Debugging Optimized Builds

Purpose

Guide agents through debugging code compiled with optimization: choosing the right debug-friendly optimization level, reading inlined frames, diagnosing "value optimized out", using split-DWARF for faster debug builds, and applying GDB techniques specific to optimized code.

Triggers

  • "GDB says 'value optimized out' — what does that mean?"
  • "How do I debug a release build?"
  • "How do I see inlined function frames in GDB?"
  • "What's the difference between -O0 and -Og for debugging?"
  • "How do I use RelWithDebInfo with CMake?"
  • "Breakpoints in optimized code land on wrong lines"

Workflow

1. Choose the right build configuration

Goal?
├── Full debuggability, no optimization
│   → -O0 -g                        (slowest, all vars visible)
├── Debuggable, some optimization (recommended for most dev work)
│   → -Og -g                        (-Og keeps debug experience good)
├── Release build with debug info (shipped, debuggable crashes)
│   → -O2 -g -gsplit-dwarf          (or -O2 -g1 for lighter info)
└── Full release (no debug symbols)
    → -O2 -DNDEBUG

Sponsors

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
Categories
Release Management, Debugging
First seen
Jun 3, 2026

More from mohitmishra786/low-level-dev-skills

All 54
1jshchnz avatarschedulerjshchnz/claude-code-schedulerSchedules Claude Code tasks to run automatically at specific times using native OS schedulers (launchd on macOS, crontab on Linux, Task Scheduler on Windows). H574skills.sh installs
2bobmatnyc avatargit-workflowbobmatnyc/claude-mpm-skillsEssential Git patterns for effective version control, eliminating redundant Git guidance per agent.568skills.sh installs
3mohitmishra786 avatarrustc-basicsmohitmishra786/low-level-dev-skillsRust compiler skill for systems programming. Use when selecting RUSTFLAGS, configuring Cargo profiles, tuning release builds, reading assembly or MIR output, un567skills.sh installs
4rshankras avatarproduct-developmentrshankras/claude-code-apple-skillsEnd-to-end product development for iOS/macOS apps. Covers market research, competitive analysis, PRD generation, architecture specs, UX design, implementation g564skills.sh installs
5pedronauck avatarqa-executionpedronauck/skillsRuns real-user dogfooding sessions through the product's public interfaces: a persona walks a journey in the browser, takes a thematic tour, probes edges, hunts559skills.sh installs
6libukai avatarvscode-sftp-configlibukai/awesome-agent-skillsThis skill should be used when setting up SFTP deployment for static websites to production servers, including converting projects from Docker/Express to static557skills.sh installs