public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "christian.prochaska@genode-labs.com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/13247] Wrong breakpoint address for ARM binary built with -O2
Date: Wed, 05 Oct 2011 16:09:00 -0000	[thread overview]
Message-ID: <bug-13247-4717-m2CS29ZOKA@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-13247-4717@http.sourceware.org/bugzilla/>

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.


  reply	other threads:[~2011-10-05 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 11:39 [Bug breakpoints/13247] New: " christian.prochaska@genode-labs.com
2011-10-05 16:09 ` christian.prochaska@genode-labs.com [this message]
2011-10-06 15:29 ` [Bug breakpoints/13247] " christian.prochaska@genode-labs.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13247-4717-m2CS29ZOKA@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).