* gdb with intel fortran compiler
@ 2004-02-25 20:12 Peter Jay Salzman
2004-02-25 20:26 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Peter Jay Salzman @ 2004-02-25 20:12 UTC (permalink / raw)
To: gdb
I found some curious behavior when using GDB with executables compiled
with Intel's fortran 90/95 compiler (ifort). I'm on Debian testing,
kernel 2.4.25, gdb 5.3-debian.
Here's my little "hello world" type program:
PROGRAM hello_world
integer, dimension(20) :: array = (/ (0, i=1,20) /)
do i=1, 20
if (i == 8) then
print *, "hello there, element 8!"
end if
array(i) = i
print *, "element ", i, ": ", array(i)
end do
END PROGRAM hello_world
I can't "list out of the box:
p@satan$ gdb a.out
(gdb) list
1 ../sysdeps/i386/elf/start.S: No such file or directory.
in ../sysdeps/i386/elf/start.S
but I can list the program by name:
(gdb) list hello_world
1 PROGRAM hello_world
2
3 integer, dimension(20) :: array = (/ (0, i=1,20) /)
*snip*
What is causing this, and what's start.S? Is there a way to make this
behavior "nicer"?
The other thing is that the GDB manual says that expressions are
evaluated as they normally are in whatever language you're using. I
this not to be true.
GDB doesn't like this expression in a conditional breakpoint:
(gdb) break 11 if i == 12
A parse error in expression, near `= 12'.
but it does like this one:
(gdb) break 11 if i = 12
Breakpoint 2 at 0x8049da9: file test.f90, line 11.
and it even works:
(gdb) run
Starting program: /home/p/a.out
[New Thread 16384 (LWP 19674)]
[Switching to Thread 16384 (LWP 19674)]
Breakpoint 2, hello_world () at test.f90:11
11 array(i) = i
(gdb) print i
$1 = 12
as promised, we broke at line 11, when i==12. The conditional operator
I used was "=". GDB didn't seem to know "==" which is what the Fortran
language uses for testing. GDB seemed to want the "=", which like in C,
is assignment in F90.
Is this a GDB bug? Is there a way to make expressions work the way they
should work when debugging a F90 executable?
Thanks,
Pete
--
Make everything as simple as possible, but no simpler. -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: gdb with intel fortran compiler
2004-02-25 20:12 gdb with intel fortran compiler Peter Jay Salzman
@ 2004-02-25 20:26 ` Daniel Jacobowitz
2004-02-25 20:40 ` Peter Jay Salzman
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-02-25 20:26 UTC (permalink / raw)
To: Peter Jay Salzman; +Cc: gdb
On Wed, Feb 25, 2004 at 12:06:53PM -0800, Peter Jay Salzman wrote:
> I can't "list out of the box:
>
> p@satan$ gdb a.out
> (gdb) list
> 1 ../sysdeps/i386/elf/start.S: No such file or directory.
> in ../sysdeps/i386/elf/start.S
This is typical. It happens for a lot of non-Fortran programs also.
start.S comes from glibc and is linked into every program.
> GDB doesn't like this expression in a conditional breakpoint:
>
> (gdb) break 11 if i == 12
> A parse error in expression, near `= 12'.
>
> but it does like this one:
>
> (gdb) break 11 if i = 12
> Breakpoint 2 at 0x8049da9: file test.f90, line 11.
Are you sure it didn't modify the variable? :)
> Is this a GDB bug? Is there a way to make expressions work the way they
> should work when debugging a F90 executable?
The only thing you're missing is that GDB does not support F90. No
one's given serious time to the Fortran support in a few years now,
either. So it's assuming that Fortran -> Fortran77, at a guess.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb with intel fortran compiler
2004-02-25 20:26 ` Daniel Jacobowitz
@ 2004-02-25 20:40 ` Peter Jay Salzman
2004-02-26 3:42 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Peter Jay Salzman @ 2004-02-25 20:40 UTC (permalink / raw)
To: gdb
On Wed 25 Feb 04, 3:26 PM, Daniel Jacobowitz <drow@false.org> said:
> On Wed, Feb 25, 2004 at 12:06:53PM -0800, Peter Jay Salzman wrote:
> > I can't "list out of the box:
> >
> > p@satan$ gdb a.out
> > (gdb) list
> > 1 ../sysdeps/i386/elf/start.S: No such file or directory.
> > in ../sysdeps/i386/elf/start.S
Hi Dan,
> This is typical. It happens for a lot of non-Fortran programs also.
> start.S comes from glibc and is linked into every program.
Is there a short explanation of what this is and why it shows up?
It seems to be surpressed when using the idb (Intel's debugger) which,
of course, is less desirable than using my beloved GDB.
Can you point me to a document that talks about what this is? If not,
no worries. I just like learning new things. :)
> > GDB doesn't like this expression in a conditional breakpoint:
> >
> > (gdb) break 11 if i == 12
> > A parse error in expression, near `= 12'.
> >
> > but it does like this one:
> >
> > (gdb) break 11 if i = 12
> > Breakpoint 2 at 0x8049da9: file test.f90, line 11.
>
> Are you sure it didn't modify the variable? :)
yeah:
p@satan$ gdb a.out
(gdb) break hello_world
Breakpoint 1 at 0x8049d55: file test.f90, line 5.
(gdb) run
Starting program: /home/p/a.out
[New Thread 16384 (LWP 20012)]
[Switching to Thread 16384 (LWP 20012)]
Breakpoint 1, hello_world () at test.f90:5
5 do i=1, 20
Current language: auto; currently fortran
(gdb) print i
$1 = 0
(gdb) break 12 if i = 20
Breakpoint 2 at 0x8049db6: file test.f90, line 12.
(gdb) print i
$2 = 0
(gdb) cont
Continuing.
Breakpoint 2, hello_world () at test.f90:12
12 print *, "element ", i, ": ", array(i)
(gdb) print i
$3 = 20
GDB definitely sees the "=" as being a test, not assignment.
> > Is this a GDB bug? Is there a way to make expressions work the way they
> > should work when debugging a F90 executable?
>
> The only thing you're missing is that GDB does not support F90. No
> one's given serious time to the Fortran support in a few years now,
> either. So it's assuming that Fortran -> Fortran77, at a guess.
Heh, OK. That's too bad. I'm a C programmer, and love C, but I also
have a secret love affair with F90 (which I don't want anybody to know
about). ;-)
Pete
--
Make everything as simple as possible, but no simpler. -- Albert Einstein
GPG Instructions: http://www.dirac.org/linux/gpg
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb with intel fortran compiler
2004-02-25 20:40 ` Peter Jay Salzman
@ 2004-02-26 3:42 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-02-26 3:42 UTC (permalink / raw)
To: Peter Jay Salzman; +Cc: gdb
On Wed, Feb 25, 2004 at 12:34:42PM -0800, Peter Jay Salzman wrote:
> On Wed 25 Feb 04, 3:26 PM, Daniel Jacobowitz <drow@false.org> said:
> > On Wed, Feb 25, 2004 at 12:06:53PM -0800, Peter Jay Salzman wrote:
> > > I can't "list out of the box:
> > >
> > > p@satan$ gdb a.out
> > > (gdb) list
> > > 1 ../sysdeps/i386/elf/start.S: No such file or directory.
> > > in ../sysdeps/i386/elf/start.S
>
> Hi Dan,
>
> > This is typical. It happens for a lot of non-Fortran programs also.
> > start.S comes from glibc and is linked into every program.
>
> Is there a short explanation of what this is and why it shows up?
What it is: startup code. It calls glibc initialization functions,
that's all. Why it shows up: I don't know, but almost certainly it is
because GDB does not understand where the main function of your Fortran
program is. We have some support for this that worked, as I said, for
g77.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-02-26 3:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-25 20:12 gdb with intel fortran compiler Peter Jay Salzman
2004-02-25 20:26 ` Daniel Jacobowitz
2004-02-25 20:40 ` Peter Jay Salzman
2004-02-26 3:42 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox