This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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 breakpoints/13247] Wrong breakpoint address for ARM binarybuilt with -O2


http://sourceware.org/bugzilla/show_bug.cgi?id=13247

--- Comment #1 from Christian Prochaska <christian.prochaska@genode-labs.com> 2011-10-05 16:09:15 UTC ---
I'm still quite new to DWARF, but noted a difference in the line number
information for the two binaries:

-O0 binary
----------

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     0       0       0       func1.c
  2     0       0       0       func1.h

 Line Number Statements:
  Extended opcode 2: set Address to 0x83a4
  Special opcode 8: advance Address by 0 to 0x83a4 and Line by 3 to 4
  Special opcode 146: advance Address by 20 to 0x83b8 and Line by 1 to 5
  Advance PC by 16 to 0x83c8
  Extended opcode 1: End of Sequence

-O2 binary
----------

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     0       0       0       func1.c
  2     0       0       0       func1.h

 Line Number Statements:
  Extended opcode 2: set Address to 0x838c
  Special opcode 8: advance Address by 0 to 0x838c and Line by 3 to 4
  Special opcode 33: advance Address by 4 to 0x8390 and Line by 0 to 4
  Special opcode 62: advance Address by 8 to 0x8398 and Line by 1 to 5
  Advance PC by 8 to 0x83a0
  Extended opcode 1: End of Sequence

-------------

I wonder about the line with opcode 33 in the output for the -O2 binary, it
seems superfluous to me? Also, the next line with opcode 62 contains the
correct breakpoint address 0x8398 which was not chosen by GDB.

After looking at the assembly files, I guess the line number statements are
related to the ".loc" statements? In func1.s for the -O2 build there appears
two times ".loc 1 4 0", which is not the case for the -O0 build.

func1:
.LFB0:
        .file 1 "func1.c"
        .loc 1 4 0
        .cfi_startproc
        @ args = 20, pretend = 16, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        sub     sp, sp, #16
.LCFI0:
        .cfi_def_cfa_offset 16
        .loc 1 4 0
        sub     ip, sp, #4
        stmib   ip, {r0, r1, r2, r3}
        .loc 1 5 0
        add     sp, sp, #16
        bx      lr
        .cfi_endproc

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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