debug
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDebug
Debug
Debug a reported issue using a structured reproduction-then-fix approach.
使用结构化的「复现-修复」方法调试已上报的问题。
Phase 1: Reproduction & Root Cause Analysis
第一阶段:复现与根本原因分析
- Investigate — Analyze the bug report for key symptoms and error messages
- Trace — Search the codebase for error occurrence patterns, trace from symptom to source
- Root cause — Identify the root cause through data flow analysis and edge case checking
- Reproduce — Create a minimal failing test case that reproduces the exact error
- Document — Clearly document the root cause and reproduction steps
- 调查 — 分析bug报告中的关键症状和错误信息
- 追踪 — 在代码库中搜索错误出现的模式,从症状追溯到根源
- 根本原因 — 通过数据流分析和边缘情况检查确定根本原因
- 复现 — 创建一个最小化的失败测试用例,精准复现该错误
- 记录 — 清晰记录根本原因和复现步骤
Phase 2: Fix Implementation
第二阶段:修复实施
- Plan — Analyze the optimal fix approach based on root cause, check for similar fixes in the codebase
- Implement — Make the minimal, targeted fix that addresses the root cause
- Verify — Run the failing test to confirm it passes, then run the full test suite to check for regressions
- 规划 — 根据根本原因分析最优修复方案,检查代码库中是否有类似修复案例
- 实施 — 进行最小化、针对性的修复,解决根本问题
- 验证 — 运行失败的测试用例确认其通过,然后运行完整测试套件检查是否存在回归问题
Principles
原则
- Minimal changes — Fix the bug, nothing more
- Targeted — Only touch affected code paths
- Tested — The fix must make the failing test pass and not break existing tests
- No unrelated improvements — Stay focused on the specific bug
- 最小改动 — 仅修复bug,不做额外修改
- 针对性 — 仅触及受影响的代码路径
- 可测试 — 修复必须使失败的测试用例通过,且不破坏现有测试
- 不做无关改进 — 专注于当前特定bug