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

Initial #![no_std] mode #21

Closed
wants to merge 1 commit into from
Closed

Initial #![no_std] mode #21

wants to merge 1 commit into from

Conversation

est31
Copy link

@est31 est31 commented Jun 12, 2018

Addresses most of #20 , except for the panic catching inside the linux module.

@est31
Copy link
Author

est31 commented Jun 12, 2018

libcore doesn't have functionality to catch panics. Also I'm not sure whether we'd be creating a circular dependency if we are calling this code inside the panic handler. Removing the catching is bad as well though because panicing through FFI boundaries is UB.

@philipc
Copy link
Contributor

philipc commented Jun 13, 2018

We could add an unsafe API where it is the caller's responsibility to ensure it doesn't panic.

@fitzgen
Copy link
Member

fitzgen commented Jun 13, 2018

It is really hard to verify code paths are panic-free (as I know you know ;) ).

Another option would be to internally do a full pass that copies the relevant info out, and then iterate over the copies with the user-supplied callback. This should make the code that needs to be panic-free easier to manage (certainly for users, since it is only the crate's responsibility now). It also doesn't sound very performant. Perhaps we could add some kind of query/filter API so we could only copy what is necessary and potentially break out of the loop early as well. Thoughts?

I need to mull this over a bit.

@philipc
Copy link
Contributor

philipc commented Jun 13, 2018

It's only a problem if it unwinds, right? So what I should have said is that it is the caller's responsibility to ensure it doesn't unwind. Maybe libstd's usage can be a bit special so that it can set an internal flag that forces any panics to abort instead of unwinding? So I'm hoping for a solution where we can still guarantee that it is correct (whereas it is hard to ensure any copying API we implement would never unwind).

@est31
Copy link
Author

est31 commented Jun 13, 2018

Maybe libstd's usage can be a bit special so that it can set an internal flag that forces any panics to abort instead of unwinding?

Seems that this is what is happening already. So I think we are fine with adding an unsafe variant of the API without any panic catching.

@est31
Copy link
Author

est31 commented Jul 3, 2018

The period of my contributions to Rust upstream has reached an end. Thus I'm unable to continue my work on this. I still think something like this is a great addition. I urge anyone interested in this change to adopt and continue it from here on.

Note: This PR isn't technically to a Rust upstream repository but I'm still closing it as it was created as a part of me pushing the libbacktrace → addr2line migration over the finish line.

@est31 est31 closed this Jul 3, 2018
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.

3 participants