[Bug fortran/35615] New: Debug information for .debug_loc section incorrect

2008-03-17 Thread deuling at de dot ibm dot com
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.

[EMAIL PROTECTED] 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   BeginEnd  Expression
    080485b4 080485b5 (DW_OP_breg4: 4)
    080485b5 080485b7 (DW_OP_breg4: 8)
    080485b7 0804868b (DW_OP_breg5: 8)
    
readelf: Warning: There is an overlap [0x2c - 0xfffe] in .debug_loc
section.
readelf: Warning: Offset 0xfffe is bigger than .debug_loc section size.
readelf: Warning: There is a hole [0xfffe - 0x2c] in .debug_loc section.
   002c 08048690 08048694 (DW_OP_breg4: 4)
   002c 08048694 0804869a (DW_OP_reg1)
   002c 0804869a 0804869b (DW_OP_breg4: 4)
   002c 0804869b 0804869d (DW_OP_breg4: 8)
   002c 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__ (: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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-17 Thread deuling at de dot ibm dot com


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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-17 Thread deuling at de dot ibm dot com


--- 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   BeginEnd  Expression
 080485b4 080485b5 (DW_OP_breg4: 4)
 080485b5 080485b7 (DW_OP_breg4: 8)
 080485b7 0804868b (DW_OP_breg5: 8)
 
objdump: Warning: There is an overlap [0x2c - 0xfffe] in .debug_loc
section.
objdump: Warning: Offset 0xfffe is bigger than .debug_loc section size.
objdump: Warning: There is a hole [0xfffe - 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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-18 Thread deuling at de dot ibm dot com


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

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

Offset   BeginEnd  Expression
 080485b4 080485b5 (DW_OP_breg4: 4)
 080485b5 080485b7 (DW_OP_breg4: 8)
 080485b7 0804868b (DW_OP_breg5: 8)
 
002c 08048690 08048694 (DW_OP_breg4: 4)
002c 08048694 0804869a (DW_OP_reg1)
002c 0804869a 0804869b (DW_OP_breg4: 4)
002c 0804869b 0804869d (DW_OP_breg4: 8)
002c 0804869d 080486db (DW_OP_breg5: 8)
002c 


-- 


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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-18 Thread deuling at de dot ibm dot com


--- 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 , line 1.

I guess this is an error in DWARF ?


-- 


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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-19 Thread deuling at de dot ibm dot com


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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-19 Thread deuling at de dot ibm dot com


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



[Bug debug/35615] Debug information for .debug_loc section incorrect

2008-03-20 Thread deuling at de dot ibm dot com


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