You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
omitting frame pointers breaks retrieving DWARF debug info for parameter values #11906
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.rs test to break.
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.
Is there another way to get the line-level information in the asm output, without passing -debug? Compiler Explorer runs rustc -g --emit asm to get the assembly, and then parses the .loc directive to marry input code with output code.
Sadly the -g changes the code generation, which makes the output less useful.
The equivalent flags for C++ compilation don't have the same effect.
-g is equivalent to -C debuginfo=2, meaning "full debuginfo". But there is also -C debuginfo=1 which means "just line-tables" and should have less of an impact on code generation.
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!
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.
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):
Dump of assembler code for function function_arg_initialization::non_immediate_args:
=> 0x0000555555559ff0 <+0>: sub $0x18,%rsp
0x0000555555559ff4 <+4>: mov %rdi,0x10(%rsp)
0x0000555555559ff9 <+9>: mov %rsi,0x8(%rsp)
0x0000555555559ffe <+14>: callq 0x55555555a4e0 <function_arg_initialization::zzz>
0x000055555555a003 <+19>: add $0x18,%rsp
0x000055555555a007 <+23>: retq
<doener> eddyb: so you're saying that when I set a breakpoint
on a function foo((a, b): (i64, 64)), it would be fine to not
have anything in scope at the breakpoint?
<eddyb> doener: yeah sure
I disagree with this, but if others agree, we're done here once a scoping bug that @eddyb identified has been resolved.
Activity
nikomatsakis commentedon Jan 29, 2014
Updating title to include the keyword "DWARF"
huonw commentedon Aug 11, 2014
cc @michaelwoerister
steveklabnik commentedon Sep 3, 2015
Triage: no change that I'm aware of. This bug is quite old, however, so I might have missed it.
CryZe commentedon Oct 16, 2016
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:
compiler-explorer/compiler-explorer#79
nagisa commentedon Nov 3, 2016
See also #9641.
We still cannot omit frame pointers. Taking test
src/test/debuginfo/function-arg-initialization.rs, the disassembly looks like this:mattgodbolt commentedon Dec 23, 2016
Is there another way to get the line-level information in the asm output, without passing -debug? Compiler Explorer runs
rustc -g --emit asmto get the assembly, and then parses the.locdirective to marry input code with output code.Sadly the
-gchanges the code generation, which makes the output less useful.The equivalent flags for C++ compilation don't have the same effect.
michaelwoerister commentedon Dec 23, 2016
-gis equivalent to-C debuginfo=2, meaning "full debuginfo". But there is also-C debuginfo=1which means "just line-tables" and should have less of an impact on code generation.mattgodbolt commentedon Dec 23, 2016
That doesn't appear to be the case.
(some lines removed from the below for clarity)
Note how adding the
debuginfo=1has caused code generation differences.mattgodbolt commentedon 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!
retep998 commentedon Apr 18, 2017
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.
dotdash commentedon Dec 19, 2017
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.
michaelwoerister commentedon Dec 19, 2017
Awesome, thank you @dotdash!
dotdash commentedon Dec 20, 2017
I disagree with this, but if others agree, we're done here once a scoping bug that @eddyb identified has been resolved.
dotdash commentedon Dec 20, 2017
"we're done" meaning that we should be fine to omit frame pointers in debug builds.
20 remaining items
Don't force-enable frame pointers when generating debug info
Auto merge of #48786 - nagisa:fp, r=nikomatsakis
Allow eliminating the frame pointer on x86_64-apple-darwin
Auto merge of rust-lang#12130 - weirane:let-else-let-match, r=weirane
[rust] switch to `-C debuginfo=2`
[rust] switch to `-C debuginfo=2`
[rust] switch to `-C debuginfo=2` (#7266)
[rust] switch to `-C debuginfo=2` (compiler-explorer#7266)