public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35615]  New: Debug information for .debug_loc section incorrect
@ 2008-03-17 13:58 deuling at de dot ibm dot com
  2008-03-17 16:49 ` [Bug debug/35615] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-17 13:58 UTC (permalink / raw)
  To: gcc-bugs

I compiled a test program with gcc 4.3

    DW_AT_producer    : (indirect string, offset: 0x41): GNU F95 4.3.0

I think this is a bug in gfortran's DWARF code.

[deuling@bbkeks fortran]$ readelf --debug-dump=loc ./neg_array
readelf: Error: Location lists in .debug_info section aren't in ascending
order!
Contents of the .debug_loc section:

   Offset   Begin    End      Expression
   00000000 080485b4 080485b5 (DW_OP_breg4: 4)
   00000000 080485b5 080485b7 (DW_OP_breg4: 8)
   00000000 080485b7 0804868b (DW_OP_breg5: 8)
   00000000 <End of list>
readelf: Warning: There is an overlap [0x2c - 0xfffffffe] in .debug_loc
section.
readelf: Warning: Offset 0xfffffffe is bigger than .debug_loc section size.
readelf: Warning: There is a hole [0xfffffffe - 0x2c] in .debug_loc section.
   0000002c 08048690 08048694 (DW_OP_breg4: 4)
   0000002c 08048694 0804869a (DW_OP_reg1)
   0000002c 0804869a 0804869b (DW_OP_breg4: 4)
   0000002c 0804869b 0804869d (DW_OP_breg4: 8)
   0000002c 0804869d 080486db (DW_OP_breg5: 8)

In GDB this leads to errors in handling the source files correct:

Stack level 0, frame at 0xbf82e720:
eip = 0x80485bd in MAIN__ (\x01:1); saved eip 0x80486c9
source language fortran.


-- 
           Summary: Debug information for .debug_loc section incorrect
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: deuling at de dot ibm dot com


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
@ 2008-03-17 16:49 ` pinskia at gcc dot gnu dot org
  2008-03-17 19:21 ` deuling at de dot ibm dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-17 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-03-17 16:49 -------
Do you have an example source which causes this issue?  Also what target is
this on (I figure it is either powerpc-linux-gnu or powerpc64-linux-gnu)?  Also
what version of gdb are you trying this with (it could be a bug in gdb after
all)?  Also what version of binutils are you using?

Thanks,
Andrew Pinski


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |debug
           Keywords|                            |wrong-debug


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
  2008-03-17 16:49 ` [Bug debug/35615] " pinskia at gcc dot gnu dot org
@ 2008-03-17 19:21 ` deuling at de dot ibm dot com
  2008-03-17 19:29 ` deuling at de dot ibm dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-17 19:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from deuling at de dot ibm dot com  2008-03-17 19:20 -------
Created an attachment (id=15338)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15338&action=view)
Fortran test program

Fortran test program


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
  2008-03-17 16:49 ` [Bug debug/35615] " pinskia at gcc dot gnu dot org
  2008-03-17 19:21 ` deuling at de dot ibm dot com
@ 2008-03-17 19:29 ` deuling at de dot ibm dot com
  2008-03-17 23:32 ` wilson at tuliptree dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-17 19:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from deuling at de dot ibm dot com  2008-03-17 19:28 -------
Hi Andrew,

attached is my little test program I use.

The error is seen both on x86 and PowerPC:

* i686 i686 i386 GNU/Linux
* ppc64 ppc64 ppc64 GNU/Linux

following versions of binutils:

x86: binutils-2.17.50.0.6-5.el5
PowerPC: binutils-2.17.50.0.12-4


objdump -W says:

objdump: Error: Location lists in .debug_info section aren't in ascending
order!
Contents of the .debug_loc section:

    Offset   Begin    End      Expression
    00000000 080485b4 080485b5 (DW_OP_breg4: 4)
    00000000 080485b5 080485b7 (DW_OP_breg4: 8)
    00000000 080485b7 0804868b (DW_OP_breg5: 8)
    00000000 <End of list>
objdump: Warning: There is an overlap [0x2c - 0xfffffffe] in .debug_loc
section.
objdump: Warning: Offset 0xfffffffe is bigger than .debug_loc section size.
objdump: Warning: There is a hole [0xfffffffe - 0x2c] in .debug_loc section.


As seen in comment #1 readelf also gives that error. AFAIK readelf does not
use BFD library as GDB and objdump do so I believe this is not an error
in BFD library.

I use GDB's current head. I also tried gdb-6.5-25.el5_1.1 and it also occurs.

