gdb, gfortran and an elementary program
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
gdb, gfortran and an elementary program         


Author: Ron Ford
Date: Jul 7, 2008 19:55

Since the fortran I find interesting is now beyond f95, I'm trying
gfortran's debugger to figure out what object I get when I ask for an
integer in different ways. I hope that my serial failures are about to
give way to getting information from gdb.

The program in question is simple and runs without complaint:
program debug2
USE ISO_C_BINDING, only: C_INT

INTEGER(C_INT) :: I

INTEGER :: J

I = 41
J = 42

PRINT *, I, J

PRINT *, kind(0), c_int

do k = 1,20
print *, k, selected_int_kind(k)
enddo

end program
! gfortran -o debug -g debug2.f03
! gdb debug >text42.txt 2>text43.txt
Show full article (2.88Kb)
13 Comments
Re: gdb, gfortran and an elementary program         


Author: Arjen Markus
Date: Jul 8, 2008 21:38

On 8 jul, 04:55, Ron Ford nowhere.net> wrote:
> Since the fortran I find interesting is now beyond f95, I'm trying
> gfortran's debugger to figure out what object I get when I ask for an
> integer in different ways.  I hope that my serial failures are about to
> give way to getting information from gdb.
>
> The program in question is simple and runs without complaint:
> A huge problem had been that I didn't know how to get gdb's comments from a
> dos window into text.  I thought the app was hanging when I asked it to
> channel stdout, but it was just storing what it should have.  If you can
> remember your commands (and type without mistakes), you can make it work.
> Since I type:

Copying output from a DOS-box involves:
- Patience - I never get it right the first time :)
- The title bar: click on it with the right-hand mouse button
Mark to select the text you want, Copy to copy it into the
clipboard.
Show full article (1.37Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Arjen Markus
Date: Jul 9, 2008 00:16

To copy text from a DOS-box requires:

1. Patience - I never get it right the first time
2. Clicking with the right-hand mouse button on the title bar
(Mark and Copy from the Edit submenu)

The fmain.c and trunk stuff you are seeing are from the
startup code that any program requires in one form or another.
They should not bother you.

Are you sure that you compiled and linked the program with the
-g option?

I tried it myself, but:
"break main" sets a breakpoint at the start of the Fortran program,
"run" and "step" nicely get me to the first statement I typed in.

(Should an earlier reply from me turn up - I do not see it right now
- ignore it, I was confusing two debuggers)

Regards,

Arjen
no comments
Re: gdb, gfortran and an elementary program         


Author: Ron Ford
Date: Jul 9, 2008 18:00

On Tue, 8 Jul 2008 21:38:36 -0700 (PDT), Arjen Markus posted:
> On 8 jul, 04:55, Ron Ford nowhere.net> wrote:
>> Since the fortran I find interesting is now beyond f95, I'm trying
>> gfortran's debugger to figure out what object I get when I ask for an
>> integer...
Show full article (2.22Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Ron Ford
Date: Jul 9, 2008 18:15

On Wed, 9 Jul 2008 00:16:54 -0700 (PDT), Arjen Markus posted:
> To copy text from a DOS-box requires:
>
> 1. Patience - I never get it right the first time
> 2. Clicking with the right-hand mouse button on the title bar
> (Mark and Copy from the Edit submenu)
>
> The fmain.c and trunk stuff you are seeing are from the
> startup code that any program requires in one form or another.
> They should not bother you.
>
> Are you sure that you compiled and linked the program with the
> -g option?
Show full article (8.50Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Arjen Markus
Date: Jul 9, 2008 23:39

On 10 jul, 03:15, Ron Ford nowhere.net> wrote:
> On Wed, 9 Jul 2008 00:16:54 -0700 (PDT), Arjen Markus posted:
>
>> To copy text from a DOS-box requires:
>
>> 1. Patience - I never get it right the first time
>> 2. Clicking with the right-hand mouse button on the title bar
>>    (Mark and Copy from the Edit submenu)
>
>> The fmain.c and trunk stuff you are seeing are from the
>> startup code that any program requires in one form or another.
>> They should not bother you.
>
>> Are you sure that you compiled and linked the program with the
>> -g option?
>
> gfortran -o debug -g debug2.f03
>
>
> ...
Show full article (9.75Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Ron Ford
Date: Jul 11, 2008 11:07

On Wed, 9 Jul 2008 23:39:35 -0700 (PDT), Arjen Markus posted:
> On 10 jul, 03:15, Ron Ford nowhere.net> wrote:
>> On Wed, 9 Jul 2008 00:16:54 -0700 (PDT), Arjen Markus posted:
>> In addition to wondering what this exercise would have looked like had I
>> had fmain.c or main.c, I see that there is more than one type of step.
>> Maybe one of the others is like stepping over as opposed to stepping in?
> Hm, odd, I did not have any trouble with gdb on Linux.
> I do not have gdb available on my machine at work, so I
> can not check it now.
>
> What platform are you using exactly?
Show full article (1.06Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Arjen Markus
Date: Jul 12, 2008 02:17

On 11 jul, 20:07, Ron Ford nowhere.net> wrote:
> On Wed, 9 Jul 2008 23:39:35 -0700 (PDT), Arjen Markus posted:
>
>> On 10 jul, 03:15, Ron Ford nowhere.net> wrote:
>>> On Wed, 9 Jul 2008 00:16:54 -0700 (PDT), Arjen Markus posted:
>>> In addition to wondering what this exercise would have looked like had I
>>> had fmain.c or main.c, I see that there is more than one type of step.
>>> Maybe one of the others is like stepping over as opposed to stepping in?
>> Hm, odd, I did not have any trouble with gdb on Linux.
>> I do not have gdb available on my machine at work, so I
>> can not check it now.
>
>> What platform are you using exactly?
>
> win32 xp.  FX doesn't seem to be around lately, or he might have some
> advice.  One problem with gdb is that there's as much disinformation out
> there as information.  One source I found said that gdb couldn't handle
> anything beyond f77.  I hope that was wrong but so far am unable to
> demonstrate to the contrary.  I posted in gnu.gdb.bug as well, but there
> doesn't seem to be any signs of life there. ...
Show full article (1.46Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Arjen Markus
Date: Jul 12, 2008 02:37

On 12 jul, 11:17, Arjen Markus wrote:
> On 11 jul, 20:07, Ron Ford nowhere.net> wrote:
>
>
>
>
>
>> On Wed, 9 Jul 2008 23:39:35 -0700 (PDT), Arjen Markus posted:
>
>>> On 10 jul, 03:15, Ron Ford nowhere.net> wrote:
>>>> On Wed, 9 Jul 2008 00:16:54 -0700 (PDT), Arjen Markus posted:
>>>> In addition to wondering what this exercise would have looked like had I
>>>> had fmain.c or main.c, I see that there is more than one type of step.
>>>> Maybe one of the others is like stepping over as opposed to stepping in?
>>> Hm, odd, I did not have any trouble with gdb on Linux.
>>> I do not have gdb available on my machine at work, so I
>>> can not check it now.
>
>>> What platform are you using exactly?
> ...
Show full article (2.04Kb)
no comments
Re: gdb, gfortran and an elementary program         


Author: Ron Ford
Date: Jul 14, 2008 19:36

On Sat, 12 Jul 2008 02:37:07 -0700 (PDT), Arjen Markus posted:
> stop MAIN__

C:\Documents and Settings\dan\Desktop\gfortran\source>gdb debug
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are...
Show full article (1.62Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
gdb and gfortran in 7.0?fa.freebsd.current ·
1 2