View Bug Activity | Format For Printing
[Converted from Gnats 822] there is no mechanism in gdb to identify at startup the entry point of the program. gdb knows only about 'main'. Some time ago the set_main_name function was added to gdb, to use the N_MAIN stab directive which identifies the entry point of the program. Dwarf doesn't really have such a thing, but somethng that can be used for the purpose. g77 doesn't emit it however. the dwarf specs 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." I guess that Java and maybe Ada have the same problem. Release: unknown How-To-Repeat: 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
Fix: Elena, I had an initial patch to set the main function in Fortran programs to "MAIN__". Although it can't resolve this totally. But it at least could let gdb recognize that the language is Fortran after just loading the fortran code. Would you like to have a look? I am very happy to get any comments from you on this? Thanks. Here is the link to the original patch: http://sources.redhat.com/ml/gdb-patches/2005-07/msg00220.html
*** Bug 8257 has been marked as a duplicate of this bug. ***
*** Bug 8672 has been marked as a duplicate of this bug. ***