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
Add option to enable stack unwinding in betterC mode #16174
Conversation
Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#16174" |
I'm curious, why was this disabled in the first place?
|
#7305 no mention as to why it was disabled. |
I don't know, but when using Perhaps the right thing to do is to remove that and let user decide by using |
Agreed, opt-out is better for this I think. |
Actually it does. Exceptions are by default allocated with the gc which is not available if you're not using the runtime. The fact that a function is nothrow does not mean that exceptions are not going to be allocated. There is a compiler flag -dip1008 which makes exceptions to be ref counted. This should work with betterC, however, it has a limitation: exceptions that are catched cannot escape the catch block. However, that does not seem to be the case in your situation. |
You have misunderstood this. The unwinding tables are separate from being able to throw and catch. |
It might be possible that the implementer made the same term confusion as I did. |
Can't you remove |
The point is to improve debugging with -betterC (technically it is -nothrow), not to ignore it |
Generating unwinding tables in |
I also sent this PR after riki comment #16177 is it better? |
I think so |
I wanted to debug my code in my project, but i'm using -betterC, wich removes the ability for the compiler to generate eh_frame, so
backtrace
wasn't workingThis adds an option for
-betterC
to still get the benefits ofnothrow
static analysis + being able to debug code with ease, this option is disabled in-release
Documentation perhaps could be improved
Before:
After:
Test code:
dmd -fPIC -fPIE -gs -debug -g -betterC -run _.d
https://gist.github.com/ryuukk/e2d5260b4c4acec1b972ad9ce9228753