From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17845 invoked by alias); 25 Jun 2005 06:43:33 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17813 invoked by uid 22791); 25 Jun 2005 06:43:28 -0000 Received: from ausmtp01.au.ibm.com (HELO ausmtp01.au.ibm.com) (202.81.18.186) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 25 Jun 2005 06:43:28 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp01.au.ibm.com (8.12.10/8.12.10) with ESMTP id j5P6jpeU386306 for ; Sat, 25 Jun 2005 16:45:55 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.250.242]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j5P6kD8a126880 for ; Sat, 25 Jun 2005 16:46:13 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.12.11/8.13.3) with ESMTP id j5P6hIFe016075 for ; Sat, 25 Jun 2005 16:43:19 +1000 Received: from wks190384wss.cn.ibm.com (wks190384wss.cn.ibm.com [9.181.134.93]) by d23av01.au.ibm.com (8.12.11/8.12.11) with ESMTP id j5P6hHaA016047; Sat, 25 Jun 2005 16:43:18 +1000 Date: Sat, 25 Jun 2005 06:43:00 -0000 From: Wu Zhou To: fortran@gcc.gnu.org cc: gdb@sources.redhat.com Subject: About the debugging of gfortran arrays Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-06/txt/msg00248.txt.bz2 Hello all, I am trying to use gdb to debug gfortran program and encountered some problems with arrays: 1. The first one is about the lower bound. It seems that gfortran change the lower bound of some arrays to 0 by default (I got this feeling from my experience and I also see this kind of transfer in part of the code in gcc/fortran/trans-type.c. Dunno know whether it apply to all arrays. Anyone could confirm or deny this? Thanks in advance!) To handle this, GDB need to make responsive change. But I have one question here: is this kind of design (change the lower bound of array to zero) indispensible here? Is it ok to still output the original bounds in the debug info? 2. The second one is about two-dimension array. In the debuginfo output by gfortran, two-dimension array will be flatten to one-dimension. Take a look at the following testcase please: program array2 integer a(5, 5) do i = 1, 5 do j = 1, 5 a(i, j) = i * j write (*, *) a(i, j) end do end do end program After using gfortran to compile this testcase, I can use readelf to get the following debuginfo: <2><89>: Abbrev Number: 3 (DW_TAG_variable) DW_AT_name : a DW_AT_decl_file : 1 DW_AT_decl_line : 2 DW_AT_type : DW_AT_location : 3 byte block: 75 94 7f (DW_OP_breg5: -108) ... <1>: Abbrev Number: 7 (DW_TAG_array_type) DW_AT_type : <2>: Abbrev Number: 8 (DW_TAG_subrange_type) DW_AT_type : DW_AT_lower_bound : 0 DW_AT_upper_bound : 24 >From the above, we can see that two-dimension array a(5, 5) is changed to a one-dimension array with 25 elements (0 - 24). Although there is no problem for the output binary, but it make some trouble for GDB. So I am thinking of whether there is any solution for this in gfortran's side? For example, treat it as one-dimension array in the outputed binary, but still output two-dimension one in the debug information. Maybe others? Just my two cents. Any comments are highly appreciated. Cheers - Wu Zhou