views:

77

answers:

4

I have a function, say f(args), that is being called from many places in my code.

When args is undefined f() throws an exception.

I would like to identify who called f() with the undefined parameter.

What would be the easiest way to find the exact line (file name + line number) that called f() ?

Is that possible to see the caller in Firebug ?

+4  A: 

yes. When you breakpoint it. In stack. between watch and breakpoints

Falcon
Thanks a lot !!
Misha Moroshko
A: 

If you set a breakpoint in IE developer toolbar, when the breakpoint is hit, you can see the call stack from th script tab, then select the call stack tab on the right. you can click on each stage of the call stack to navigate and inspect all the callers, etc.

David
A: 

Usually caller you can get with keyword this. But this won't if you call method on specified object( obj.doSomething() )

Miro
A: 

If you need this information without any tool, with a piece of code:

Check out this question

Also,

HERE's an example of writing a backtrace. You could use this for getting the whole trace. (for example if you need the caller of the caller)

SinistraD