Skip to content

docs: add macOS + Go SIP gotcha for dlv --pid#17

Merged
AlmogBaku merged 3 commits intomasterfrom
docs/dlv-pid-sip-gotcha
Mar 14, 2026
Merged

docs: add macOS + Go SIP gotcha for dlv --pid#17
AlmogBaku merged 3 commits intomasterfrom
docs/dlv-pid-sip-gotcha

Conversation

@AlmogBaku
Copy link
Copy Markdown
Owner

Summary

  • Adds an inline gotcha note after the --pid bullet in the "Starting a Session" section of skills/debugging-code/SKILL.md
  • Warns that dlv --pid requires SIP disabled (csrutil disable) on macOS
  • Recommends starting the program under the debugger as the preferred alternative
  • Provides a fallback using dlv exec --headless + dap debug --attach for cases where attaching to an already-running process is unavoidable

Test plan

  • Tests pass (go test ./...)
  • Read the skill and verify the note reads naturally in context

🤖 Generated with Claude Code

Inline note after the --pid bullet warning that dlv attach requires SIP
disabled on macOS, with preferred alternatives (start under debugger, or
restart under dlv headless server mode).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Document macOS SIP requirement and debugging best practices

📝 Documentation

Grey Divider

Walkthroughs

Description
• Adds macOS SIP gotcha warning for dlv --pid debugging
• Documents requirement to disable SIP with csrutil disable
• Recommends preferred alternatives for process attachment
• Adds debugging best practices for breakpoints and user journey
Diagram
flowchart LR
  A["Debugging Code Skill"] --> B["Add macOS SIP Gotcha"]
  A --> C["Add Debugging Best Practices"]
  B --> D["dlv --pid SIP Warning"]
  B --> E["Alternative Approaches"]
  C --> F["Breakpoint Strategy Tips"]
  C --> G["User Journey Mimicking"]
Loading

Grey Divider

File Changes

1. skills/debugging-code/SKILL.md 📝 Documentation +11/-0

Add SIP gotcha and debugging best practices

• Adds inline warning about dlv --pid requiring disabled SIP on macOS after the process attachment
 bullet
• Recommends preferring to start program under debugger or use remote debugger attachment
• Adds new "Mimic the user journey" debugging best practice section
• Adds "Set breakpoints instead of prints" debugging tip
• Adds blank lines for improved formatting around code blocks

skills/debugging-code/SKILL.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented Mar 14, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Wrong macOS Go guidance🐞 Bug ✓ Correctness
Description
SKILL.md claims macOS Go PID attach requires disabling SIP via csrutil disable and refers to `dlv
--pid, but dap debug --pid uses Delve DAP mode (dlv dap`) and the repo’s documented macOS
prerequisite is DevToolsSecurity -enable. This can mislead users into following ineffective and
security-reducing steps.
Code

skills/debugging-code/SKILL.md[R68-69]

+  > **macOS + Go gotcha:** `dlv --pid` requires SIP disabled (`csrutil disable`).
+  > Prefer starting the program under the debugger instead or attaching to a remote debugger!
Evidence
The new note instructs SIP disabling and references dlv --pid, but the implementation spawns Delve
via dlv dap and performs a macOS Developer Tools security check; additionally, existing repo docs
already call out DevToolsSecurity -enable as the macOS permission gotcha for Delve, not SIP.

skills/debugging-code/SKILL.md[66-69]
backend.go[173-183]
backend.go[270-277]
backend.go[280-293]
skills/debugging-code/references/installing-debuggers.md[15-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new SKILL.md gotcha claims macOS Go PID attach requires disabling SIP (`csrutil disable`) and references `dlv --pid`, but this repo attaches via Delve DAP mode (`dlv dap`) and already documents/enforces `DevToolsSecurity -enable` as the macOS permission prerequisite.
## Issue Context
- `dap debug --pid` uses backend-specific DAP attach args; for dlv it is `request: launch`, `mode: local`, `processId: &amp;lt;pid&amp;gt;`.
- On macOS, the dlv backend runs `checkMacOSDevMode()` and instructs `sudo DevToolsSecurity -enable` when disabled.
- Existing skill reference docs already mention `DevToolsSecurity -enable` for macOS.
## Fix Focus Areas
- skills/debugging-code/SKILL.md[66-69]
## Suggested doc replacement (example)
Replace the SIP note with something like:
&amp;gt; **macOS + Go gotcha (dlv):** local debugging/attach may require Developer Tools security enabled (`sudo DevToolsSecurity -enable`). If you can, prefer starting the program under the debugger or attach to a remote dlv DAP server.
(Optionally link to the existing reference doc under `skills/debugging-code/references/installing-debuggers.md`.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread skills/debugging-code/SKILL.md
dlv attach uses dlv dap mode; the actual macOS prerequisite is
sudo DevToolsSecurity -enable (enforced by checkMacOSDevMode()),
not csrutil disable (SIP). Also simplify the fallback to just the
preferred alternative.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AlmogBaku
Copy link
Copy Markdown
Owner Author

Fixed in da4b8e4. Verified against codebase: dap debug --pid uses dlv dap mode (not a standalone dlv --pid), and checkMacOSDevMode() already enforces sudo DevToolsSecurity -enable. The SIP/csrutil reference was incorrect — updated the note accordingly.

@AlmogBaku AlmogBaku merged commit f9f720b into master Mar 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant