0

After using functionality from this question for debugging I am wondering is there a way to get the file name from which the function was invoked and may be the line.

May be I am asking for too much, but I know that in some of the languages it is possible.

If this is not possible can anyone mention why his functionality was not implemented?

I will try to rephrase the question, because I think I didn't make myself clear.

I have file.js in which on the 17-th line there is a declaration of the function:

... function main() { Hello(); } 

I have another file test.js, where I define function hello

function Hello() { ... which tells me the name of the file and a line in which the function which evoked it was defined } 

So for example if I will call main(), it will tell me file.js, 17 line

It has nothing to do with firebug

3

2 Answers 2

1

If all your doing is debugging, hy not just use the debugger built into modern browsers?

debugger 

That line is all you need. You can examine the callstack, inspect variable values, and even run code in the current scope.

Such functionality makes your request kind of unnecessary.

Sign up to request clarification or add additional context in comments.

1 Comment

Well, then I'm about to blow your mind!
1

You don't mention what browser you are using.

In Chrome what I would suggest is inserting a breakpoint on the first line of the function. Then reload the page (or otherwise trigger the function call). When execution pauses at the breakpoint, check the Call Stack section in Chrome's Developer tools - it will give you a stack back-trace of the flow of execution.

I'm sure Firebug offers something similar if not identical, it's just been a while since I used it.

Cheers

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.