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

Passing exception address by longjmp #30

Closed
higuoxing opened this issue Jun 17, 2019 · 3 comments
Closed

Passing exception address by longjmp #30

higuoxing opened this issue Jun 17, 2019 · 3 comments

Comments

@higuoxing
Copy link
Contributor

@higuoxing higuoxing commented Jun 17, 2019

In chapter SjLj exception handling, I noticed that we passed an address of pointer by longjmp which is not reasonable (IMO). Usually, when handling exception, we use longjmp to pass error/exception type, which is can be represent by a predefined integer. I didn't dig much about it, what's your opinion?

%5 = ptrtoint %Exception* %3 to i32
call void @longjmp(%jmp_buf* %throw, i32 %5)

[1] Setjmp.h on Wikipedia

Regards.

@archfrog
Copy link
Collaborator

@archfrog archfrog commented Jun 17, 2019

I am to blame :) I did the original sample for 32-bit architectures. The idea is to pass the pointer to the exception instance up the call stack, but I am not sure how to do this with 64-bit pointers. I'd prefer if we can somehow pass a pointer to the exception instance, but if this is impossible, I guess we'll have to resort to an error code. After all, it is just a sample.

As far as I can see, longjmp takes a 32-bit integer (even on 64-bit platforms), so if you feel like changing the sample to use an error code, it is definitely fine with me :-)

Loading

@higuoxing higuoxing closed this Jun 19, 2019
@f0rki
Copy link
Owner

@f0rki f0rki commented Jun 21, 2019

FYI: I added a paragraph that clarifies this issue to the text.

Loading

@higuoxing
Copy link
Contributor Author

@higuoxing higuoxing commented Jun 21, 2019

Thanks a lot 😃

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants