Firebug中的步骤,步骤和步骤是什么?

aki*_*ila 49 javascript firebug javascript-debugger

我是FireBug Debugger的新手,任何人都可以说是什么是步入,步出和退出

And*_*yle 112

  • Step into将导致调试器下降到当前行的任何方法调用.如果有多个方法调用,它们将按执行顺序访问; 如果没有方法调用,则与步骤相同.这大致等同于遵循解释器所看到的每个单独的执行行程.
  • 在当前范围内进行到下一行(即它进入到下一行),不降入任何方法的调用方式.这通常用于通过特定方法遵循逻辑而不必担心其协作者的细节,并且可以用于查找方法中的哪个点违反了预期条件.
  • 步骤进行前进,直到下一个"返回"或等效-即直到控制已返回到前述堆栈帧.这通常是用来当你看到所有你需要在这个点/方法,并希望泡了堆几层到值实际使用.

想象一下以下代码,它通过以下代码输入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;
}
Run Code Online (Sandbox Code Playgroud)

然后:

  • 步入将进入foo调用,然后当前行将成为其中的return "hi";foo.
  • 跳过将忽略调用另一个方法的事实,并将继续执行该return t;行(这使您可以快速查看t评估的内容).
  • 跳出将完成bar方法的其余部分的执行,并且控制将返回到方法的最后一行main.

  • 谢谢,你的解释是这里唯一对我有用的解释.如果我知道"踏入"与"正常执行"大致相同,我会更快地理解这个概念.其他两个也一样. (4认同)

SLa*_*aks 15

  • Step Into将导致调试器进入下一个函数调用并在那里中断.

  • Step Over将告诉调试器执行下一个函数并在之后中断.

  • Step Out将告诉调试器完成当前函数并在它之后中断.

  • 感谢您明确指出步骤仍然*执行*下一个函数,它只是没有在那里打破. (2认同)

aro*_*oth 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
Run Code Online (Sandbox Code Playgroud)


Bil*_*oon 4

  • 进入 -> 进入子程序并等待下一步操作
  • step over -> 跳过子例程,无需再次等待
  • step out -> 如果你在子程序中,你会离开它而无需再次等待