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

Print exception and break in clang_visitChildren #362

Merged
merged 1 commit into from
Jan 10, 2025
Merged

Conversation

phadej
Copy link
Collaborator

@phadej phadej commented Jan 10, 2025

Exceptions doesn't seem to fly through C-frames, so we need to handle them better.

For now, I just print and break. This makes test-suite not fail with pure exceptions.

It took me whole morning to figure out why throwIO weren't catched.

@phadej phadej requested a review from edsko January 10, 2025 10:28
@phadej
Copy link
Collaborator Author

phadej commented Jan 10, 2025

But we need to think of proper solution, this cannot be even called a band-aid.

@edsko
Copy link
Collaborator

edsko commented Jan 10, 2025

I guess the better solution would involve the Haskell function catching the exception and more explicitly returning it to the C function somehow?

@edsko edsko merged commit df98c89 into main Jan 10, 2025
10 checks passed
@edsko edsko deleted the exception-blargh branch January 10, 2025 10:48
@phadej
Copy link
Collaborator Author

phadej commented Jan 10, 2025

For the record https://gist.github.com/phadej/059993b3d430515fd97a3ee6033510c4 is an example: the exception is not caught, if you run that program you get

problem: user error (blargh)

i.e. uncaught exception, even if there is try.

I guess the better solution would involve the Haskell function catching the exception and more explicitly returning it to the C function somehow?

I think the way to solve is to catch exception, store them in a mutable cell, and then make clang_visitChildren throw it after C-call returns. I'll try that next.

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