public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/44113]  New: bad
@ 2010-05-13 13:43 andi-gcc at firstfloor dot org
  2010-05-13 13:45 ` [Bug debug/44113] bad andi-gcc at firstfloor dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-05-13 13:43 UTC (permalink / raw)
  To: gcc-bugs

With gdb 7.1 / gcc 4.5.0 I noticed that unrolled loops have very poor
debugging information. The body cannot be single stepped, but a "next"
in gdb jumps over the whole iteration space.

For example:

main()
{
        int i;
        for (i = 0; i < 10; i++)
                printf("%d\n",i );
}

compiled with -O3 -g (which results in auto unrolling) gives:

(gdb) b main
Breakpoint 1 at 0x400520: file tloop2.c, line 2.
(gdb) r
Starting program: /home2/andi/tsrc/tloop2 

Breakpoint 1, main () at tloop2.c:2
2       {
(gdb) n
5                       printf("%d\n",i );
(gdb) n
0
1
2
3
4
5
6
7
8
6       }
(gdb) 

Note the single next stepped over the complete loop execution.
I would have expected next to only execute one iteration.

Is this a problem of the loop unroller not describing the unrolled
loop to the debugger?


-- 
           Summary: bad
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andi-gcc at firstfloor dot org
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
@ 2010-05-13 13:45 ` andi-gcc at firstfloor dot org
  2010-05-13 15:36 ` [Bug debug/44113] bad debugging information for unrolled loops rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-05-13 13:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from andi-gcc at firstfloor dot org  2010-05-13 13:44 -------
Hmm sorry actually it stepped over everything except the last iteration.
Still unexpected


-- 

andi-gcc at firstfloor dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|bad                         |bad


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
  2010-05-13 13:45 ` [Bug debug/44113] bad andi-gcc at firstfloor dot org
@ 2010-05-13 15:36 ` rguenth at gcc dot gnu dot org
  2010-05-13 16:16 ` andi-gcc at firstfloor dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-13 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-05-13 15:36 -------
Well, you step to the next line-number and only lines #5 are remaining, so
I think you just get what you asked for.  I don't know if we could (or should)
signal to gdb that there are multiple lines #5 now.  Jakub?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot
                   |                            |org, rguenth at gcc dot gnu
                   |                            |dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
  2010-05-13 13:45 ` [Bug debug/44113] bad andi-gcc at firstfloor dot org
  2010-05-13 15:36 ` [Bug debug/44113] bad debugging information for unrolled loops rguenth at gcc dot gnu dot org
@ 2010-05-13 16:16 ` andi-gcc at firstfloor dot org
  2010-05-13 17:14 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-05-13 16:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from andi-gcc at firstfloor dot org  2010-05-13 16:16 -------
I think it should describe multiple lines.

next is expected to iterate through loops, not skip them.
If I wanted to skip I would use "until"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (2 preceding siblings ...)
  2010-05-13 16:16 ` andi-gcc at firstfloor dot org
@ 2010-05-13 17:14 ` pinskia at gcc dot gnu dot org
  2010-05-19 14:52 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-05-13 17:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2010-05-13 17:13 -------
Confirmed.  Though with the 4.5.0 and above we do have a debug_stmt with the
correct line info at the tree level ...


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-debug
      Known to fail|                            |4.1.3 4.2.4 4.6.0 4.3.2
   Last reconfirmed|0000-00-00 00:00:00         |2010-05-13 17:13:45
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (3 preceding siblings ...)
  2010-05-13 17:14 ` pinskia at gcc dot gnu dot org
@ 2010-05-19 14:52 ` jakub at gcc dot gnu dot org
  2010-05-19 15:40 ` andi-gcc at firstfloor dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-19 14:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-05-19 14:52 -------
