Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* cannot print allocatable arrays
@ 2011-09-23 15:20 Lurkos
  2011-09-23 15:26 ` Jan Kratochvil
  2011-09-23 15:32 ` Joachim Protze
  0 siblings, 2 replies; 5+ messages in thread
From: Lurkos @ 2011-09-23 15:20 UTC (permalink / raw)
  To: gdb

I'm using gdb 7.0.1-debian and gfortran 4.4.5 on Debian squeeze amd64.

I'm not able to print arrays that are declared as allocatable.
It seems that gdb is not able to detect the correct size of the array
allocated run-time.
Is there a different way to print the values in this case?

Thank you.

+++ Test case 1: allocatable array +++
---------- code ----------
program arrshow
  implicit none
  integer,parameter :: n = 5
  integer,allocatable,dimension(:) :: vect
  integer :: i

  allocate(vect(n))

  do i=1,n
    vect(i) = i
  enddo
  
  write(unit=*,fmt=*) vect
  
  deallocate(vect)
endprogram arrshow
---------- gdb ----------
(gdb) p vect
$1 = ()
(gdb) ptype vect
type = integer(kind=4) (0:-1)

+++ Test case 2: static array +++
---------- code ----------
program arrshow
  implicit none
  integer,parameter :: n = 5
  integer,dimension(n) :: vect
  integer :: i

  do i=1,n
    vect(i) = i
  enddo
  
  write(unit=*,fmt=*) vect
endprogram arrshow
---------- gdb ----------
(gdb) p vect
$1 = (1, 2, 3, 4, 5)
(gdb) ptype vect
type = integer(kind=4) (5)

-- 
Lurkos


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

* Re: cannot print allocatable arrays
  2011-09-23 15:20 cannot print allocatable arrays Lurkos
@ 2011-09-23 15:26 ` Jan Kratochvil
  2011-10-04 19:00   ` Lurkos
  2011-09-23 15:32 ` Joachim Protze
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-09-23 15:26 UTC (permalink / raw)
  To: Lurkos; +Cc: gdb

On Fri, 23 Sep 2011 16:46:10 +0200, Lurkos wrote:
> I'm using gdb 7.0.1-debian and gfortran 4.4.5 on Debian squeeze amd64.
> 
> I'm not able to print arrays that are declared as allocatable.

This works in archer-jankratochvil-vla branch
	http://sourceware.org/gdb/wiki/ArcherBranchManagement
and Fedora GDBs; even there it has some limitations for complicated data
structures but in general it works.

Not sure when it gets merged, it needs to be mostly rewritten.  There are
AFAIK also some independent efforts for this feature for GDB.


Regards,
Jan


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

* Re: cannot print allocatable arrays
  2011-09-23 15:20 cannot print allocatable arrays Lurkos
  2011-09-23 15:26 ` Jan Kratochvil
@ 2011-09-23 15:32 ` Joachim Protze
  1 sibling, 0 replies; 5+ messages in thread
From: Joachim Protze @ 2011-09-23 15:32 UTC (permalink / raw)
  To: gdb

On 23.09.2011 16:46, Lurkos wrote:
> I'm using gdb 7.0.1-debian and gfortran 4.4.5 on Debian squeeze amd64.
>
> I'm not able to print arrays that are declared as allocatable.
> It seems that gdb is not able to detect the correct size of the array
> allocated run-time.
> Is there a different way to print the values in this case?
>
> Thank you.
For debugging fortran90 code you may want to use a patched version of
gdb as recommended in
http://sourceware.org/bugzilla/show_bug.cgi?id=9395#c1

- Joachim


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

* Re: cannot print allocatable arrays
  2011-09-23 15:26 ` Jan Kratochvil
@ 2011-10-04 19:00   ` Lurkos
  2011-10-04 23:46     ` Lurkos
  0 siblings, 1 reply; 5+ messages in thread
From: Lurkos @ 2011-10-04 19:00 UTC (permalink / raw)
  To: gdb

*Jan Kratochvil* wrote:

>> I'm using gdb 7.0.1-debian and gfortran 4.4.5 on Debian squeeze amd64.
>> 
>> I'm not able to print arrays that are declared as allocatable.
>
> This works in archer-jankratochvil-vla branch
> 	http://sourceware.org/gdb/wiki/ArcherBranchManagement
> and Fedora GDBs; even there it has some limitations for complicated data
> structures but in general it works.
>
> Not sure when it gets merged, it needs to be mostly rewritten.  There are
> AFAIK also some independent efforts for this feature for GDB.

I have almost zero experience with git.
I read GDB wiki and also a couple of howtos about git.
I'm not sure if I have to clone gdb repository
(git://sourceware.org/git/gdb.git) or archer
(git://sourceware.org/git/archer.git) to merge archer-jankratochvil-vla
branch into mainline.

Can you please give me just a couple of hints and/or a suggestion of a
good reference to get started with git?

Thank!

-- 
Lurkos



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

* Re: cannot print allocatable arrays
  2011-10-04 19:00   ` Lurkos
@ 2011-10-04 23:46     ` Lurkos
  0 siblings, 0 replies; 5+ messages in thread
From: Lurkos @ 2011-10-04 23:46 UTC (permalink / raw)
  To: gdb

*Lurkos* wrote:

> I'm not sure if I have to clone gdb repository
> (git://sourceware.org/git/gdb.git) or archer
> (git://sourceware.org/git/archer.git) to merge archer-jankratochvil-vla
> branch into mainline.

I tried to do the following:
1. install "flex bison libncurses5-dev"
2. git clone git://sourceware.org/git/archer.git
3. git checkout -tb
archer-jankratochvil-vla origin/archer-jankratochvil-vla
4. ./configure
5. make

The new gdb in gdb/ folder seems working fine, at least with the
previous test case.

-- 
Lurkos


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

end of thread, other threads:[~2011-10-04 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23 15:20 cannot print allocatable arrays Lurkos
2011-09-23 15:26 ` Jan Kratochvil
2011-10-04 19:00   ` Lurkos
2011-10-04 23:46     ` Lurkos
2011-09-23 15:32 ` Joachim Protze

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