Regards,
Markus Deuling


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (2 preceding siblings ...)
  2008-03-17 19:29 ` deuling at de dot ibm dot com
@ 2008-03-17 23:32 ` wilson at tuliptree dot org
  2008-03-18 13:44 ` deuling at de dot ibm dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: wilson at tuliptree dot org @ 2008-03-17 23:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from wilson at tuliptree dot org  2008-03-17 23:32 -------
Subject: Re:  Debug information for .debug_loc section incorrect

deuling at de dot ibm dot com wrote:
> objdump -W says:
> objdump: Error: Location lists in .debug_info section aren't in ascending
> order!

> As seen in comment #1 readelf also gives that error. AFAIK readelf does not
> use BFD library as GDB and objdump do so I believe this is not an error
> in BFD library.

objdump and readelf have different code for parsing elf files, but they 
unfortunately use common code for dumping dwarf debug info.  And this 
code was broken.  It was fixed 2007-11-16.  With mainline binutils there 
is no error here.  It is broken in binutils-2.18 and earlier.

 From inspecting the debug info, I also don't see anything wrong.

This looks like a gdb bug.  It isn't clear how to reproduce the gdb 
problem.  I don't see any problem with some simple gdb commands on the 
testcase.

Jim


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (3 preceding siblings ...)
  2008-03-17 23:32 ` wilson at tuliptree dot org
@ 2008-03-18 13:44 ` deuling at de dot ibm dot com
  2008-03-18 16:53 ` deuling at de dot ibm dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-18 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from deuling at de dot ibm dot com  2008-03-18 13:43 -------
Hi, 

I build binutils from head and you're right. This issue is fixed:

[deuling@bbkeks binutils]$ ./readelf --debug-dump=loc ~/fortran/neg_array
Contents of the .debug_loc section:

    Offset   Begin    End      Expression
    00000000 080485b4 080485b5 (DW_OP_breg4: 4)
    00000000 080485b5 080485b7 (DW_OP_breg4: 8)
    00000000 080485b7 0804868b (DW_OP_breg5: 8)
    00000000 <End of list>
    0000002c 08048690 08048694 (DW_OP_breg4: 4)
    0000002c 08048694 0804869a (DW_OP_reg1)
    0000002c 0804869a 0804869b (DW_OP_breg4: 4)
    0000002c 0804869b 0804869d (DW_OP_breg4: 8)
    0000002c 0804869d 080486db (DW_OP_breg5: 8)
    0000002c <End of list>


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (4 preceding siblings ...)
  2008-03-18 13:44 ` deuling at de dot ibm dot com
@ 2008-03-18 16:53 ` deuling at de dot ibm dot com
  2008-03-19  0:55 ` amodra at bigpond dot net dot au
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-18 16:53 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 928 bytes --]



------- Comment #6 from deuling at de dot ibm dot com  2008-03-18 16:52 -------
./readelf --debug-dump=line give

for gfortran 4.1.2:

 The Directory Table:
  fortran

 The File Name Table:
  Entry­Dir­····Time­···Size­···Name
  1­····1­······0­······0­······neg_array.F


for gfortran 4.3:

 The Directory Table is empty.

 The File Name Table:
  Entry­Dir­····Time­···Size­···Name
  1­····0­······0­······0­······^A

I think this is the reason that GDB is not able to recognize neg_array.F as a
source code file. Thus it gives:

(gdb) br MAIN__
Breakpoint 1 at 0x80485bd: file \x01, line 1.

I guess this is an error in DWARF ?


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (5 preceding siblings ...)
  2008-03-18 16:53 ` deuling at de dot ibm dot com
@ 2008-03-19  0:55 ` amodra at bigpond dot net dot au
  2008-03-19  1:18 ` amodra at bigpond dot net dot au
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at bigpond dot net dot au @ 2008-03-19  0:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from amodra at bigpond dot net dot au  2008-03-19 00:54 -------
Following up on comment #4, it was this part of Nick's patch that fixed the
--debug-dump=loc problem:
"Correct list of attributes which can reference a location list."
http://sourceware.org/ml/binutils/2007-11/msg00191.html hunk 1123,1137 that
removed DW_AT_lower_bound and others.


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (6 preceding siblings ...)
  2008-03-19  0:55 ` amodra at bigpond dot net dot au
@ 2008-03-19  1:18 ` amodra at bigpond dot net dot au
  2008-03-19  8:48 ` deuling at de dot ibm dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amodra at bigpond dot net dot au @ 2008-03-19  1:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from amodra at bigpond dot net dot au  2008-03-19 01:17 -------
Can you attach the object file that has the odd file name entry?  I can't
reproduce this.


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (7 preceding siblings ...)
  2008-03-19  1:18 ` amodra at bigpond dot net dot au
@ 2008-03-19  8:48 ` deuling at de dot ibm dot com
  2008-03-19  8:49 ` deuling at de dot ibm dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-19  8:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from deuling at de dot ibm dot com  2008-03-19 08:48 -------
