gdb dies debugging fortran program

L Anderson lowella@mvseac.com
Mon Aug 13 01:50:00 GMT 2012


L Anderson wrote:
> Christopher Faylor wrote:
>> On Sun, Aug 12, 2012 at 12:59:35PM -0700, L Anderson wrote:
>>> I trying to use gdb to debug a fortran program compiled with gfortran
>>> but gdb inconsistently dies in the process.  I have written a
>>> small fortran program that exhibits the problem.
>>>
>>> The test program is:
>>>
>>> <code>
>>>        PROGRAM GDBDIES
>>>
>>> C     PROGRAM TO SHOW GDB DIES DEBUGGING IT
>>>        IMPLICIT INTEGER (A-Z)
>>>
>>>        A = 1
>>>
>>>        B = 2
>>>
>>>        IF (B.EQ.2) GOTO 20
>>>
>>>        C = 4
>>>
>>>     20 D = 200
>>>
>>>        END
>>> </code>
>>>
>>> I compiled it with:
>>>
>>> $ gfortran -g -o gdbdies gdbdies.f
>>>
>>> and ran it under gdb thusly:
>>>
>>> $ gdb gdbdies.exe
>>> GNU gdb (GDB) 7.3.50.20111026-cvs (cygwin-special)
>>> Copyright (C) 2011 Free Software Foundation, Inc.
>>> License GPLv3+: GNU GPL version 3 or later
>>> <http://gnu.org/licenses/gpl.html>
>>> This is free software: you are free to change and redistribute it.
>>> There is NO WARRANTY, to the extent permitted by law.  Type "show
>>> copying"
>>> and "show warranty" for details.
>>> This GDB was configured as "i686-cygwin".
>>> For bug reporting instructions, please see:
>>> <http://www.gnu.org/software/gdb/bugs/>...
>>> Reading symbols from /cygdrive/m/Langpak/src/gdbdies.exe...done.
>>> (gdb) b 9
>>> Breakpoint 1 at 0x40117d: file gdbdies.f, line 9.
>>> (gdb) run
>>> Starting program: /cygdrive/m/Langpak/src/gdbdies.exe
>>> [New Thread 4672.0x1630]
>>> [New Thread 4672.0x15b8]
>>>
>>> Breakpoint 1, gdbdies () at gdbdies.f:9
>>> 9             B = 2
>>> (gdb) n
>>> 10            C = 3
>>> (gdb) n
>>> 11            IF (C.EQ.3) GOTO 20
>>> (gdb) n    <<<---here's where it goes out to lunch and never comes back.
>>>
>>> gdb doesn't consistently die in the same place--it seems to be related
>>> to where the breakpoint is set.  However, it seems to more consistently
>>> die just after line 11 where the GOTO 20 is.
>>>
>>> My system is XP Pro SP3 with Cygwin DLL version 1.7.16
>>>
>>>
>>> Is this a bug in gdb or am I doing something wrong?
>>
>> Are you running gdb under mintty or on a windows console.  I've seen a
>> problem with gdb running in a console which manifests the way you
>> describe.  Running under mintty usually works better.
>>
> Running under mintty--haven't used windows console for cygwin in ages.
>

aaargggg!! I'm embarrassed! I have two shortcuts I use to run cygwin and 
I thought they were both the same--mintty. But, alas, one was mintty and 
one was windows console.  The console was the one that failed but the 
mintty seems to work.  This explains why the results were 
inconsistent--sometimes mintty(worked) sometimes console(failed).

At least there appears to be a problem with windows console and gdb.

LA


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list