-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Make -betterC not disable EH, let -nothrow handle that #16177
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#16177" |
|
Can someone review this please? |
|
To help understand what this PR does: For cases where one uses -betterC or uses a custom runtime, it makes it possible to still use debugging APIs like Example code: extern(C) void main()
{
rt_register_crash_handler();
crash_me();
}
void crash_me()
{
int* a;
*a = 42;
}(full code + The code should crash and print: But if i compile with Not helpful at all.. This PR solves that ping @WalterBright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea sounds good, but tests are currently failing and the log is expired so I can't see why.
It's also curious that there are no changes for Windows, does that already generate the necessary code for backtraces with -betterC?
| @@ -0,0 +1,5 @@ | |||
| Stack unwinding is now working in `-betterC` mode. | |||
|
|
|||
| It can now properly use APIs like `backtrace` to generate stack traces, wich is very useful for debugging purposes. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say 'working', it might give the impression that a failing assert now gives a stack trace out of the box. Perhaps clarify that it 'works' on a more technical level, that the generated code contains the unwind info needed for e.g. libunwind.
|
The idea of -betterC is to not require the use of the D runtime library - only the C runtime library is needed. This PR requires linking in druntime, defeating the entire purpose of betterC. To get backtraces in betterC, do one of:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comment
I didn't know it would require linking druntime, in that case, this is a bad PR
I'll close it until i can find a better solution |
|
I've had to do another look into ldc, looks like I've been wrong, it does turn off the unwinding tables for Which is unfortunate, this certainly could be templated and turned on, oh well. |
See #16174 for context
-nothrowwas added recently, wich is what the user should use to disable EH, otherwise APIs likebacktracecan't be used to generate stack traces, wich is useful for debuggingI added a change log entry, but my english might be poor, so please don't hesitate to rephrase it