fortran/2048: cannot set breakpoint in preprocessed fortran code

jimb@redhat.com jimb@redhat.com
Wed Dec 7 00:34:00 GMT 2005


Synopsis: cannot set breakpoint in preprocessed fortran code

State-Changed-From-To: open->closed
State-Changed-By: jimb
State-Changed-When: Wed Dec  7 00:34:58 2005
State-Changed-Why:
    (Congratulations!  You have filed the 2**12 bug report!)
    
    I can reproduce the behavior you describe.  This looks like a GCC bug to me.
    
    The output from 'readelf -wil main' is as follows:
    
    The section .debug_info contains:
    
      Compilation Unit @ 0:
       Length:        132
       Version:       2
       Abbrev Offset: 0
       Pointer Size:  8
     <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
         DW_AT_stmt_list   : 0	
         DW_AT_high_pc     : 0x400830	
         DW_AT_low_pc      : 0x4007e8	
         DW_AT_producer    : GNU F95 4.0.1 20050727 (Red Hat 4.0.1-5)	
         DW_AT_language    : 14	(Fortran 95)
         DW_AT_name        : main.f	
         DW_AT_comp_dir    : /home/jimb/gdb/bugs/2048	
     <1><6a>: Abbrev Number: 2 (DW_TAG_subprogram)
         DW_AT_external    : 1	
         DW_AT_name        : MAIN__	
         DW_AT_decl_file   : 1	
         DW_AT_decl_line   : 4	
         DW_AT_low_pc      : 0x4007e8	
         DW_AT_high_pc     : 0x400830	
         DW_AT_frame_base  : 1 byte block: 56 	(DW_OP_reg6)
    
    
    Dump of debug contents of section .debug_line:
    
      Length:                      50
      DWARF Version:               2
      Prologue Length:             26
      Minimum Instruction Length:  1
      Initial value of 'is_stmt':  1
      Line Base:                   -5
      Line Range:                  14
      Opcode Base:                 10
      (Pointer size:               8)
    
     Opcodes:
      Opcode 1 has 0 args
      Opcode 2 has 1 args
      Opcode 3 has 1 args
      Opcode 4 has 1 args
      Opcode 5 has 1 args
      Opcode 6 has 0 args
      Opcode 7 has 0 args
      Opcode 8 has 0 args
      Opcode 9 has 1 args
    
     The Directory Table is empty.
    
     The File Name Table:
      Entry	Dir	Time	Size	Name
      1	0	0	0	main.F
    
     Line Number Statements:
      Extended opcode 2: set Address to 0x4007e8
      Special opcode 8: advance Address by 0 to 0x4007e8 and Line by 3 to 4
      Special opcode 61: advance Address by 4 to 0x4007ec and Line by 0 to 4
      Advance PC by 68 to 400830
      Extended opcode 1: End of Sequence
    
    Note that the filename given in the DW_TAG_compile_unit is 'main.f', which is wrong: there is no such source file in this compilation.  Temporaries created by the compiler should not be mentioned in debugging information.  Please file a GCC bug about this at http://gcc.gnu.org/bugzilla/.
    
    The correct file name, 'main.F', appears in the line number information.  But GDB uses the compilation unit's filename as the default source file.  If you set your breakpoint on 'main.F:4' instead of '4', then things will work:
    
    GNU gdb 6.4.50.20051205-cvs
    Copyright 2005 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "x86_64-unknown-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".
    
    (gdb) break main.F:4
    Breakpoint 1 at 0x4007e8: file main.F, line 4.
    (gdb) run
    Starting program: /home/jimb/gdb/bugs/2048/main
    
    Breakpoint 1, MAIN__ () at main.F:4
    4               WRITE(*,*) 'Hello World'
    Current language:  auto; currently fortran
    (gdb) next
    4               WRITE(*,*) 'Hello World'
    (gdb) c
    Continuing.
     Hello World
    
    Program exited normally.
    (gdb)

http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2048



More information about the Gdb-prs mailing list