Created an attachment (id=15342)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15342&action=view)
x86 binary (neg_array.F) with gfortran 4.3


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (8 preceding siblings ...)
  2008-03-19  8:48 ` deuling at de dot ibm dot com
@ 2008-03-19  8:49 ` deuling at de dot ibm dot com
  2008-03-20  6:56 ` wilson at tuliptree dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-19  8:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from deuling at de dot ibm dot com  2008-03-19 08:48 -------
I attached the binary compiled with gfortran 4.3 on x86.


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (9 preceding siblings ...)
  2008-03-19  8:49 ` deuling at de dot ibm dot com
@ 2008-03-20  6:56 ` wilson at tuliptree dot org
  2008-03-20 13:02 ` deuling at de dot ibm dot com
  2008-03-21 19:31 ` drow at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: wilson at tuliptree dot org @ 2008-03-20  6:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from wilson at tuliptree dot org  2008-03-20 06:56 -------
Subject: Re:  Debug information for .debug_loc section incorrect

deuling at de dot ibm dot com wrote:
> ------- Comment #6 from deuling at de dot ibm dot com  2008-03-18 16:52 -------
> ./readelf --debug-dump=line give

I get a little different output on the executable you attached to the 
PR, but the same effective result that the filename is missing.

  The Directory Table is empty.

  The File Name Table:
   Entry Dir     Time    Size    Name
   1     0       0       0       \x01

Oh, wait, after I pasted it in here I see that I have a non-printing 
control character which wasn't obvious earlier.

Anyways, I don't see this problem when I compile the file myself.  The 
filename is there in the .s file and in the .o file, and in the 
executable.  So there seems to be something wrong with your setup.

You could try tracking down exactly where it fails.  Look for a ".file 1 
tmp.F" directive in the .s file.  Look at the readelf --debug-dump=line 
output for the .o file.  We already know that it is missing in the 
executable.  Depending on where it first goes missing, this is either a 
compiler problem, an assembler problem, or a linker problem.

As before, I do not see any compiler or binutils problem here.

Jim


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (10 preceding siblings ...)
  2008-03-20  6:56 ` wilson at tuliptree dot org
@ 2008-03-20 13:02 ` deuling at de dot ibm dot com
  2008-03-21 19:31 ` drow at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: deuling at de dot ibm dot com @ 2008-03-20 13:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from deuling at de dot ibm dot com  2008-03-20 13:01 -------
The error disappeared :-) I neither changed the compiler nor anything else in
the setup. I just rebuild neg_array and the error is gone.

(gdb) br MAIN__
Breakpoint 1 at 0x80485bd: file neg_array.F, line 1.
(gdb) 

I also have a different Directory Table now. With gfortran 4.1.2 the value
"fortran" was seen in Directory Table ?!? (see comment #6)

 The Directory Table:
  ../../../gcc-4.3.0/libgfortran
  /home/deuling/gcc/gcc-4.3.0-build/./gcc/include

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1       0       0       fmain.c
  2     1       0       0       libgfortran.h
  3     2       0       0       stddef.h

This looks correct to me now. I have no idea what was the cause of that
errors.


-- 


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


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

* [Bug debug/35615] Debug information for .debug_loc section incorrect
  2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
                   ` (11 preceding siblings ...)
  2008-03-20 13:02 ` deuling at de dot ibm dot com
@ 2008-03-21 19:31 ` drow at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: drow at gcc dot gnu dot org @ 2008-03-21 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from drow at gcc dot gnu dot org  2008-03-21 19:30 -------
Closing, then.


-- 

drow at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


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


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

end of thread, other threads:[~2008-03-21 19:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-17 13:58 [Bug fortran/35615] New: Debug information for .debug_loc section incorrect deuling at de dot ibm dot com
2008-03-17 16:49 ` [Bug debug/35615] " pinskia at gcc dot gnu dot org
2008-03-17 19:21 ` deuling at de dot ibm dot com
2008-03-17 19:29 ` deuling at de dot ibm dot com
2008-03-17 23:32 ` wilson at tuliptree dot org
2008-03-18 13:44 ` deuling at de dot ibm dot com
2008-03-18 16:53 ` deuling at de dot ibm dot com
2008-03-19  0:55 ` amodra at bigpond dot net dot au
2008-03-19  1:18 ` amodra at bigpond dot net dot au
2008-03-19  8:48 ` deuling at de dot ibm dot com
2008-03-19  8:49 ` deuling at de dot ibm dot com
2008-03-20  6:56 ` wilson at tuliptree dot org
2008-03-20 13:02 ` deuling at de dot ibm dot com
2008-03-21 19:31 ` drow at gcc dot gnu dot org

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