From: David Froger <david.froger@gmail.com>
To: gdb@sourceware.org
Subject: problem with conditional breakpoints
Date: Wed, 02 Sep 2009 07:09:00 -0000 [thread overview]
Message-ID: <9309543c0909020009r7a0831afj23fa2ad42871421c@mail.gmail.com> (raw)
Hy,
I have a problem using conditional breakpoints (I'm new to gdb. It's a
really great software!). I write a little Fortran program to explain
it, given below.
Thanks for any reply and for your attention,
David
==> versions
$ gfortran -v
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)
$ gdb -v
GNU gdb 6.8-debian
Copyright (C) 2008 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 "i486-linux-gnu".
==> The bash and gdb commands are:
1. It works:
$ gfortran -g -o main.x main.f90
$ gdb ./main.x
(gdb) b 20 if i==2 && j==2
2. It works:
$ gfortran -g -o main.x main.f90
$ gdb ./main.x
(gdb) b 55 if i==2 && j==2
3. It doesn't work:
$ gfortran -g -o main.x main.f90
$ gdb ./main.x
(gdb) b addmat
(gdb) run
(gdb) b 55 if i==2 && j==2
A syntax error in expression, near `=2 && j==2'.
==> The Fortran 90 source file is:
!file: main.f90
!===================================================
program main
!sum two matrix S=A+B and print A,B,S
!===================================================
implicit none
integer,parameter:: nx=5, ny=3
integer:: i,j
real,dimension(nx,ny):: A,B,S
real:: lx=10., ly=20.
!fill the matrix A and B
do i = 1,nx
do j = 1,ny
A(i,j) = real(i+j) !this is line 20 (breakpoint)
B(i,j) = real(i*j)
enddo
enddo
!sum S=A+B
call addmat(S,A,B,nx,ny)
!print the matrx A, B and C
write(*,*) 'Matrice A='
call affMat(A,nx,ny)
write(*,*)
write(*,*) 'Matrice B='
call affMat(B,nx,ny)
write(*,*)
write(*,*) 'Matrice S='
call affMat(S,nx,ny)
write(*,*)
end program main
!===================================================
subroutine addmat(S,A,B,nx,ny)
!sum two matrix A and B: S=A+B
!===================================================
integer::nx,ny
real,dimension(nx,ny),intent(in):: A,B
real,dimension(nx,ny),intent(out):: S
do i = 1,nx
do j = 1,ny
S(i,j) = A(i,j)+B(i,j) !this a line 55 (breakpoint)
enddo
enddo
end subroutine addmat
!===================================================
subroutine affMat(matrice,nx,ny)
!print a matrix with rows an columns
!===================================================
implicit none
integer nx, ny, i, j
real matrice
dimension matrice(nx,ny)
character(len=2) ny_char
write(ny_char,fmt='(i2)') ny
do i=1,nx
write(*,fmt='('//ny_char//'f12.7)') ( matrice(i,j) , j=1,ny )
!for instance, if ny=5, the previous line mean:
!write(*,fmt='( 5f12.7)') ( matrice(i,j) , j=1,ny )
enddo
end subroutine affMat
next reply other threads:[~2009-09-02 7:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 7:09 David Froger [this message]
2009-09-02 15:10 ` Tom Tromey
2009-09-02 15:31 ` David Froger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9309543c0909020009r7a0831afj23fa2ad42871421c@mail.gmail.com \
--to=david.froger@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox