This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 debug/47471] New: stdarg functions extraneous too-early prologue end


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 
<no breakpoint hit!>
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 <f>:
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 <f+0x4f>
========= 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 <v>
  4004af:       83 c0 01                add    $0x1,%eax
  4004b2:       89 05 e8 03 20 00       mov    %eax,0x2003e8(%rip)        #
6008a0 <v>
}
  4004b8:       c9                      leaveq 
  4004b9:       c3                      retq


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