[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 Sandra Loosemore changed: What|Removed |Added CC||sandra at codesourcery dot com --- Comment #4 from Sandra Loosemore --- I believe this bug is responsible for the GDB gdb.base/restore.exp test failures reported in the GDB bug tracker (issues 16655 and 17019). There are many such failures for arm-none-eabi with -mthumb.
[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 --- Comment #5 from Sandra Loosemore --- Thinking about this some more Why doesn't -g always enable -fvar-tracking by default? It's currently only enabled if you specify both -g and -O.
[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org --- Comment #6 from Eric Botcazou --- > Why doesn't -g always enable -fvar-tracking by default? It's currently only > enabled if you specify both -g and -O. The full answer is in the gcc-patches@ archives. The short answer is that it essentially doesn't work at -O0.
[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 --- Comment #1 from Andrew Pinski --- I bet if you remove register, it will work. Or compile with variable tracking turned on.
[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 --- Comment #2 from Yao Qi --- arm-none-eabi gcc mainline (4.10.0 20140818) and 4.9.2 has this problem too. The test case is compiled with -mthumb flag. <1><71>: Abbrev Number: 6 (DW_TAG_subprogram) <72> DW_AT_external: 1 <72> DW_AT_name: (indirect string, offset: 0x6a): wack <76> DW_AT_decl_file : 1 <77> DW_AT_decl_line : 13 <78> DW_AT_prototyped : 1 <78> DW_AT_type: <0xc4> <7c> DW_AT_low_pc : 0x8214 <80> DW_AT_high_pc : 0x44 <84> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <86> DW_AT_GNU_all_tail_call_sites: 1 <86> DW_AT_sibling : <0xc4> <2><8a>: Abbrev Number: 5 (DW_TAG_formal_parameter) <8b> DW_AT_name: u <8d> DW_AT_decl_file : 1 <8e> DW_AT_decl_line : 13 <8f> DW_AT_type: <0x25> <93> DW_AT_location: 6 byte block: 50 93 4 51 93 4(DW_OP_reg0 (r0); DW_OP_piece: 4; DW_OP_reg1 (r1); DW_OP_piece: 4) <2><9a>: Abbrev Number: 5 (DW_TAG_formal_parameter) <9b> DW_AT_name: v <9d> DW_AT_decl_file : 1 <9e> DW_AT_decl_line : 13 <9f> DW_AT_type: <0x25> DW_AT_location: 6 byte block: 52 93 4 53 93 4(DW_OP_reg2 (r2); DW_OP_piece: 4; DW_OP_reg3 (r3); DW_OP_piece: 4) <2>: Abbrev Number: 7 (DW_TAG_variable) DW_AT_name: l DW_AT_decl_file : 1 DW_AT_decl_line : 15 DW_AT_type: <0x25> DW_AT_location: 6 byte block: 54 93 4 55 93 4(DW_OP_reg4 (r4); DW_OP_piece: 4; DW_OP_reg5 (r5); DW_OP_piece: 4) <2>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name: r DW_AT_decl_file : 1 DW_AT_decl_line : 15 DW_AT_type: <0x25> <2>: Abbrev Number: 0
[Bug debug/62225] DW_AT_location for local variable is missing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225 --- Comment #3 from Yao Qi --- (In reply to Andrew Pinski from comment #1) > I bet if you remove register, it will work. Or compile with variable > tracking turned on. I compiled the code again with -fvar-tracking, and looks DW_AT_location for local variable is there. <2><9a>: Abbrev Number: 7 (DW_TAG_variable) <9b> DW_AT_name: l <9d> DW_AT_decl_file : 1 <9e> DW_AT_decl_line : 15 <9f> DW_AT_type: <0x25> DW_AT_location: 0x0 (location list) <2>: Abbrev Number: 7 (DW_TAG_variable) DW_AT_name: r DW_AT_decl_file : 1 DW_AT_decl_line : 15 DW_AT_type: <0x25> DW_AT_location: 0x2a (location list) Contents of the .debug_loc section: Offset BeginEnd Expression 080483b1 080483b4 (DW_OP_reg11 (st0)) 000b 080483b4 080483cf (DW_OP_fbreg: 0) 0017 080483cf 080483d2 (DW_OP_reg11 (st0)) 0022 002a 080483b4 080483cb (DW_OP_reg11 (st0)) 0035 080483cb 080483ef (DW_OP_fbreg: 12) 0041