public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/47471] New: stdarg functions extraneous too-early prologue end
@ 2011-01-26 11:05 jan.kratochvil at redhat dot com
  2011-02-13 17:44 ` [Bug debug/47471] [4.6 Regression] " jsm28 at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-01-26 11:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-02-01  7:09 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 11:05 [Bug debug/47471] New: stdarg functions extraneous too-early prologue end jan.kratochvil at redhat dot com
2011-02-13 17:44 ` [Bug debug/47471] [4.6 Regression] " jsm28 at gcc dot gnu.org
2011-02-13 17:53 ` jsm28 at gcc dot gnu.org
2011-03-25 20:02 ` [Bug debug/47471] [4.6/4.7 " jakub at gcc dot gnu.org
2011-03-28 20:11 ` dodji at gcc dot gnu.org
2011-03-29 15:48 ` dodji at gcc dot gnu.org
2011-03-29 17:52 ` jan.kratochvil at redhat dot com
2011-03-29 18:09 ` jan.kratochvil at redhat dot com
2011-06-27 15:51 ` jakub at gcc dot gnu.org
2011-09-19 14:09 ` philipp at marek dot priv.at
2011-09-19 14:10 ` jan.kratochvil at redhat dot com
2011-10-26 18:06 ` jakub at gcc dot gnu.org
2012-03-01 15:15 ` jakub at gcc dot gnu.org
2013-04-12 15:18 ` [Bug debug/47471] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2013-12-03 16:46 ` psmith at gnu dot org
2014-06-12 13:49 ` [Bug debug/47471] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:34 ` [Bug debug/47471] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-23  8:26 ` [Bug debug/47471] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:01 ` [Bug debug/47471] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub at gcc dot gnu.org
2021-05-14  9:46 ` [Bug debug/47471] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:05 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug debug/47471] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:29 ` jakub at gcc dot gnu.org
2023-01-30 14:26 ` vries at gcc dot gnu.org
2023-02-01  7:09 ` jan at jankratochvil dot net

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).