From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17327 invoked by alias); 3 Apr 2007 13:24:29 -0000 Received: (qmail 17319 invoked by uid 22791); 3 Apr 2007 13:24:28 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-04.spheriq.net (HELO lon-del-04.spheriq.net) (195.46.50.101) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 03 Apr 2007 14:24:20 +0100 Received: from lon-out-03.spheriq.net ([195.46.50.131]) by lon-del-04.spheriq.net with ESMTP id l33DOCZ3028806 for ; Tue, 3 Apr 2007 13:24:12 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-03.spheriq.net with ESMTP id l33DO525030330 for ; Tue, 3 Apr 2007 13:24:06 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id l33DO0xG016661 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Tue, 3 Apr 2007 13:24:03 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1F46BDA50 for ; Tue, 3 Apr 2007 13:23:58 +0000 (GMT) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DAFC9474E1 for ; Tue, 3 Apr 2007 13:23:57 +0000 (GMT) Received: from [164.129.44.95] (crx595.cro.st.com [164.129.44.95]) by mail1.cro.st.com (MOS 3.7.5a-GA) with ESMTP id CKD60714 (AUTH "denis pilat"); Tue, 3 Apr 2007 15:23:57 +0200 (CEST) Message-ID: <4612556C.1080709@st.com> Date: Tue, 03 Apr 2007 13:24:00 -0000 From: Denis PILAT User-Agent: Thunderbird 1.5.0.10 (X11/20070221) MIME-Version: 1.0 To: gdb-patches Subject: [RFC] DW_AT_type missing from DW_TAG_subrange_type Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00014.txt.bz2 For the global variable declared like that int array[] = {1, 2, 3, 4}; the dwarf information generated by our specific compiler is missing DW_AT_type missing from DW_TAG_subrange_type. Usually in dwarf2 information (ie like the bellow example for gcc4 under linux), the DW_AT_type exists for subranges : < 175 (0xaf) > DW_TAG_array_type | DW_AT_sibling : < 191 (0xbf) > | DW_AT_type : < 168 (0xa8) > `-------------------------- < 184 (0xb8) > DW_TAG_subrange_type * | DW_AT_type : < 191 (0xbf) >* <<<<<-------- missing from my elf file | DW_AT_upper_bound : DW_AT_upper_bound(DW_FORM_data1) : 3 `-------------------------- Therefore we go thru the code "base_type = alloc_type (NULL)" (in read_subrange_type of dwarf2read.c) and gdb prints the following if "set print array-indexes on": (all indexes are set to 0): (gdb) p array $1 = {[0] = 1, [0] = 2, [0] = 3, [0] = 4} Could we have a *builtin_type_int* as the default type instead of alloc_type (NULL) ? *Attach is a patch in that sense.* I'm also wondering about the code: base_type = die_type (die, cu); if (base_type == NULL) { complaint (&symfile_complaints, _("DW_AT_type missing from DW_TAG_subrange_type")); return; } It seems we'll never have (base_type == NULL). Am I right ? May be it's time to remove that as well. The complaints seems to be in a better place in my patch. For information, this testcase is present in gdb.base/arrayidx.exp where we have "set print array-indexes on" No regression for this patch for i386-linux target -- Denis Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.216 diff -u -p -r1.216 dwarf2read.c --- dwarf2read.c 30 Mar 2007 17:21:47 -0000 1.216 +++ dwarf2read.c 3 Apr 2007 09:41:07 -0000 @@ -4921,7 +4921,11 @@ read_subrange_type (struct die_info *die } if (TYPE_CODE (base_type) == TYPE_CODE_VOID) - base_type = alloc_type (NULL); + { + complaint (&symfile_complaints, + _("DW_AT_type missing from DW_TAG_subrange_type")); + base_type = builtin_type_int; + } if (cu->language == language_fortran) {