This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem with conditional breakpoints


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]