No, I can't do this in gdb. 

(gdb) print a(4)
  Wrong number of subscripts
 
(gdb) print a(6,1)
  no such vector element

lyle


> Date: Fri, 16 Apr 2010 23:27:44 +0200
> From: ikrabbe....@googlemail.com
> To: bug-gdb@gnu.org
> Subject: Re: Can't Print Two Dimensional Array Element for Fortran
> 
> On Sun, Mar 28, 2010 at 10:50:38PM -0500, lyle lyle wrote:
> > Hi Guys,
> > 
> > I write code in Fortran and found that I couldn't print an element's value
> > if the element wasn't in the first column. For example,
> > 
> > There is an array A and its size is 5x3. In gdb, I can get its first column
> > elements' value with the command: p A(1, 1), until A(5, 1), because the
> > array is saved in memory according to columns. However, if I want to get
> > A(1, 2), then gdb showed the error message: no such vector element.
> > 
> > I searched online and found that another person had reported this bug,
> > https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/500691.
> > 
> > I confirmed that both the version 6.8 and 7.1 had the same problem.
> > 
> > I use gfortran 4.4.3, gdb 7.1, and Debian squeeze.
> > 
> > Is there a patch for this bug? Can someone help me fix  this problem?
> > 
> > Thanks a lot,
> > Lyle
> 
> >       program main
> >       real a(5, 3)
> >       do 12 i=0,4
> >       do 12 j=1,3
> >       a(i+1,j)=i*3+j
> > 12    continue
> >       write(*,*)a(2,3)
> >       end
> 
> Somehow I feel I gave a workaround for this problem before: Each array
> regardless of its dimension can be unfolded to a one dimensional array by
> calculating the array element position. For your (n,m) dimensions you will get
> the one dimensional position k for coordinates (i,j) by k=n*j+i (counted from 
> 0!).
> 
> I haven't tried this and you should test the exact positons, but thats the way
> it should work.
> 
> bye ingo
> 
> 
> _______________________________________________
> bug-gdb mailing list
> bug-gdb@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-gdb
                                          
_________________________________________________________________
Hotmail:Microsoft 提供的强大、安全而且免费的电子邮件服务。
https://signup.live.com/signup.aspx?id=60969
_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gdb

Reply via email to