Loading...
Loading...
Compare original and translation side by side
dapdapbash <(curl -fsSL https://raw.githubusercontent.com/AlmogBaku/debug-skill/master/install.sh)dapdap --helpdap <cmd> --helpdapdapbash <(curl -fsSL https://raw.githubusercontent.com/AlmogBaku/debug-skill/master/install.sh)dapdap --helpdap <cmd> --helpdap debug <file>dap debug script.py --break script.py:42--break src/api/routes.py:55 --break src/models/user.py:30dap debug script.py --stop-on-entrydap debug script.py --break-on-exception raisedalldap debug --attach host:port --backend <name>--session <name>$CLAUDE_SESSION_ID--session myappdap debug --helpdap debug <file>dap debug script.py --break script.py:42--break src/api/routes.py:55 --break src/models/user.py:30dap debug script.py --stop-on-entrydap debug script.py --break-on-exception raisedalldap debug --attach host:port --backend <name>--session <name>$CLAUDE_SESSION_ID--session myappdap debug --helpdapStopped at compute() · script.py:41
39: def compute(items):
40: result = None
> 41: return result
Locals: items=[] result=None
Stack: main [script.py:10] → compute [script.py:41]
Output: (none)Program terminated · Exit code: 1--stop-on-entrydapStopped at compute() · script.py:41
39: def compute(items):
40: result = None
> 41: return result
Locals: items=[] result=None
Stack: main [script.py:10] → compute [script.py:41]
Output: (none)Program terminated · Exit code: 1--stop-on-entry--break f:20 --break f:60--break f:20 --break f:60dap step # step over — trust this call, advance to next line
dap step in # step into — suspect what's inside this function
dap step out # step out — you're in the wrong place, return to caller
dap continue # jump to next breakpoint
dap context # re-inspect current state without stepping (after continue)
dap output # drain buffered stdout/stderr without full contextstep infile:linedap eval "<expr>"dap eval "len(items)"
dap eval "user.profile.settings"
dap eval "expected == actual" # test hypothesis on live state
dap eval "self.config" --frame 1 # frame 1 = caller (may be a different file)dap step --helpdap eval --helpdap step # 单步跳过——信任当前调用,前进到下一行
dap step in # 单步进入——怀疑当前函数内部存在问题
dap step out # 单步退出——你进入了错误的位置,返回到调用方
dap continue # 跳转到下一个断点
dap context # 重新检查当前状态,不需要执行单步(在continue之后使用)
dap output # 输出缓冲区的stdout/stderr内容,不需要返回完整上下文step infile:linedap eval "<expr>"dap eval "len(items)"
dap eval "user.profile.settings"
dap eval "expected == actual" # 在实时状态上验证你的假设
dap eval "self.config" --frame 1 # frame 1 = 调用方(可能属于不同文件)dap step --helpdap eval --helpcompute()NoneHypothesis: result not assigned before return
→ dap debug script.py --break script.py:41
Locals: result=None, items=[] ← wrong, and input is also empty
New hypothesis: caller passing empty list
→ dap eval "items" --frame 1 → [] ← confirmed
→ dap step out → caller at line 10, no guard for empty input
Root cause: missing guard. Fix → dap stop.Exception: TypeError, location unknown
→ dap debug script.py --break-on-exception raised
Stopped at compute():41, items=None
Root cause: None passed where list expected.compute()None假设:result在返回前没有被赋值
→ dap debug script.py --break script.py:41
局部变量:result=None, items=[] ← 错误,而且输入也为空
新假设:调用方传入了空列表
→ dap eval "items" --frame 1 → [] ← 验证成立
→ dap step out → 调用方在第10行,没有空输入的防护逻辑
根因:缺少输入校验。修复后 → dap stop。异常:TypeError,位置未知
→ dap debug script.py --break-on-exception raised
在compute():41暂停,items=None
根因:期望传入列表的位置传入了None。dap stop # default session
dap stop --session myapp # named sessiondap stop # 默认会话
dap stop --session myapp # 命名会话