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

Fix stairstepping OCaml traces when exceptions are involved #280

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

Xyene
Copy link
Member

@Xyene Xyene commented Oct 27, 2023

This commit fixes two bugs:

  • caml_raise_exn modifies the stack and then rets into an entertrap, so we need to also do entertrap fixups on returns.

  • Trap callstacks would often have the symbol of the parent frame re-inferred, which would result in doubling up of that frame. We fix this by seeding the trap callstack with a synthetic frame, which we make sure to delete before outputting trace events.

    A more principled approach would be to have Callstack know about traps directly and avoid creating new Callstack.ts for them, but that work is deferred to someday that isn't today.

Copy link
Contributor

@cgaebel cgaebel left a comment

Choose a reason for hiding this comment

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

lgtm

This commit fixes two bugs:

* `caml_raise_exn` modifies the stack and then `ret`s into an
  `entertrap`, so we need to also do `entertrap` fixups on returns.

* Trap callstacks would often have the symbol of the parent frame
  re-inferred, which would result in doubling up of that frame. We fix
  this by seeding the trap callstack with a synthetic frame, which we
  make sure to delete before outputting trace events.

  A more principled approach would be to have `Callstack` know about
  traps directly and avoid creating new `Callstack.t`s for them, but
  that work is deferred to someday that isn't today.

Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
@Xyene Xyene merged commit d997a23 into janestreet:master Oct 27, 2023
2 checks passed
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.

None yet

2 participants