www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/05/25/18:26:22

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199905252225.RAA27396@mercury.xraylith.wisc.edu>
To: "Richard Stanton" <stanton AT Haas DOT Berkeley DOT EDU>
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Problems with gdb and FORTRAN programs
In-Reply-To: Your message of "Tue, 25 May 1999 13:18:52 PDT."
<000a01bea6eb$ceaa8680$8f4b2080 AT berkeley DOT edu>
Date: Tue, 25 May 1999 17:25:07 -0500
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

"Richard Stanton" <stanton AT Haas DOT Berkeley DOT EDU> writes:
> I'm writing/debugging some FORTRAN code using egcs 1.1.2 and gdb 4.17.1.
> There seem to be some problems viewing variables with gdb in fortran mode.
> For example,
> 
> Breakpoint 1, getdat_ (data=0xf0be20, m=0x30720d0, n=0x30720d4) at
> snpdata.f:40
> (gdb) print n
> $2 = (PTR TO -> ( integer )) 0x30720d4
> (gdb) set lang c
> Warning: the current language does not match this frame.
> (gdb) print n[0]
> $3 = 491
> (gdb) set lang fortran
> (gdb) print n(1)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x30720d9 in ?? ()
> The program being debugged stopped while in a function called from GDB.
> When the function (at 0x30720d4) is done executing, GDB will silently
> stop (instead of continuing to evaluate the expression containing
> the function call).
> (gdb)
> 
> How can I view the contents of the variable n in fortran mode?

This is certainly a bug, and I have no clue as to how to attack this
problem. There are two separate problems when debugging g77 code:

  - gdb still doesn't grok fortran mode well. It likes Sun's f77 if
    I remember correctly (or did many years ago when I had to debug
    my old code).

  - g77 doesn't write out debug info in very usable form.

Your particular problem however has an easy, albeit non-fortran'y,
solution:
  
  (gdb) print *n
  491

That should work, at least in theory. btw, gdb-4.18 does not solve this
problem, and this problem is not unique to Cygwin port by any means.

We just have to wait until this bug hits one of those rare folks who know 
more about g77's debug info output and gdb's handling of it. Anybody know
how to bribe Craig Burley or Toon Moene?

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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