This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 4052 - gdb can't see f77 source
gdb can't see f77 source
Status: CLOSED CANTFIX
Product: Red Hat Linux
Classification: Retired
Component: gdb (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Elena Zannoni
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-07-15 07:22 EDT by s.c.potter
Modified: 2007-04-18 12:23 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-18 10:13:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Simple FORTRAN example file, for those unfamiliar with the language (63 bytes, text/plain)
2001-06-04 09:45 EDT, Trond Eivind Glomsrxd
no flags Details

  None (edit)
Description s.c.potter 1999-07-15 07:22:00 EDT
gdb can view source files of programs written in C, but not
those of F77 programs.

Test: write helloworld.f, compile ("g77 -g ...") and try to
view source in gdb. It works for helloworld.c but not the
fortran version.

gdb man page says "Fortran support will be added when a
GNU  Fortran compiler is ready." ... but I have a GNU
Fortran compiler - g77!

Versions installed are:

egcs-1.1.2-12
egcs-c++-1.1.2-12
egcs-g77-1.1.2-12
gdb-4.17.0.11-6
xxgdb-1.12-10
Comment 1 Jim Kingdon 1999-07-24 13:32:59 EDT
This is an xxgdb bug; I had no trouble seeing the source in plain
GDB but I was able to reproduce the problem by "xxgdb a.out"
(with C it starts up with the source showing; with FORTRAN it
says "No source file").

Here is the hello world program I used for the benefit of the
FORTRAN-impaired:

      WRITE (*, FMT=9000) 1.5
 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
      END
Comment 2 Trond Eivind Glomsrxd 2001-01-24 23:05:20 EST
At the time, g77 wasn't a GNU compiler - egcs was not a GNU project.

Anyway, it doesn't seem to work now.
Comment 3 Trond Eivind Glomsrxd 2001-06-04 09:45:15 EDT
Still a problem...
Comment 4 Trond Eivind Glomsrxd 2001-06-04 09:45:52 EDT
Created attachment 20202 [details]
Simple FORTRAN example file, for those unfamiliar with the language
Comment 5 Trond Eivind Glomsrxd 2001-06-04 18:22:18 EDT
(This bug isn't considered a xxgdb bug now, but a gdb bug)

This is with a GDB snapshot from 2001-06-01:

[teg@halden teg]$ cat hello.f 
      PROGRAM hello

      print *,"Hello, world!"

      END 
[teg@halden teg]$ g77 -g hello.f -o hello
[teg@halden teg]$ gdb hello
GNU gdb Red Hat Linux 7.x (5.0rh-10)
Copyright 2001 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 "i386-redhat-linux"...
(gdb) list 
1       init.c: No such file or directory.
        in init.c
(gdb) b MAIN__
Breakpoint 1 at 0x8048e96: file hello.f, line 3.
(gdb) l
1       in init.c
(gdb) r
Starting program: /home/devel/teg/hello 

Breakpoint 1, MAIN__ () at hello.f:3
3             print *,"Hello, world!"
Current language:  auto; currently fortran
(gdb) l
1             PROGRAM hello
2
3             print *,"Hello, world!"
4
5             END 
(gdb) The program is running.  Exit anyway? (y or n) y
[teg@halden teg]$

If you know to break at MAIN__ it works, but "list" should work without having
to do that.
Comment 6 Trond Eivind Glomsrxd 2001-11-28 17:45:33 EST
Still a problem with gdb 5.1
Comment 7 Bas Bossink 2001-12-31 23:19:30 EST
The same problem can be reproduced with a C version of the Hello World program, 
or any C program for that matter. I have not tried a similar approach to 
setting the breakpoint but I agree with the above comment. This bug is a 
nucance especially for newbies (who'll think they are doing something wrong).
Comment 8 Trond Eivind Glomsrxd 2002-01-01 07:22:39 EST
No, this doesn't happen with C programs. It's a problem specific to FORTRAN 77.
Remember to build with "-g".
Comment 9 Trond Eivind Glomsrxd 2002-05-07 17:57:58 EDT
(just tested with gdb 5.2 - still no FORTRAN love).
Comment 10 Elena Zannoni 2002-11-12 18:09:44 EST
Still a problem.

More analysis:

GDB doesn't know about the various languages' conventions for naming the main
program.
MAIN__ in fortran, main in C, etc. 

Gdb has a mechanism to figure out the name of main from STABS debug info. Such
debug info has an N_MAIN directive that has value equal to the name of main.
Once gdb knows the name of main, it can also figure out what the list command
should default to displaying.  (look at set_main_name())

For Dwarf2/3, the spec says:
"If the semantics of the language  of  the  compilation  unit
 containing   the   subroutine  entry  distinguishes  between
 ordinary subroutines and subroutines that can serve  as  the
 ``main program,'' that is, subroutines that cannot be called
 directly following the ordinary  calling  conventions,  then
 the  debugging  information  entry for such a subroutine may
 have a calling  convention  attribute  whose  value  is  the
 constant DW_CC_program.
 The  DW_CC_program value is intended to support Fortran main
 programs.  It is not intended as a way of finding the  entry
 address for the program."

however as of gcc-3.2 such directive is not emitted.

I filed a PR in the FSF gnats database. The PR number is: gdb/822
Comment 11 Matthew Miller 2006-04-13 23:49:19 EDT
Trivia fun-fact: this is one of _two_ remaining four-digit bugs (not counting
bugzilla-bugs.) Is it still an issue in FC5? A quick web searched turned up a
message with the phrase "The problems stated in GDB PR 822, GCC 10220 are 
all gone."
Comment 12 Bill Nottingham 2006-08-07 13:11:28 EDT
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Red Hat apologizes that these issues have not been resolved yet. We do
want to make sure that no important bugs slip through the cracks.
Please check if this issue is still present in a current Fedora Core
release. If so, please change the product and version to match, and
check the box indicating that the requested information has been
provided. Note that any bug still open against Red Hat Linux on will be
closed as 'CANTFIX' on September 30, 2006. Thanks again for your help.
Comment 13 Bill Nottingham 2006-10-18 10:13:16 EDT
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Closing as CANTFIX.

Note You need to log in before you can comment on or make changes to this bug.