Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* problem with conditional breakpoints
@ 2009-09-02  7:09 David Froger
  2009-09-02 15:10 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: David Froger @ 2009-09-02  7:09 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-02 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02  7:09 problem with conditional breakpoints David Froger
2009-09-02 15:10 ` Tom Tromey
2009-09-02 15:31   ` David Froger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox