www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/22:51:12

Newsgroups: comp.os.msdos.djgpp
From: D DOT J DOT Murdoch AT bris DOT ac DOT uk (Duncan Murdoch)
Subject: Re: f2c, djgpp, and gdb
Message-ID: <32fe20e2.42516071@news.bris.ac.uk>
Sender: usenet AT fsa DOT bris DOT ac DOT uk (Usenet)
Organization: University of Bristol, England
References: <32fdfec7 DOT 21756345 AT news DOT bris DOT ac DOT uk>
Mime-Version: 1.0
Date: Sun, 9 Feb 1997 20:15:32 GMT
Lines: 38
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sat, 8 Feb 1997 22:39:07 GMT, D DOT J DOT Murdoch AT bris DOT ac DOT uk (Duncan
Murdoch) wrote:

>I'm trying to use f2c with djgpp, and almost everything appears to be
>fine except for debugging.  There are several suggestions in the
>various help files that if I use the f2c -g option to put lines like 
>
>#line 1 "reject.f"       
>
>into the generated C, then gdb should show me the Fortran source,
>rather than the C source.  However, I can't seem to get that to
>happen.  

After a suggestion from Eli Zaretskii, I found the solution to this
myself.  This should also work for people using other code generators
(Bison, etc.):

To debug a Fortran program "myprog.f" using f2c, gcc and gdb:

  1.  Run f2c with the -g option:
          
         f2c -g myprog.f

  2.  Compile using gcc with the -g option.

         gcc -g myprog.c   -o myprog.exe -lf2c -lm

  3.  Copy the fortran over myprog.c:

         copy myprog.f myprog.c

  4.  Run gdb:

         gdb myprog.exe

Duncan Murdoch



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019