【发布时间】:2014-02-04 14:16:53
【问题描述】:
node.js help 命令输出如下:
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, restart, kill, list, scripts, breakOnException, breakpoints, version
我可以使用setBreakpoint添加一个新断点:
debug> setBreakpoint(12)
...
但是我可以让它有条件吗?例如:
*only if `foo() === true`, stop here*
替代方法是将其添加为脚本中的if:
if (foo()) { debugger; }
这可以通过 NodeJS 调试器实现吗?
【问题讨论】:
标签: node.js debugging conditional-breakpoint