Open
Description
Bugzilla Link | 30637 |
Version | 3.9 |
OS | Linux |
CC | @dwblaikie,@ellishg,@hfinkel,@wjristow,@yuanfang-chen |
Extended Description
Debug info for this case has regressed in 3.9.
__attribute__((always_inline)) static int inlined(int i) {
static int a = 0;
a += i;
return a;
}
int main() {
return inlined(4);
}
In 3.8, we get this:
<1><2a>: Abbrev Number: 2 (DW_TAG_subprogram)
<2b> DW_AT_abstract_origin: <0x4c>
<2><2f>: Abbrev Number: 3 (DW_TAG_variable)
<30> DW_AT_name : (indirect string, offset: 0x5f): a
<34> DW_AT_type : <0x45>
<38> DW_AT_decl_file : 1
<39> DW_AT_decl_line : 2
<3a> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
<1><4c>: Abbrev Number: 5 (DW_TAG_subprogram)
<4d> DW_AT_linkage_name: (indirect string, offset: 0x65): _ZL7inlinedi
<51> DW_AT_name : (indirect string, offset: 0x72): inlined
<55> DW_AT_decl_file : 1
<56> DW_AT_decl_line : 1
<57> DW_AT_type : <0x45>
<5b> DW_AT_inline : 1 (inlined)
<2><5c>: Abbrev Number: 6 (DW_TAG_formal_parameter)
<5d> DW_AT_name : (indirect string, offset: 0x7a): i
<61> DW_AT_decl_file : 1
<62> DW_AT_decl_line : 1
<63> DW_AT_type : <0x45>
I'd rather see the static variable under the abstract origin DIE,
instead of separate, but at least the subprogram it's in points to the
abstract origin. If you work hard enough you can tie it all together.
But in 3.9, that abstract_origin link is gone:
<1><2a>: Abbrev Number: 2 (DW_TAG_subprogram)
<2><2b>: Abbrev Number: 3 (DW_TAG_variable)
<2c> DW_AT_name : (indirect string, offset: 0x5f): a
<30> DW_AT_type : <0x41>
<34> DW_AT_decl_file : 1
<35> DW_AT_decl_line : 2
<36> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
Now it's impossible to associate the static variable with the
subprogram where it belongs.