-
Notifications
You must be signed in to change notification settings - Fork 109
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
Use gimli
without alloc
#581
Comments
As alternative maybe an ORC unwinder would be able to completely eliminate allocations? This probably would only allow backtraces though and not running cleanup on unwinding. |
Yes. I am aware. I think that'll be a easy change to make it accept a
One approach would just be accepting a I'll prototype to see if I can come up with an ergonomic approach so that users with
I do actually want the ability to do unwind and catch panic! Catching panic is the only viable way to do panic recovery. Without unwinding the stack couldn't be cleanup so either the stack has to leak or intrusive data structures would be unsound. |
What exactly does that mean? Use an enum and only enable the owned variant when the |
If we can come up with a solution that doesn't need type parameters then that would be even better. e.g. |
What's the policy on raising MSRV? I'd like to use const_generics but that's only available in Rust 1.51. |
No fixed policy, raise when needed but try to avoid causing pain for others. Rust 1.51 is probably still too recent. |
From a quick look at disabling the |
These methods could be cfg-ed away. To me, the main problem seems to be Abbreviations with its btreemap. |
What if one dep doesn't use alloc and implements this trait and another dep uses alloc? You would get a compilation error due to the missing functions in the impl. |
A default implementation could be supplied |
Do you need Abbreviations without alloc? I was expecting to disable everything except for cfi/op. |
No, but op depends on unit which depends on abbrev. I guess I'll just keep cfging out things until it compiles :) |
Yeah, cfg everywhere is a bit ugly but should work. I think If we had to, the btreemap in Abbreviations could be made optional, since most DWARF shouldn't need it. |
I believe ORC is only used in the kernel. An ORC unwinder would not be able to unwind user-space programs. Unless I've misunderstood things? |
It should be possible to generate ORC unwind info from DWARF unwind info for userspace programs the same way I believe the Linux kernel does. It may require an extension to provide the personality function and LSDA though if ORC doesn't already have a field for this if you want to use the unwinder for exception handling and not just backtraces. |
Interesting! |
I am working on a pure Rust stack unwinder (https://github.com/nbdd0121/unwind). It's now fully functional on hosted platforms (with libc dependency), and my intention is for it to work on baremetal
#![no_std]
binaries as well. It's sort of working right now, but requiresalloc
, which is a big issue because allocator isn't always available or desirable for baremetal programs.Currently my unwind crate uses two things that require allocation:
UninitializedUnwindContext
andEvaluation
One way to avoid having them performing allocation themselves is to ask the user to supply the backing memory. This creates usability issues for users that can use allocator, so I think an approach similar to
managed
crate could be ideal. This approach is used bysmoltcp
crate to avoid implicit allocations.The text was updated successfully, but these errors were encountered: