public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/12257] gdb ignore line "bar: if(foo)goto bar;"
Date: Tue, 07 Feb 2012 20:47:00 -0000	[thread overview]
Message-ID: <bug-12257-4717-7i2Eg0XxVc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12257-4717@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=12257

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at redhat dot com
         Resolution|                            |INVALID

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-02-07 20:46:45 UTC ---
I think this is a gcc bug, not a gdb bug.

On Fedora 15,with the system gcc, it fails for me if I compile with -g.
But if I use -g -O1, it works

With plain -g, the line number table looks like:

CU: pr.c:
File name                            Line number    Starting address
pr.c                                           4            0x400534
pr.c                                           6            0x40053c
pr.c                                           7            0x40054e
pr.c                                           8            0x400569
pr.c                                           8            0x40056a
pr.c                                           9            0x400571
pr.c                                          10            0x400576

Note the address of the first occurrence of line 8.
Then if I disassemble I see:

        scanf("%d", &foo);
  40054e:       b8 84 06 40 00          mov    $0x400684,%eax
  400553:       48 8d 55 fc             lea    -0x4(%rbp),%rdx
  400557:       48 89 d6                mov    %rdx,%rsi
  40055a:       48 89 c7                mov    %rax,%rdi
  40055d:       b8 00 00 00 00          mov    $0x0,%eax
  400562:       e8 d1 fe ff ff          callq  400438 <__isoc99_scanf@plt>
  400567:       eb 01                   jmp    40056a <main+0x36>
bar:    if(foo)goto bar;
  400569:       90                      nop
  40056a:       8b 45 fc                mov    -0x4(%rbp),%eax
  40056d:       85 c0                   test   %eax,%eax
  40056f:       75 f8                   jne    400569 <main+0x35>
        return 0;

That is, the first "line 8" is that nop, which is skipped after the call.

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


  parent reply	other threads:[~2012-02-07 20:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 10:55 [Bug gdb/12257] New: " safinaskar at mail dot ru
2010-11-23 14:13 ` [Bug gdb/12257] " safinaskar at mail dot ru
2012-02-07 20:47 ` tromey at redhat dot com [this message]
2012-02-07 21:17 ` safinaskar at mail dot ru
2012-02-07 21:46 ` pinskia at gcc dot gnu.org
2012-02-08 16:26 ` tromey at redhat dot com
2012-02-08 21:39 ` tromey at redhat dot com
2013-04-13  7:40 ` [Bug gdb/12257] gdb ignores " safinaskar at mail dot ru
2020-03-08 10:54 ` andrew.burgess at embecosm dot 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-12257-4717-7i2Eg0XxVc@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: link
Be 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).