Javascript Firebug 中的 step into、step out 和 step over 是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5391684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is step into, step out and step over in Firebug?
提问by akila
I am new to FireBug Debugger can anyone say what is step into,step over and step out
我是 FireBug Debugger 的新手,任何人都可以说是什么是步入、步入和步出
回答by Andrzej Doyle
- Step intowill cause the debugger to descend into any method calls on the current line. If there are multiple method calls, they'll be visited in order of execution; if there are no method calls, this is same as step over. This is broadly equivalent to following every individual line of execution as would be seen by the interpreter.
- Step overproceeds to the next line in your current scope (i.e. it goes to the next line), without descending into any method calls on the way. This is generally used for following the logic through a particular method without worrying about the details of its collaborators, and can be useful for finding at what point in a method the expected conditions are violated.
- Step outproceeds until the next "return" or equivalent - i.e. until control has returned to the preceding stack frame. This is generally used when you've seen all you need to at thispoint/method, and want to bubble up the stack a few layers to where the value is actually used.
- Step into将导致调试器下降到当前行上的任何方法调用。如果有多个方法调用,则按执行顺序访问;如果没有方法调用,这与 step over 相同。这大致相当于遵循解释器所看到的每个单独的执行行。
- 步骤在进入到在当前的范围(即它进入到下一行)的下一行,而不会降入的道路上的任何方法调用。这通常用于通过特定方法遵循逻辑而无需担心其协作者的详细信息,并且对于查找违反预期条件的方法中的哪一点很有用。
- Step out继续进行直到下一个“返回”或等价物 - 即直到控制返回到前一个堆栈帧。当你看到所有你需要在这通常使用这种点/方法,并希望泡了堆几层其中值实际上是用来。
Imagine the following code, which entered through main()
and is now on the first line of bar
:
想象一下以下代码,它通过输入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;
}
Then:
然后:
- Step into will proceed into the
foo
call, and the current line will then become thereturn "hi";
line withinfoo
. - Step over will ignore the fact that another method is being invoked, and will proceed to the
return t;
line (which lets you quickly see whatt
is evaluated as). - Step out will finish the execution of the rest of the
bar
method, and control will return to the last line of themain
method.
- Step into 将进入
foo
呼叫,然后当前行将成为 内的return "hi";
行foo
。 - Step over 将忽略正在调用另一个方法的事实,并将继续执行该
return t;
行(它可以让您快速查看t
评估的内容)。 - Step out 将完成该
bar
方法其余部分的执行,并且控制将返回到该main
方法的最后一行。
回答by SLaks
Step Into will cause the debugger to go into the next function call and break there.
Step Over will tell the debugger to execute the next function and break afterwards.
Step Out will tell the debugger to finish the current function and break after it.
Step Into 将导致调试器进入下一个函数调用并在那里中断。
Step Over 将告诉调试器执行下一个函数并在之后中断。
Step Out 将告诉调试器完成当前函数并在它之后中断。
回答by aroth
The short version is, step into
takes you inside of the function being called on the current line (assuming one is being called), step out
takes you back to where you were when you decided to step into
a function, and step over
just moves to the next line of code. For example:
简短的版本是,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
回答by Billy Moon
- step into -> go into the subroutine and wait for next action
- step over -> jump over the subroutine without waiting again
- step out -> if you are in the subroutine, you will leave it without waiting again
- step into -> 进入子程序,等待下一步动作
- step over -> 跳过子程序,无需再次等待
- step out -> 如果你在子程序中,你会离开它,不再等待