Skip to content

Instantly share code, notes, and snippets.

@ripper234
Created May 10, 2011 23:25
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ripper234/965603 to your computer and use it in GitHub Desktop.
Save ripper234/965603 to your computer and use it in GitHub Desktop.
// original (broken) version is here: http://ivan-ghandhi.livejournal.com/942493.html
// My fix: don't treat arguments as if it were an array
// (Use Array.prototype.slice.call() to convert it)
function stacktrace() {
function st2(f) {
return !f ? [] :
st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + Array.prototype.slice.call(f.arguments).join(',') + ')']);
}
return st2(arguments.callee.caller);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment