From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15627 invoked by alias); 26 Jan 2011 10:26:27 -0000 Received: (qmail 15605 invoked by uid 22791); 26 Jan 2011 10:26:26 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Jan 2011 10:26:20 +0000 From: "jan.kratochvil at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/47471] New: stdarg functions extraneous too-early prologue end X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jan.kratochvil at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 26 Jan 2011 11:05:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg02796.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47471 Summary: stdarg functions extraneous too-early prologue end Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned@gcc.gnu.org ReportedBy: jan.kratochvil@redhat.com Target: x86_64-fedora15-linux-gnu GDB tracker: http://sourceware.org/bugzilla/show_bug.cgi?id=12435 ------------------------------------------------------------------------------- int v; void f (int i, ...) { v++; } int main (void) { f (1); return 0; } ------------------------------------------------------------------------------- gcc -o 1 1.c -Wall -g FAIL gcc (GCC) 4.6.0 20110126 (experimental) FAIL gcc-4.6.0-0.3.fc15.x86_64 PASS gcc (GCC) 4.5.3 20110124 (prerelease) PASS gcc-4.5.1-4.fc14.x86_64 GNU gdb (GDB) 7.2.50.20110125-cvs FAIL: gdb -nx ./1 -ex 'b f' -ex r Starting program: .../1 Program exited normally. PASS: gdb -nx ./1 -ex 'b f' -ex r Starting program: .../1 Breakpoint 1, f (i=1) at 1.c:4 4 v++; GDB workaround is in the GDB PR above but it touches .debug_line parsing which is sensitive due to missing DWARF prologue end markers - wouldn't a GCC fix be better? Extended opcode 2: set Address to 0x400454 Special opcode 7: advance Address by 0 to 0x400454 and Line by 2 to 3 Advance PC by 47 to 0x400483 Special opcode 5: advance Address by 0 to 0x400483 and Line by 0 to 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^######^^^^^^^^^^^^^^^^^^^^######^^^^ Advance PC by 38 to 0x4004a9 Special opcode 6: advance Address by 0 to 0x4004a9 and Line by 1 to 4 The marked line causes GDB prologue-end detection heuristics to fail. The marked line should be removed. 0000000000400454 : int v; void f (int i, ...) { 400454: 55 push %rbp 400455: 48 89 e5 mov %rsp,%rbp 400458: 48 83 ec 48 sub $0x48,%rsp 40045c: 48 89 b5 58 ff ff ff mov %rsi,-0xa8(%rbp) 400463: 48 89 95 60 ff ff ff mov %rdx,-0xa0(%rbp) 40046a: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp) 400471: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp) 400478: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp) 40047f: 84 c0 test %al,%al 400481: 74 20 je 4004a3 ========= Wrong marker - not hit. 400483: 0f 29 45 80 movaps %xmm0,-0x80(%rbp) 400487: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp) 40048b: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp) 40048f: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp) 400493: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp) 400497: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp) 40049b: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp) 40049f: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp) 4004a3: 89 bd 4c ff ff ff mov %edi,-0xb4(%rbp) ========= Correct prologue end would be here. v++; 4004a9: 8b 05 f1 03 20 00 mov 0x2003f1(%rip),%eax # 6008a0 4004af: 83 c0 01 add $0x1,%eax 4004b2: 89 05 e8 03 20 00 mov %eax,0x2003e8(%rip) # 6008a0 } 4004b8: c9 leaveq 4004b9: c3 retq