Skip to content

Conversation

@chqrlie
Copy link
Collaborator

@chqrlie chqrlie commented Mar 25, 2024

  • fix more cases of missing sf->cur_pc.
  • use more precise error messages for number conversion methods
  • add test cases in test_builtin.js

chqrlie added 2 commits March 25, 2024 21:55
- fix more cases of missing `sf->cur_pc`.
- use more precise error messages for number conversion methods
- add test cases in test_builtin.js
Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a question. Now that you covered all cases, does it make sense to still set cur_pc in the exception: label? If not, shall we skip it and add a check-abort?

at <eval> (stack-traces.js:291:49)
): expected <true> found <false>
Failure (UnintendedCallerCensorship didn't contain new ReferenceError): expected <true> found <false>
Failure: expected <"abc"> found <undefined>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, how did this come back?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I am investigating this, but won't have much time until tonight.
We should have a more complete emulation of the v8 error handling:

  • the stack trace should be computed by a v8 specific function Error.captureStackTrace, which is non-standard but is quite handy for introspection. It takes an object as argument and sets its stack property to a the stack trace string, and an optional second argument which is an array of frames.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually already implemented that here in this fork! :-)

555d837
4c929c5

}
}

function test_cur_pc()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@chqrlie
Copy link
Collaborator Author

chqrlie commented Mar 26, 2024

LGTM with a question. Now that you covered all cases, does it make sense to still set cur_pc in the exception: label? If not, shall we skip it and add a check-abort?

Yes, sf->cur_pc must still be set in the exception: label because it is needed for the non recursive cases where an exception is thrown directly from JS_CallInternal or indirectly by a c function without recursing to a javascript function.

Conversely, we might want to initialize sf->cur_pc to pc instead of null to avoid crashing in production on a case where the synchronisation is missing and keep the sf->cur_pc = NULL as an ifdef's debugging alternative for a specific CI target.

@saghul
Copy link
Contributor

saghul commented Mar 26, 2024

Conversely, we might want to initialize sf->cur_pc to pc instead of null to avoid crashing in production on a case where the synchronisation is missing and keep the sf->cur_pc = NULL as an ifdef's debugging alternative for a specific CI target.

TBH I'd rather abort hard so it's easy to catch, fix and be done with it...

@chqrlie
Copy link
Collaborator Author

chqrlie commented Mar 26, 2024

Conversely, we might want to initialize sf->cur_pc to pc instead of null to avoid crashing in production on a case where the synchronisation is missing and keep the sf->cur_pc = NULL as an ifdef's debugging alternative for a specific CI target.

TBH I'd rather abort hard so it's easy to catch, fix and be done with it...

In the debug target, that's fine, but in the production version, why abort when there is no user visible downside?

@chqrlie chqrlie merged commit f02ed18 into quickjs-ng:master Mar 26, 2024
@chqrlie chqrlie deleted the more-error-fixes branch March 26, 2024 12:23
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 this pull request may close these issues.

2 participants