Dart有一个“断点”语句吗? [英] Does Dart have a 'breakpoint' statement?
问题描述
在Dart中有一个语句使调试器在调试时不设置断点而暂停?
Is there a statement in Dart to make the debugger halt without setting a breakpoint while debugging?
有些情况下, 。我遇到这个例如简化远程调试,以确保执行停止提前,然后我可以使用调试器添加更多的断点。
There are situations where it would be helpful be able to hardcode a breakpoint. I run into this for example to simplify remote debugging, to ensure the execution stops early and then I can add further breakpoints using the debugger.
推荐答案
刚刚介绍了
(Dart VM version:1.11.0-edge.131775(Tue Jun 2 14:25:22 2015)onlinux_x64)
This was just introduced (Dart VM version: 1.11.0-edge.131775 (Tue Jun 2 14:25:22 2015) on "linux_x64")
import 'dart:developer';
void main() {
debugger();
// or
debugger(msg: 'because I say so');
}
还有一个条件变式
// Debugger.breakHereIf(bool expr); // current
debugger(when: somethingIsTrue, msg: 'investigate'); // later
另请参阅 Dartium中的断点不工作如何使用Dartiums调试器。
See also Breakpoints in Dartium not working for how to use Dartiums debugger.
这篇关于Dart有一个“断点”语句吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!