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] New: Wrong breakpoint address for ARM binary built with -O2 Date: Sun, 02 Oct 2011 11:39:00 -0000 [thread overview] Message-ID: <bug-13247-4717@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=13247 Bug #: 13247 Summary: Wrong breakpoint address for ARM binary built with -O2 Product: gdb Version: 7.3 Status: NEW Severity: normal Priority: P2 Component: breakpoints AssignedTo: unassigned@sourceware.org ReportedBy: christian.prochaska@genode-labs.com Classification: Unclassified Created attachment 5958 --> http://sourceware.org/bugzilla/attachment.cgi?id=5958 source, gcc temporary files and binaries of the test program Platform -------- Debian Squeeze armel (QEMU image from http://people.debian.org/~aurel32/qemu/armel/) GCC 4.6.1 built from source --------------------------- Using built-in specs. COLLECT_GCC=/opt/gcc/bin/gcc COLLECT_LTO_WRAPPER=/opt/gcc-4.6.1/libexec/gcc/armv5tejl-unknown-linux-gnueabi/4.6.1/lto-wrapper Target: armv5tejl-unknown-linux-gnueabi Configured with: ../gcc-4.6.1/configure --prefix=/opt/gcc-4.6.1 Thread model: posix gcc version 4.6.1 (GCC) GDB 7.3.1 built from source --------------------------- GNU gdb (GDB) 7.3.1 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "armv5tejl-unknown-linux-gnueabi". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Test program ------------ ---- func1.h ---- struct arg_struct { int arg1, arg2, arg3, arg4, arg5; }; extern void func1(struct arg_struct func1_args); ---- func1.c ---- #include "func1.h" void func1(struct arg_struct func1_args) { } ---- main.c ---- #include "func1.h" int main(int argc, char *argv[]) { struct arg_struct test_args = {1, 2, 3, 4, 5}; func1(test_args); return 0; } ---------------- Correct breakpoint address of func1 when building with -O0: $ /opt/gcc/bin/gcc -O0 -g -save-temps main.c func1.c $ gdb ./a.out -ex "b func1" -ex "run" -ex "disassemble func1" -ex "info args" Reading symbols from /home/user/test/a.out...done. Breakpoint 1 at 0x83b8: file func1.c, line 5. Starting program: /home/user/test/a.out Breakpoint 1, func1 (func1_args=...) at func1.c:5 5 } Dump of assembler code for function func1: 0x000083a4 <+0>: sub sp, sp, #16 0x000083a8 <+4>: push {r11} ; (str r11, [sp, #-4]!) 0x000083ac <+8>: add r11, sp, #0 0x000083b0 <+12>: add r12, r11, #4 0x000083b4 <+16>: stm r12, {r0, r1, r2, r3} => 0x000083b8 <+20>: add sp, r11, #0 0x000083bc <+24>: pop {r11} 0x000083c0 <+28>: add sp, sp, #16 0x000083c4 <+32>: bx lr End of assembler dump. func1_args = {arg1 = 1, arg2 = 2, arg3 = 3, arg4 = 4, arg5 = 5} --------------- Wrong breakpoint address when building with -O2: $ /opt/gcc/bin/gcc -O2 -g -save-temps main.c func1.c $ gdb ./a.out -ex "b func1" -ex "run" -ex "disassemble func1" -ex "info args" Reading symbols from /home/user/test/a.out...done. Breakpoint 1 at 0x8390: file func1.c, line 4. Starting program: /home/user/test/a.out Breakpoint 1, func1 (func1_args=...) at func1.c:4 4 { Dump of assembler code for function func1: 0x0000838c <+0>: sub sp, sp, #16 => 0x00008390 <+4>: sub r12, sp, #4 0x00008394 <+8>: stmib r12, {r0, r1, r2, r3} 0x00008398 <+12>: add sp, sp, #16 0x0000839c <+16>: bx lr End of assembler dump. func1_args = {arg1 = 1073895576, arg2 = 1073912552, arg3 = 0, arg4 = 33368, arg5 = 5} --------------- The breakpoint address should be 0x8398 instead of 0x8390 for arg1-arg4 to be shown correctly. The attached archive contains the source, gcc temporary files and the binaries of the test program. I can provide more files/information if needed. -- 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.
next reply other threads:[~2011-10-02 11:39 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-10-02 11:39 christian.prochaska@genode-labs.com [this message] 2011-10-05 16:09 ` [Bug breakpoints/13247] " christian.prochaska@genode-labs.com 2011-10-06 15:29 ` 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@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: linkBe 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).