From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31288 invoked by alias); 2 Oct 2011 11:39:18 -0000 Received: (qmail 31265 invoked by uid 22791); 2 Oct 2011 11:39:18 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Oct 2011 11:39:05 +0000 From: "christian.prochaska@genode-labs.com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: christian.prochaska@genode-labs.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2011-q4/txt/msg00003.txt.bz2 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 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: . 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.