This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/63572] [5 Regression] ICF breaks user debugging experience


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63572

--- Comment #6 from Martin LiÅka <mliska at suse dot cz> ---
There's how gold's ICF works for test attached by Jakub:

gcc --version:
gcc version 5.0.0 20141016 (experimental) (GCC) 

ld --version:
GNU gold (GNU Binutils 2.24.51.20141010) 1.11

$ gcc icf-gdb.c -c -g --function-sections
$ gcc icf-gdb.o -o a.out -Wl,--icf=all,--print-icf-sections
...
ld: ICF folding section '.text.f2' in file 'icf-gdb.o' into '.text.f1' in file
'icf-gdb.o'
...

dwarfdump a.ou shows:
< 1><0x00000059>    DW_TAG_subprogram
                      DW_AT_name                  f1
                      DW_AT_decl_file             0x00000001
/home/marxin/Programming/testcases/icf-gdb.c
                      DW_AT_decl_line             0x00000005
                      DW_AT_prototyped            yes(1)
                      DW_AT_type                  <0x00000052>
                      DW_AT_low_pc                0x00400546
                      DW_AT_high_pc               <offset-from-lowpc>115
                      DW_AT_frame_base            len 0x0001: 9c:
DW_OP_call_frame_cfa
                      DW_AT_GNU_all_call_sites    yes(1)
                      DW_AT_sibling               <0x000000e2>


and:
< 1><0x000000e8>    DW_TAG_subprogram
                      DW_AT_name                  f2
                      DW_AT_decl_file             0x00000001
/home/marxin/Programming/testcases/icf-gdb.c
                      DW_AT_decl_line             0x00000015
                      DW_AT_prototyped            yes(1)
                      DW_AT_type                  <0x00000052>
                      DW_AT_low_pc                0x00400546
                      DW_AT_high_pc               <offset-from-lowpc>115
                      DW_AT_frame_base            len 0x0001: 9c:
DW_OP_call_frame_cfa
                      DW_AT_GNU_all_call_sites    yes(1)
                      DW_AT_sibling               <0x00000171>

If I tried to put breakpoint in GDB to f2, breakpoint is triggered 4 times with
back-trace from all functions f3-f6.
Example:
#0  f1 (x=0x7fffffffda10) at icf-gdb.c:24
#1  0x00000000004005d1 in f3 (x=0x7fffffffda10) at icf-gdb.c:33
#2  0x0000000000400657 in main () at icf-gdb.c:44


Maybe I miss something, but gold also does not support correct DWARF merging.
I will create issue for gold.

Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]