The problem is just that there are no instructions with locus on line 4 - with
unrolling no traces of the for loop in the assembly remains and all
instructions in the body have line 5 and immediately after it another unrolled
iteration has the same line.
Apparently gdb on next just puts a breakpoint on the first insn after it that
has different file or line number.  GCC could emit extra .loc 1 5 0 directives
which would just add another row in the line table, or .loc 1 5 0 is_stmt 0
right after the first insn and .loc 1 5 0 is_stmt 1 back before first insn of
the next iteration, but apparently this doesn't change anything in gdb.  Not
even lying and alternating .loc 1 5 0 and .loc 1 5 1 helps.  And, putting
extra .loc 1 4 0 covering no instructions doesn't change anything either.

So I'm afraid there is nothing to do here on the gcc side, except lying that
some insn comes from some other line (and for unrolling where the body is just
one insn there is nothing to do at all).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (4 preceding siblings ...)
  2010-05-19 14:52 ` jakub at gcc dot gnu dot org
@ 2010-05-19 15:40 ` andi-gcc at firstfloor dot org
  2010-05-19 15:46 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-05-19 15:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from andi-gcc at firstfloor dot org  2010-05-19 15:40 -------
Jakub, are you saying this should be fixed in gdb? 
How could gdb detect this case?

If gcc emitted another .loc like you said couldn't gdb check for this?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (5 preceding siblings ...)
  2010-05-19 15:40 ` andi-gcc at firstfloor dot org
@ 2010-05-19 15:46 ` jakub at gcc dot gnu dot org
  2010-05-19 18:09 ` drow at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-19 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2010-05-19 15:45 -------
I guess that needs discussion with the GDB folks...


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org, jan dot kratochvil at
                   |                            |redhat dot com, drow at gcc
                   |                            |dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (6 preceding siblings ...)
  2010-05-19 15:46 ` jakub at gcc dot gnu dot org
@ 2010-05-19 18:09 ` drow at gcc dot gnu dot org
  2010-05-21 13:00 ` jakub at gcc dot gnu dot org
  2010-05-24 19:50 ` jan dot kratochvil at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: drow at gcc dot gnu dot org @ 2010-05-19 18:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from drow at gcc dot gnu dot org  2010-05-19 18:08 -------
It seems to me that a series of line notes for each copy of line 5 are the
right debug output, and if GCC can generate that, someone should hack up GDB
until it recognizes that and treats it sensibly.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (7 preceding siblings ...)
  2010-05-19 18:09 ` drow at gcc dot gnu dot org
@ 2010-05-21 13:00 ` jakub at gcc dot gnu dot org
  2010-05-24 19:50 ` jan dot kratochvil at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-21 13:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2010-05-21 13:00 -------
I think it would be better first to change gdb to handle this and then gcc
start emitting it.  For testing, one can ammend gcc generated assembly with a
couple of extra .loc directives.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

* [Bug debug/44113] bad debugging information for unrolled loops
  2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
                   ` (8 preceding siblings ...)
  2010-05-21 13:00 ` jakub at gcc dot gnu dot org
@ 2010-05-24 19:50 ` jan dot kratochvil at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-05-24 19:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jan dot kratochvil at redhat dot com  2010-05-24 19:49 -------
GDB counterpart (no patch now):
http://sourceware.org/bugzilla/show_bug.cgi?id=11631


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44113


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

end of thread, other threads:[~2010-05-24 19:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-13 13:43 [Bug debug/44113] New: bad andi-gcc at firstfloor dot org
2010-05-13 13:45 ` [Bug debug/44113] bad andi-gcc at firstfloor dot org
2010-05-13 15:36 ` [Bug debug/44113] bad debugging information for unrolled loops rguenth at gcc dot gnu dot org
2010-05-13 16:16 ` andi-gcc at firstfloor dot org
2010-05-13 17:14 ` pinskia at gcc dot gnu dot org
2010-05-19 14:52 ` jakub at gcc dot gnu dot org
2010-05-19 15:40 ` andi-gcc at firstfloor dot org
2010-05-19 15:46 ` jakub at gcc dot gnu dot org
2010-05-19 18:09 ` drow at gcc dot gnu dot org
2010-05-21 13:00 ` jakub at gcc dot gnu dot org
2010-05-24 19:50 ` jan dot kratochvil at redhat dot com

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