跳转到内容

Breakpoint

“Breakpoint” 由 break(中断)+ point(点)构成。在 debugger 中设置 breakpoint 后,程序运行到该行会暂停,便于检查变量、调用栈与内存状态。也可指响应式设计中的屏幕宽度断点。

  1. “Set a breakpoint on the function that handles user input.” (在处理用户输入的函数上设断点。)
  2. “The conditional breakpoint only stops when count exceeds 100.” (条件断点仅在 count 超过 100 时暂停。)
  3. “CSS media queries use breakpoints to adapt layouts.” (CSS 媒体查询用断点适配布局。)

复合词 break + point,20 世纪随着交互式调试器普及进入日常开发词汇。

“break” + “point”:执行流被 break 下来的那个 point。

IDE 中点击行号即可 toggling breakpoint;条件断点、日志断点是高级调试技巧。

  • 固定搭配: “set a breakpoint” (设置断点), “conditional breakpoint” (条件断点), “breakpoint debugging” (断点调试)
  • 动词: break (execution)

程序跑到某 point 就 break 停住——breakpoint。

“At the breakpoint, he saw the loop variable was never incremented and fixed the off-by-one bug.” (在断点处他发现循环变量从未递增,修掉了差一错误。)