Skip to content

Fix an issue while debugging with static snapshots #2606

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

Conversation

DanielBallaSZTE
Copy link

@DanielBallaSZTE DanielBallaSZTE commented Nov 21, 2018

The issue was present when the executed code would have thrown an error.

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu

@DanielBallaSZTE DanielBallaSZTE force-pushed the fix_static_snapshot_exception branch from 6cc3839 to 6cb86e3 Compare November 21, 2018 13:14
Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

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

LGTM. Probably needed for backtraces as well.

@akosthekiss
Copy link
Member

What exactly is the problem this PR wants to fix, what are the steps to reproduce it? If there is a reported issue, the PR/commit should reference it. If there is no such issue then at least this PR should document it. Is there a way to make the problem tested automatically so that it does not happen again (to prevent regression)?

@akosthekiss akosthekiss added the debugger Related to the debugger label Nov 22, 2018
LaszloLango
LaszloLango previously approved these changes Nov 22, 2018
Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

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

LGTM

@LaszloLango LaszloLango dismissed their stale review November 22, 2018 07:38

Dismiss my review to prevent too early merging. Please answer the questions of @akosthekiss

@DanielBallaSZTE
Copy link
Author

DanielBallaSZTE commented Nov 22, 2018

@akosthekiss Sorry for not adding it to the PR description, going to amend it to make sure it appears there as well.
So the failure was found when debugging IoT.js with static snapshots turned on, if an error was thrown an assertion failure was caused. The reason is the frame context's bytecode_header_p pointer was not a heap pointer. The jerry_debugger_breakpoint_hit function tries to set a compressed pointer which points to bytecode_header_p with the JMEM_CP_SET_NON_NULL_POINTER macro, which has an assertion that requires the above mentioned bytecode_header_p to be a heap pointer, which is obviously not.

Sadly we can't really create a regression test for this specific issue.

The issue was found when debugging IoT.js with static snapshots turned on, if an error was thrown an assertion failure was caused. The reason is the frame context's bytecode_header_p pointer was not a heap pointer. The jerry_debugger_breakpoint_hit function tries to set a compressed pointer which points to bytecode_header_p with the JMEM_CP_SET_NON_NULL_POINTER macro, which has an assertion that requires the above mentioned bytecode_header_p to be a heap pointer, which is obviously not.

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
@DanielBallaSZTE DanielBallaSZTE force-pushed the fix_static_snapshot_exception branch from 6cb86e3 to 647bd9c Compare November 22, 2018 09:07
@akosthekiss
Copy link
Member

@DanielBallaSZTE Is this issue IoT.js-specific? Or can it be reproduced somehow in a JerryScript-only environment?

@DanielBallaSZTE
Copy link
Author

@akosthekiss I haven't tried it yet, I could give it a shot, and if it is reproducible try and create a test for it. However, in that case we would need a static snapshot in the test environment to be debugged, while running debugger-tests.

@zherczeg
Copy link
Member

Not a trivial task. You need a unit test which creates such an environment, and you also need the python debugger to do debugging. Hence it needs a new infrastructure basically, where instead of a .js, a binary is run by the debugger tester driver. @DanielBallaSZTE please check how difficult would be to do this.

@LaszloLango
Copy link
Contributor

Any update on this? IMHO the test environment improvement should be done in a separate PR. It is not trivial and might take a while to implement it, but this bug is quite a blocker issue for us.

@LaszloLango LaszloLango added bug Undesired behaviour critical Raises security concerns snapshot Related to the snapshot feature labels Dec 5, 2018
Copy link
Member

@akosthekiss akosthekiss left a comment

Choose a reason for hiding this comment

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

Unfortunately, there has been no update on adding test for the issue. LGTM for now, to lift the block it causes. (I've created an issue, #2637, to track the need for a test environment.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour critical Raises security concerns debugger Related to the debugger snapshot Related to the snapshot feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants