/* STH: 3/7-2008, Version 1.0 */ function showCallStack(){ var f=showCallStack,result="Call stack:\n"; while((f=f.caller)!==null){ var sFunctionName = f.toString().match(/^function (\w+)\(/) sFunctionName = (sFunctionName) ? sFunctionName[1] : 'anonymous function'; result += sFunctionName; result += getArguments(f.toString(), f.arguments); result += "\n"; } if (confirm(result+'\n\nDo you wish to start debugger now?')) { debugger; } } function getArguments(sFunction, a) { var i = sFunction.indexOf(' '); var ii = sFunction.indexOf('('); var iii = sFunction.indexOf(')'); var aArgs = sFunction.substr(ii+1, iii-ii-1).split(',') var sArgs = ''; for(var i=0; i0) ? ', ' : '')+(typeof a[i])+' '+aArgs[i]+':'+q+a[i]+q+''; } return '('+sArgs+')'; }