我是 FireBug Debugger 的新手,任何人都可以说什么是步入、跨步和退出
问问题
33514 次
4 回答
148
- Step into将导致调试器下降到当前行上的任何方法调用。如果有多个方法调用,它们会按执行顺序被访问;如果没有方法调用,这与 step over 相同。这大致相当于按照解释器所看到的每一行执行。
- Step over继续到您当前范围内的下一行(即它转到下一行),而不会在途中下降到任何方法调用。这通常用于通过特定方法遵循逻辑,而不用担心其合作者的细节,并且可以用于查找方法中的哪个点违反了预期条件。
- Step out继续进行,直到下一个“返回”或等效项 - 即直到控制返回到前一个堆栈帧。这通常在您已经看到此时/方法所需的所有内容时使用,并且想要将堆栈冒泡几层到实际使用值的位置。
想象一下下面的代码,它通过输入main()
,现在位于 的第一行bar
:
function main() {
val s = foo();
bar(s);
}
function foo() {
return "hi";
}
function bar(s) {
val t = s + foo(); // Debugger is currently here
return t;
}
然后:
- Step into 将进入
foo
呼叫,然后当前行将成为return "hi";
内的行foo
。 - 跳过将忽略正在调用另一个方法的事实,并将继续执行该
return t;
行(这使您可以快速查看t
评估的内容)。 - Step out 将完成方法的其余部分的执行
bar
,控制将返回到main
方法的最后一行。
于 2011-03-22T13:08:29.553 回答
23
Step Into 将导致调试器进入下一个函数调用并在那里中断。
Step Over 将告诉调试器执行下一个函数并在之后中断。
Step Out 将告诉调试器完成当前函数并在它之后中断。
于 2011-03-22T13:08:47.743 回答
5
简短的版本是,step into
带你进入当前行调用的函数(假设正在调用一个函数),step out
带你回到你决定step into
一个函数时的位置,然后step over
移动到下一行代码。例如:
window.someFunction = function() {
var x = 10; //step over to move to the next line
//step out to return to the line after where 'someFunction()' was called
//step into not available
var y = 20;
return x * y;
};
//set breakpoint here
var x = 7; //step over to execute this line and move to the
//next (step into and step out not available)
x += someFunction(); //step over to move to the next line
//step into to move to someFunction() (above)
//step out not available
alert(x); //step over to display the alert
//step out and (probably) step into not available
于 2011-03-22T13:13:48.793 回答
4
- step into -> 进入子程序并等待下一个动作
- 跳过 -> 跳过子程序而无需再次等待
- step out -> 如果您在子程序中,您将离开它而无需再次等待
于 2011-03-22T13:07:50.897 回答