Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fewer <anonymous> functions in stack traces? #93

Open
swankjesse opened this issue Sep 25, 2021 · 4 comments · May be fixed by quickjs-ng/quickjs#844
Open

Fewer <anonymous> functions in stack traces? #93

swankjesse opened this issue Sep 25, 2021 · 4 comments · May be fixed by quickjs-ng/quickjs#844

Comments

@swankjesse
Copy link

swankjesse commented Sep 25, 2021

Here’s a program that makes a stack trace:

var dog = {};
dog.bark = function() {
  throw new Error('woof woof');
};
function makeStack() {
  try {
    dog.bark();
  } catch (error) {
    return error.stack;
  }
}
makeStack();

This is what QuickJS makes:

    at <anonymous> (file.js:3)
    at makeStack (file.js:7)
    at <eval> (file.js:12)

And Chrome:

Error: woof woof
    at Object.dog.bark (file.js:3:9)
    at makeStack (file.js:7:9)
    at file.js:12:1

And Firefox:

[email protected] eval code:3:9
[email protected] eval code:7:9
@file.js eval code:12:1

Both Chrome and Firefox include dog.bark in the stack trace, but in QuickJS this function is <anonymous>.

Getting the function name in the output is super handy. This example is trivial, but my real program has deep stacks full of <anonymous> and it slows down debugging.

@swankjesse
Copy link
Author

(QuickJS still puts Safari to shame though!)

@
makeStack@
global code@
evaluateWithScopeExtension@[native code]
@
_wrapCall@

@wanhongbo
Copy link

Is there any progress on this issue?

@chqrlie
Copy link
Collaborator

chqrlie commented Apr 11, 2022 via email

@wanhongbo
Copy link

wanhongbo commented Apr 13, 2022

function makeStack() { try { this.xxxx() } catch (error) { console.log(error.stack) console.log(error.message) } } makeStack();

The above code does not display xxxx in call stack when it fails :(

TooTallNate pushed a commit to TooTallNate/quickjs that referenced this issue Dec 18, 2023
The removal of the high-precision but non-standard clock source in
commit 5af98ca broke microbench because Date.now() is not granular
enough for the benchmark runner to make forward progress.

This commit adds a new method to the os module that returns time
with microsecond precision.
@gengjiawen gengjiawen linked a pull request Jan 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants