-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Don't force-enable frame pointers when generating debug info #47152
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Thank you for looking into and fixing this over the last few weeks, @dotdash! However, it seems that some targets can also disable frame pointer elimination. Can you just adapt the |
@michaelwoerister D'oh! The fixme comment got me thinking that the whole thing was about that issue, should have had a closer look. Thanks! Updated. |
Great, thank you! @bors r+ |
📌 Commit 0bc466d has been approved by |
@bors r- (travis error) |
Btw, @dotdash, did you check that this does not break backtraces? |
I guess https://github.com/rust-lang/rust/blob/master/src/test/run-pass/backtrace.rs takes care of that. |
@bors r+ Removed the unused import |
📌 Commit 002c786 has been approved by |
Talked to @pcwalton on IRC. He was primarily concerned with macOS and iOS, but we already set But he also mentioned profiling in general and that frame pointers are still required there, as DWARF isn't apparently enough in many cases. so we should have a way to turn them back on. @dotdash @michaelwoerister Do you think we can reasonably expose a |
I think ideally we would have a |
Sounds reasonable to me. |
☔ The latest upstream changes (presumably #47235) made this pull request unmergeable. Please resolve the merge conflicts. |
How do we move forward with this without making the flag insta-stable? It would be a bit lame if you could only profile code that was built with nightly. |
cc @rust-lang/compiler |
I'd be ok with exposing such a flag, even if it were insta-stable, but I also think it's ok to land such a flag unstable, and then do a standard stabilization (perhaps just start it immediately). do we have much precedent for flags of these kind? I confess I don't pay that much attention to |
@rust-lang/compiler I'm confused with the current status of this PR 😄 Is it OK to land this or not? Maybe it needs an FCP? 😉 Anyway, @dotdash please fix the merge conflict. |
It seems like an FCP is a good idea. @rfcbot fcp merge I propose that we merge this PR, which will add an insta-stable The reason to make it instastable is basically that we want people to be able to use it on stable so they can do profiling, which is an important use case. It also seems like a pretty easy thing to commit to supporting in some form going forward (and, at worst, it can be deprecated and become a sort of no-op). I would also be ok with adding a UPDATE: I realize now that the state of the PR is not what I described. My bad. To be clear, what we are voting on is:
As @michaelwoerister points out here, we may want some nice cargo tooling around this too. |
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged teams:
No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Checking clang, I noticed that they have a slightly more complex logic regarding frame pointers, using a combination of defaults, flags and forcing frame pointers for certain archs (just ARM Darwin). I'll update this with a similar approach. I'd also like to use -Comit-frame-pointers=0/1 instead of the one way flag to only enable them. Any complaints about that? |
(For record, the latest error is likely legit.
) |
Oh, yeah, that's why I looked into clang. They never disable frame pointers on Darwin by default. We only force them for Darwin x86_64, but I don't feel comfortable doing that for i686 as well, because with the current setup, we can only force frame pointers, without any chance for the user to disable them. So I'd like to make the target option for frame pointers a mere default, which can be overridden. |
makes sense, except that we should use our usual convention (which accepts all kinds of things, like yes, no, true, false, right?) |
Right, I had that in mind. I should have written 0/1/... or something like
that.
2018-02-12 21:30 GMT+01:00 Niko Matsakis <notifications@github.com>:
… I'd also like to use -Comit-frame-pointers=0/1 instead of the one way flag
to only enable them. Any complaints about that?
makes sense, except that we should use our usual convention (which accepts
all kinds of things, like yes, no, true, false, right?)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#47152 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOGMvjP51uzCEzTkG4BU24lwVHcHz3Tks5tUJ9mgaJpZM4RRmZR>
.
|
I'm not sure why we need to force frame pointers by default on Darwin. What happens if we don't?
It does not make sense to ask the compiler to omit frame pointers. This should still be called |
Why doesn't it make sense? Or, rather, is there any harm to allowing it? |
LLVM cannot generate code which does not use frame pointers. You can just ask it to always use frame pointers. |
GCC has the |
As another reference point, by default |
Probably due to different debug info format. Debugging on MSVC is pretty much impossible without frame pointers (or at least it was a few years ago, on 32-bit). |
The test failure that we saw in the last run for this PR, because the debugger apparently can't properly resolve the stack frames on that target without frame pointers. If it wasn't for clang always defaulting to frame pointers for Darwin, I'd guess that we still emit incomplete/broken debug info, but as it is, I assume that clang is right in what it is doing there.
I'd argue that -Comit-frame-pointers=0/1/... makes more sense. LLVM happens to default to omitting frame pointers, but e.g. clang defaults to emitting them by default unless optimizations are enabled and I'd like rustc to do the same. So I need an option that can do both, tell the compiler to omit frame pointers (overriding the default for non-optimizing builds), as well as asking it not to omit them (overriding the default for optimizing builds). IMHO this fits an omit-frame-pointers option just fine, but a force-frame-pointers flag only allows to go one way. And even as an on/off option, "force-frame-pointers=0" doesn't sound like it would override a default that already emits frame pointers. And finally, the omit-frame-pointers option would be more familiar to folks coming from e.g. C/C++. |
@dotdash Any updates on this PR? :) |
Ping from triage, @dotdash ! We haven't heard from you in a few weeks, will you have a chance to address the test failures soon? |
Oops, I missed that the previous comment was also from triage. That means I'm going to go ahead and close this PR for now to keep things tidy. Please feel free to reopen this PR when you have a chance to work on it again! Thanks for your hard work! |
Argh. I'd really like to see this change land -- I opened #48785 to track it |
Add force-frame-pointer flag to allow control of frame pointer ommision Rebase of rust-lang#47152 plus some changes suggested by rust-lang#48785. Fixes rust-lang#11906 r? @nikomatsakis
Add force-frame-pointer flag to allow control of frame pointer ommision Rebase of #47152 plus some changes suggested by #48785. Fixes #11906 r? @nikomatsakis
We apparently used to generate bad/incomplete debug info causing
debuggers not to find symbols of stack allocated variables. This was
somehow worked around by having frame pointers.
With the current codegen, this seems no longer necessary, so we can
remove the code that force-enables frame pointers whenever debug info
is requested.
Fixes #11906