Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upomitting frame pointers breaks retrieving DWARF debug info for parameter values #11906
Comments
This comment has been minimized.
This comment has been minimized.
|
Updating title to include the keyword "DWARF" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Triage: no change that I'm aware of. This bug is quite old, however, so I might have missed it. |
This comment has been minimized.
This comment has been minimized.
|
This makes Rust's generated code look worse than it actually is on http://rust.godbolt.org, because -g is required for output colorization, but it also deactivates frame pointer elimination. Compiler Explorer Issue: |
This comment has been minimized.
This comment has been minimized.
|
See also #9641. We still cannot omit frame pointers. Taking test
|
This comment has been minimized.
This comment has been minimized.
mattgodbolt
commented
Dec 23, 2016
|
Is there another way to get the line-level information in the asm output, without passing -debug? Compiler Explorer runs Sadly the The equivalent flags for C++ compilation don't have the same effect. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
mattgodbolt
commented
Dec 23, 2016
|
That doesn't appear to be the case. (some lines removed from the below for clarity)
Note how adding the |
This comment has been minimized.
This comment has been minimized.
mattgodbolt
commented
Dec 23, 2016
|
Apologies; you did say "less of an impact" - and maybe it does. I was ideally looking for "no code impact" - but I'll change to use this at least! Thanks for the reply; any further suggestions welcomed! |
pftbest
referenced this issue
Mar 28, 2017
Closed
ripgrep binaries are an order of magnitude larger than they need to be #413
This comment has been minimized.
This comment has been minimized.
|
I really hope we can get rid of these debuginfo only frame pointers. Some platforms cough 64bit windows cough have function tables such that unwinding and debugging can be done just fine without frame pointers so this would definitely help to squeeze out a bit more size and speed. |
Mark-Simulacrum
added
the
C-enhancement
label
Jul 20, 2017
This comment has been minimized.
This comment has been minimized.
|
This seems largely solved by #44573 and #45380 , because by now we're actually using the incoming arguments and don't shadow them with locals by the same name (the test likely broke because it accessed the local instead of the actual argument). So the unoptimized assembly for the function above now is (I already compiled with debug info + frame pointer omission here):
And the result is as expected:
The only thing that still breaks right now seems to be code that uses pattern matching for function arguments. I'll try to look into that. |
This comment has been minimized.
This comment has been minimized.
|
Awesome, thank you @dotdash! |
This comment has been minimized.
This comment has been minimized.
I disagree with this, but if others agree, we're done here once a scoping bug that @eddyb identified has been resolved. |
This comment has been minimized.
This comment has been minimized.
|
"we're done" meaning that we should be fine to omit frame pointers in debug builds. |
This comment has been minimized.
This comment has been minimized.
|
The bug in question is likely (cc @arielb1 8c7500f#diff-ef9c98f22bf95e3bda12c849d5550cedR198) rust/src/librustc_mir/build/matches/mod.rs Lines 218 to 221 in 16212b9 Which appears to set the visibility scope way earlier than the intended "after the rust/src/librustc_mir/build/block.rs Lines 134 to 137 in 16212b9 It appears that we do generate nested visibility scopes for binding arguments, just like rust/src/librustc_mir/build/mod.rs Lines 611 to 614 in df8dfde So once EDIT: #46896 should be fixing this bug. |
This comment has been minimized.
This comment has been minimized.
|
cc @pcwalton who might have opinions about whether we should skip frame pointers or not. |
This comment has been minimized.
This comment has been minimized.
|
Given that #46896 has been merged now, what's the latest? Was garbage seen in the debugger before, and has that changed? |
This comment has been minimized.
This comment has been minimized.
|
Given this program: fn foo(a: i64, (b, c): (i64, i64)) {
}
fn main() {
foo(1, (2, 3));
}If you break on With the current nightly, If you add some code into fn bar() {
}
fn foo(a: i64, (b, c): (i64, i64)) {
bar();
}
fn main() {
foo(1, (2, 3));
}In stable you now get to see I'll build a rustc without the forced framepointers to see whether that still makes any difference at all. I'd still argue that if you break on |
This comment has been minimized.
This comment has been minimized.
|
FWIW I would expect debuggers to show |
This comment has been minimized.
This comment has been minimized.
|
lldb seems to handle anonymous arguments better than gdb. GDB:
LLDB:
But as with gdb, |
This comment has been minimized.
This comment has been minimized.
|
Should we give the anonymous arguments a non-empty name so they show up better? |
This comment has been minimized.
This comment has been minimized.
|
Maybe we could simply go with |
dotdash
referenced this issue
Jan 3, 2018
Closed
Don't force-enable frame pointers when generating debug info #47152
dotdash
added a commit
to dotdash/rust
that referenced
this issue
Jan 3, 2018
dotdash
added a commit
to dotdash/rust
that referenced
this issue
Jan 3, 2018
dotdash
added a commit
to dotdash/rust
that referenced
this issue
Feb 8, 2018
bors
added a commit
that referenced
this issue
Feb 9, 2018
nagisa
added a commit
to nagisa/rust
that referenced
this issue
Mar 6, 2018
nagisa
added a commit
to nagisa/rust
that referenced
this issue
Mar 6, 2018
nagisa
referenced this issue
Mar 6, 2018
Merged
Add force-frame-pointer flag to allow control of frame pointer ommision #48786
This comment has been minimized.
This comment has been minimized.
I filed a gdb bug for this: https://sourceware.org/bugzilla/show_bug.cgi?id=22940 |

thestinger commentedJan 29, 2014
Frame pointers should not be required for debugging, because the DWARF debug information can contain everything necessary. However, it seems we do not generate the expected location list for parameters. This causes the
debuginfo/function-prologue-stepping-no-split-stack.rstest to break.