如何在firebug中导致调试中断 [英] How to cause a debug break in firebug

查看:131
本文介绍了如何在firebug中导致调试中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当检测到错误时,我试图使firebug中断。具体来说,我的代码中有一些内部检查,如断言,我希望firebug在失败时停止。我尝试过几种不同的方式,想知道别人怎么做?以下是我尝试过的方法:

I am trying to make firebug break when an error is detected. Specifically, I have some internal checks in my code, like assertions, that I want firebug to stop on when they fail. I have tried a few different ways and wondered what other people do? Here are the ways I have tried:


  1. 放入一些无效的代码,以便如果错误出来:
    function assert(value) {if(!value)dbgbreak(); } //因为dbgbreak未定义而失败

这样做有些不一样,但是并没有停止代码,所以我可以看到堆栈或检查局部变量。

This works somewhat, but does not stop the code in such a way that I can see the stack or examine local variables.


  1. 有一个exeption:
    函数assert(value){if ! value)throw AssertExecption(); }

这是比较漂亮的,但是当我跟踪例外时,我看不到堆栈或本地人

This is prettier, but still when I track exceptions I can't see the stack or the locals


  1. 在断言失败时放置一个断点。但是,这意味着每次运行我的代码时,我必须手动放入一堆断点。

其他人在处理调试器和断言方面,做类似的一致性检查?

What do other people do in terms of working with the debugger and asserts, and similar consistency checks?

推荐答案

你是否尝试扔掉调试器关键字在脚本中你想要停止?

Have you tried throwing down the "debugger" keyword in your script where you want it to stop?

这篇关于如何在firebug中导致调试中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